Skip to content

Support the hidden question type in the web app - #71

Merged
jstet merged 1 commit into
mainfrom
feat/hidden-question
Oct 29, 2026
Merged

jstet merged 1 commit into
mainfrom
feat/hidden-question

Conversation

@jstet

@jstet jstet commented Oct 29, 2026

Copy link
Copy Markdown
Member

Since formtransform 0.10.0 (#68), hidden is a registered question type. This PR makes the web app handle it properly. A hidden field holds a value from the survey link, such as a partner, module or wave, and is never filled in by the respondent.

What changed

  • Model: Question gets an optional default. The parser reads it from default (or default_value), and a hidden question is always parsed with required: false.
  • Workbook: xlsform_generator.ts writes the XLSForm default column, but only when some question has a default. Forms without defaults keep their current layout. The required cell of a hidden row is left empty.
  • Quality checks: a new isAnswerable() treats hidden like note. Hidden fields don't count towards the 8–15 / maxQuestions bounds or research-question coverage, and they aren't checked for wording.
  • UI: SurveyView shows a hidden field with its own badge and the line "filled from the survey link". It also shows the default, or says that there is none, and never shows answer options.
  • Prompts:
    • generate-instructions.md documents the default field and adds a "Hidden fields" rule: when to use one, no choices, no required, a default when a link may leave the value out.
    • It also gives the caveats: KoboCollect only gets the default, Kobo web forms take ?d[/<root>/<name>]=…, and in LimeSurvey the link parameter is the question code.
    • The repair prompt gets a matching line.
    • The skill was rebuilt by the pre-commit hook.
  • Tests:
    • New unit tests in src/lib/agents/hidden.test.ts. They check that validateSubset gives no findings, and that one conversion to LimeSurvey turns the hidden question into an S question with hidden=1 and default=direkt.
    • A new e2e fixture, hidden-partner, also goes through pyxform and ODK Validate. It only adds new snapshot entries; existing ones are unchanged.

Choices made

  • default is written for any question that has one, not only for hidden. The prompt asks for it on hidden only.
  • Hidden fields are not answerable questions. They don't count as covering a research question either.
  • The UI doesn't show an example link, because the parameter differs per platform. The caveats are in the prompt.

Checks (local)

bun run lint, bun run check (0 errors), bun run test (160 passed), bun run test:e2e (67 vitest + 14 pytest passed) and bun run build all pass.

Closes #69

🤖 Generated with Claude Code

A `hidden` question is filled from the survey link (a partner, module or
wave), never by the respondent:
- Question gets an optional `default`, parsed from the model output and
  written to the XLSForm `default` column (only when a question has one);
- `required` is never set on hidden, in the parser or the workbook;
- hidden fields don't count as answerable questions in the quality checks;
- the survey view shows them as filled from the link, with their default;
- the generator and repair prompts say when to use it, with the Kobo and
  LimeSurvey caveats.

Closes #69

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jstet
jstet merged commit 37805f4 into main Oct 29, 2026
1 check passed
@jstet
jstet deleted the feat/hidden-question branch October 29, 2026 17:29
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.

Web app: support the hidden type (default, not required, shown as link-filled)

1 participant