Skip to content

formtransform snippet: drop xlsform2lstsv, mention DDI, add scope caveat - #25

Open
jstet wants to merge 1 commit into
mainfrom
formtransform-scope-notice
Open

jstet wants to merge 1 commit into
mainfrom
formtransform-scope-notice

Conversation

@jstet

@jstet jstet commented Aug 19, 2026

Copy link
Copy Markdown
Member

Companion PR to CorrelAid/formtransform-app#7. The current snippet at src/content/snippets/formtransform/{en,de}.html is stale on three points that the migration off xlsform2lstsv + Pyodide/survey2ddi (see CorrelAid/formtransform-app HANDOVER doc) made obvious:

  1. it still credits xlsform2lstsv, which has been removed from the app;
  2. it only mentions the LimeSurvey TSV conversion — the app also emits DDI Codebook 2.5 XML;
  3. it does not warn that the converter only handles the subset registered in the CDL survey type registry; arbitrary XLSForms are rejected rather than approximated.

This PR does three things in both EN and DE, keeping the existing <section><p>…</p></section> shape:

  • replace the xlsform2lstsv link with the @correlaid/formtransform repo;
  • add the DDI Codebook 2.5 output alongside the LimeSurvey TSV one;
  • add the same one-sentence scope caveat used in the in-app notice, so both surfaces stay in sync.

No other snippets or template files are touched. DDI link points at the public DDI Alliance spec page; @correlaid/formtransform link points at the repo's README (the canonical place for the supported-subset list — same anchor the in-app notice links to).

App-side companion to CorrelAid/formtransform-app#7. The CDL
website intro for the FormTransform page was factually stale on
three counts and the migration off xlsform2lstsv + Pyodide made
all three visible:

- it still credited xlsform2lstsv;
- it only mentioned the LimeSurvey TSV conversion, not the
  DDI Codebook XML output;
- it did not warn that the converter is a strict subset of
  the CDL survey type registry, so an arbitrary XLSForm is
  rejected rather than approximated.

Replace the xlsform2lstsv link with the @correlaid/formtransform
repo (the new single dependency that powers both conversions).
Add the DDI output. Add the same one-sentence scope caveat
that the in-app notice uses, in both EN and DE, to keep the
two surfaces in sync.
jstet pushed a commit to CorrelAid/formtransform-app that referenced this pull request Sep 24, 2026
Closes #7.

The library is strict by design — it rejects any XLSForm
question type, appearance, or expression outside the CDL survey
type registry, with the same "no guessing" rule applying to
identifier length, nesting depth, and reserved words. Someone
arriving with an arbitrary XLSForm will see the lib throw, and
read the throw as a bug. Two surfaces, kept in sync, so the
restriction is stated up front:

- in-app: a callout between the page <h1> and the tab bar,
  string in the app's own i18n (not the fetched CDL snippet —
  the cdl-content plugin silently falls back to '' on a fetch
  failure, so a disclaimer that can vanish is not a disclaimer);
- on the CDL website: same caveat in the existing single-<p>
  formtransform snippet, which was also factually stale on
  three points (still credited xlsform2lstsv, only mentioned
  the TSV path, no scope caveat). Companion PR:
  CorrelAid/cdl-wp-eins#25.

### In-app changes

- src/lib/i18n.ts: new `scope.notice` and `scope.link` strings
  in both locales, EN + DE, using the wording drafted in the
  issue (no softening into marketing copy).
- src/routes/+page.svelte: import `marked` from the now-direct
  app dep, render the notice as a bordered callout between the
  description and the tab bar. The value passed to `$t(...)` is
  plain text (the `**...**` is markdown), so the issue's
  "no `{@html}` over user-controlled strings" rule is preserved.
  Styling uses existing CDL tokens: `--color-secondary` for the
  left border, `--color-background-primary` for the fill,
  `--spacing-base` for padding, `--radius-md` for the corners.
- package.json: add `marked` as a direct dependency (the lib
  already used it transitively for `convertMarkdown: true` in
  the TSV tab; the app now declares it explicitly because it
  also renders the scope notice).
- bun.lock: one new line for `marked`.
- scripts/verify-scope-notice.mjs: Playwright driver. Loads
  `/`, then switches to DE via the LanguageSwitcher, and
  asserts: (a) `.scope-notice` exists in both locales,
  (b) it appears before `.tab-nav` in document order,
  (c) no `pageerror` or `console.error` fires.

### Verification

`bun scripts/verify-scope-notice.mjs http://127.0.0.1:5175/`
against the built static site reports both locales render with
the notice before the tabs and no console errors. EN shows
"Scope: the CDL survey ecosystem." in bold; DE shows
"Geltungsbereich: das CDL-Umfrage-Ökosystem." Both link to
`https://github.com/CorrelAid/formtransform#supported-xlsform-subset`.

`bun run build` is green. `bun run lint` and `bun run check`
remain broken on main (19 / 1+4 pre-existing); unchanged by
this commit, out of scope for #7.

### Out of scope

- Snippet freshness in `vite.config.ts`'s cdl-content plugin
  (the build-time fetch of the snippet). The app will pick
  up the new snippet text the next time the build runs against
  the merged CDL PR; nothing on the app side needs to change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant