fix(from_file): convert registered vocabularies in the browser; keep quoted labels - #31
Merged
Merged
Conversation
…quoted labels
select_*_from_file only converted to LimeSurvey TSV when a Node caller read
registry/vocab/<file>.csv from disk and passed it in, so the browser entry threw
"Unimplemented XLSForm type" for a type the registry lists as supported.
- codegen emits src/generated/VocabularyOptions.ts: every registered
vocabulary's options, parsed with Python's csv module.
- src/vocab.ts (browser-safe): registeredFileChoices() and parseVocabCsv(),
now on the RFC 4180 tokenizer from responseFile.ts. parseVocabCsv is
exported from the package root.
- XLSFormToTSVConverter.convert() inlines registered vocabularies by default;
an explicit fileChoices entry adds an unregistered file or overrides a
registered one. XLSFormParser.convertXLS{File,Data}ToTSV take fileChoices.
- fileChoices.ts (node-only) keeps only the from-disk lookup the CLI uses for
CSVs beside a form.
The old parseVocabCsv split on every comma, so 14 ISO 3166-1 labels such as
"Korea, Republic of" were emitted as '"Korea'. The two long_list TSV
snapshots are re-blessed; that is their only change. The bless script and the
snapshot contract test no longer pass file choices, so they exercise the
built-in path.
The generated skill told authors to put from_file options on the choices
sheet; it now points them to the registered-vocabulary table instead.
Closes #24
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
jstet
added a commit
that referenced
this pull request
Sep 25, 2026
…ns issues (#49) Every work item moved into a self-contained cdl-wp-eins issue, rechecked against its main: - #27 (rewritten): the formtransform library entry on /tools (id distinct from the app's), drop xlsform2lstsv; its open questions answered - #26 (rewritten): survey2ddi references, still gated on survey2ddi's final release, except the broken /tools/survey2ddi link, which can be fixed now; API pull → platform export, reader → examples/python/ddi_reader.py - #28: methodology-only llm endpoint, so formulaid can drop its heading strip - #29: mark unsupported/partly supported XLSForm features (rank, calculate, external CSV; from_file with registered vocabularies only; range bounds without step) - #30: registry slugs as question-type example ids, with the mapping to qwacback's example ids - #31: CI link check and toc.json ↔ snippet check (the repo has no CI yet) Each carries the rules (snippet paths other apps fetch, llm headings as an interface, link to the subset instead of restating it). No HANDOVER_*.md is left in this repo. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #24.
Browser conversion of
select_*_from_fileRegistered vocabularies now ship as generated data (
src/generated/VocabularyOptions.ts, emitted by codegen fromregistry/vocab/*.csv), andXLSFormToTSVConverter.convert()inlines them by default. So the browser entry convertsselect_one_from_file iso_3166_1.csvwith no filesystem access.fileChoices(4th arg) still works: it adds an unregistered CSV or overrides a registered one.XLSFormParser.convertXLSFileToTSV/convertXLSDataToTSVtakefileChoicestoo.parseVocabCsvis exported from the package root, for vocabularies the caller loads themselves.src/fileChoices.tsstays node-only; the CLI uses it for CSVs beside a form.Bug fixed along the way: quoted labels
The old
parseVocabCsvsplit on every comma. 14 ISO 3166-1 labels were cut at the comma, e.g."Korea, Republic of"→"Korea, and the blessed snapshots had frozen that.parseVocabCsvnow uses the RFC 4180 tokenizer fromresponseFile.ts, and codegen parses the CSVs with Python'scsv. The two*_long_list/tsv.tsvsnapshots are re-blessed: the 14 labels per file are the only diff.Also
skills/cdl-survey-types/references/question-types.md) told authors to definefrom_fileoptions on thechoicessheet. It now points to the registered-vocabulary table.Tests
tests/ts/unit/vocab.test.ts: quoted labels, BOM/CRLF, column order, missing columns, registered vs. unregistered files, override, and an unknown file still throwing.tests/ts/integration/browserBundle.test.ts: the esbuild browser bundle converts theselect_one_long_listfixture.npm run validateis clean. vitest: 55 files, 808 tests. pytesttests/validation: 35 passed.Downstream
formtransform-app's e2e suite marks the two TSV cases
test.failwith a link to #24. Once it pins a release containing this, those markers will fail and should be removed.🤖 Generated with Claude Code