Repository navigation
Conversation
Contributor
|
Thanks Josh, this is a useful sweep. Most of these can go in as they are; notes by ISS below. Hold for public discussion on [#Terminology Service Test Cases](https://chat.fhir.org/#narrow/channel/437028-Terminology-Service-Test-Cases):
Some of these changes will therefore need ecosystem tests, once we've sorted that. Changes needed:
Fine as is: ISS30 (report the supplement, since it's in play), ISS04, and the rest of the commits. Nits:
|
…ect missing relationship
…, empty term, non-ASCII ws)
…ces for cycle detection
…ALUESET_VERSION_CHECK
…lse and compose.exclude
…r_resource_expected
…laysFromIncludeConcept
…uages and buildParameters
jmandel
force-pushed
the
fix/fuzz-bugs-2026-12
branch
from
December 6, 2026 21:48
87f3d92 to
87b4c54
Compare
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.
Summary
This PR fixes 26 bugs discovered via systematic terminology server fuzzing and differential testing against
main(456744bf), covering HTTP 500 crashes, invalid JSON / FHIR schema violations, parameter/wire handling, VCL / ECL 2.2 / filter semantics,$expand,$validate-code,$lookup,$translate,$subsumes, and i18n formatting.Every fix is structured as a standalone, self-contained, cherry-pickable commit paired with its own focused Jest regression test (
tests/tx/fix-*.test.js) so individual commits can be reviewed, discussed, or cherry-picked independently with zero cross-commit entanglement.Commit & Issue Index
Group A — HTTP 500 Crashes, Wire Safety & Parameter Validation
2976697a_searchJSON (400 on object/array), and preserve repeated params inBundle.link.urltx/workers/search.js,tests/tx/fix-iss01-search-params.test.jsccbab800$batch-validate-codeAllow: POST) forGET /$batch-validate-codeand HTTP 400 for malformed POST bodies instead of HTTP 500TypeErrortx/workers/batch-validate.js,tests/tx/fix-iss02-batch-validate-get.test.js39f22d2fcompose.lockedDate422incheckNoLockedDatesoValueSet.compose.lockedDatereturns HTTP 422 instead of HTTP 500tx/workers/worker.js,tests/tx/fix-iss03-locked-date.test.js8c9eed2fParametersparameterentries with >1value[x]key or mixingvalue[x]/resource/partwith HTTP 400tx/library/parameter-types.js,tests/tx/fix-iss04-multi-value-param.test.jsaeacda6btoo-costlyIssuefromOMOPServices.iterator()/nextContext()instead of rawError(HTTP 500)tx/cs/cs-omop.js,tests/tx/fix-iss05-omop-iterator.test.js96de664f😀,🩺) never emit lone surrogates (\ud83d/\ud83e) invalid under RFC 8259vcl/vcl-parser.js,tx/sct/expressions.js,tests/tx/fix-iss08-surrogate-pairs.test.jsff386ba5Parametersinteger(-2147483648..2147483647),positiveInt(>= 1), andunsignedInt(>= 0) bounds with HTTP 400tx/library/parameter-types.js,tests/tx/fix-iss09-int32-bounds.test.js1d0c5b59entity.parse.failedalongsideentity.too.largeso malformedapplication/jsonbodies return HTTP 400application/fhir+jsonOperationOutcomeinstead of HTMLtx/tx.js,tests/tx/fix-iss15-malformed-json.test.js87f3d922Accept-LanguageviaLanguages.fromAcceptLanguage(..., true, true)instead ofLanguageDefinitions.parse()inrequestLanguages()andbuildParameters(), preventing HTTP 500TypeError: languages is not iterablewhen clients (browsers, Nodefetch) sendAccept-Language: *oren-USon error pathstx/tx.js,tx/workers/worker.js,tests/tx/fix-accept-language-iterable.test.jsGroup B — Core Terminology Semantics & Schema Conformance
fa08e6a0$translate(R5)target.equivalenceto R5relationshipand stripequivalenceon R5 responses (never emitting valueless{"name":"relationship"})tx/workers/translate.js,tx/xversion/xv-conceptmap.js,tx/xversion/xv-parameters.js,tx/tx.js,tests/tx/fix-iss10-translate-r5-equiv.test.js52e1b587$lookupdescriptionsub-part for displaylessparent/childconcepts instead of emitting invalid emptyvalueString: ""(ele-1)tx/cs/cs-cs.js,tests/tx/fix-iss11-lookup-empty-desc.test.js6935ac7f$expandcs.system() + cs.system()typo and emit standard'used-codesystem'instead ofcs.contentMode()("example") for non-complete package CodeSystemstx/workers/expand.js,tests/tx/fix-iss12-expand-example-cs.test.jsa9873489$expand/$validate-codecompose.include/excludeentries carrying bothconceptandfilter(e.g. VCLand-code-filter) as intersection instead of union, while preserving HL7vcl-tests.jsonAST expectationstx/workers/expand.js,tx/workers/validate.js,tests/tx/fix-iss16-concept-filter-intersection.test.jsb308d03c$expand/$validate-codeextension-ValueSet.compose.include.filter.op(of) emitted byvcl-parser.jsfor.propertyprojectiontx/workers/supplement-filters.js,tx/workers/expand.js,tx/workers/validate.js,tx/cs/cs-cs.js,tests/tx/fix-iss17-filter-op-of.test.js01621fe2parent existsfilter over nestedCodeSystem.concept.concepthierarchy (matching_handleChildExistsFilter)tx/cs/cs-cs.js,tests/tx/fix-iss18-parent-exists-filter.test.js5e1e7c7c$lookupnullinstead of''for absentversionparameter sosystemcarryingurl|versionresolves instead of failing HTTP 422Version inconsistenttx/workers/lookup.js,tx/provider.js,tests/tx/fix-iss19-lookup-system-version.test.js4d14ebc0$lookupde,fr) to satisfy regionaldisplayLanguage(de-DE,fr-CA) inFhirCodeSystemProvider.display()without breakinghasAnyDisplaysteststx/cs/cs-cs.js,tests/tx/fix-iss20-display-language-fallback.test.jsGroup C — SNOMED ECL 2.2 Grammar & Validation / Diagnostics
e876ff51[5..2]), repeated{{ + HISTORY-* }}, empty pipe term (||), and non-ASCII whitespace (\u00A0)tx/sct/ecl.js,tests/tx/fix-iss22-ecl-grammar.test.js5321240d$expandprimaryResourcesin sessionlessadditionalResourcesso circular inlineValueSetreferences report HTTP 400VALUESET_CIRCULAR_REFERENCEinstead of422 not-foundtx/workers/worker.js,tests/tx/fix-iss29-sessionless-cycle.test.js6d1eef70$expandused-supplement/used-codesystemparameters even whenoffset >= totalskips adding concepts tocontainstx/workers/expand.js,tests/tx/fix-iss30-offset-used-supplement.test.js4684795a$validate-codeValueSetwrapper (source?.jsonObj ?? source) incheckCanonicalStatusFulland callcheckCanonicalStatusCSfor CodeSystem providers at lines 635, 919, 1004tx/workers/validate.js,tests/tx/fix-iss31-canonical-status.test.js2e94bfc6'(no version)'instead of literal'null'and deduplicateVALUESET_VERSION_CHECKviaaddIssueIfNewtx/workers/worker.js,tests/tx/fix-iss32-check-version.test.js40ca57fd$validate-codeone of 4 choices/one of 6 choices) onabstract=falseandcompose.excludetx/workers/validate.js,tests/tx/fix-iss33-validate-display-dedup.test.jsf2e92355''before parameter substitution so values starting with'(e.g.'release' van contractuur) aren't strippedlibrary/i18n/i18nsupport.js,tests/tx/fix-iss34-i18n-quote-order.test.jsbd1de6e8$subsumesParametersJSON POST bodies (Bundle, etc.) with HTTP 400 andoperationoutcome-message-id: Wrong_type_for_resource_expectedtx/workers/subsumes.js,tests/tx/fix-iss35-subsumes-wrong-type.test.js31b5c9c0$expandpreferredForLanguagedesignations inlistDisplaysFromIncludeConcepttx/workers/expand.js,tests/tx/fix-iss37-expand-designation-dedup.test.jsNotable Design Decisions & Audit Notes
456744bf(PR 2026 12 gg unknown combinations #491):total: 1(ISS-13) was already fixed byb35799fc(revise handling of special value sets (#488)).modified = true(ISS-26) and NDC multi-filter /iterator()(ISS-27,ISS-28) were already fixed bycf552800and04cc3b39.cddc3483(omop status fixes) addressedinvalid_reasonrather thaniterator()/nextContext(), soISS-05remained open and is fixed inaeacda6b.sqlite-v2(PR sqlite-v2: data-driven tx-terminology/1 files for all served terminologies #489): SNOMED-backend-specific items (ISS-06,ISS-07,ISS-14,ISS-23,ISS-24,ISS-25,ISS-36) are already addressed in thesqlite-v2rewrite and are not touched here.ISS-21):$comparecallingsubsumesTestonpart-of/grouped-byhierarchies currently agrees with$expand(which also walks nestedconcept.conceptchildren forconcept is-aonpart-of/grouped-by). RestrictingsubsumesTestalone would make$comparereportdisjointwhile$expandproduces a strict superset, so this is left for separate design discussion.ISS-16& HL7 VCL test suite compatibility: Official HL7vcl-tests.jsoncases (and-code-filter,and-scope-first-only,and-of-or-codes) expectvcl-parser.jsto keepconceptandfiltertogether on onecompose.include. Keepingvcl-parser.jsintact and evaluatingconcept+filteras an intersection inexpand.jsandvalidate.jssatisfies both the HL7 VCL parser suite and FHIR expansion/validation semantics.ISS-02& OpenAPI test compatibility:tests/tx/openapi.test.jslistsGET /CodeSystem/$batch-validate-codeandGET /ValueSet/$batch-validate-codeas excluded routes, so returning405(Allow: POST) insideBatchValidateWorker.processBatch(matchingGET /$closure) preservesopenapi.test.jsandbatch-cancellation.test.js.Verification
ESLint:
npx eslint $(git diff --name-only origin/main..HEAD)0 errors, 0 warnings across all modified and newly added files.
Jest:
tests/tx/fix-*.test.js): 26/26 suites passed, 68/68 tests passed.npx jest --maxWorkers=4 --workerIdleMemoryLimit=512MB --testPathIgnorePatterns='tests/tx/test-cases\.test\.js'): 506/506 runnable suites passed (17,151 tests, 0 failures) — includingtests/vcl/vcl-test-cases.test.js,tests/tx/openapi.test.js,tests/tx/batch-cancellation.test.js,tests/tx/triage-b.test.js,tests/tx/expand-exclude-version.test.js,tests/cs/cs-cs.test.js, andtests/cs/cs-omop.test.js. (tests/tx/test-cases.test.jswas skipped offline because it downloadssct_intl_20260701-21.cachefrom GCS.)Live R4 + R5 server verification:
server.jswith full loaded FHIR R4/R5 core packages, SNOMED CT, and OMOP, and executed 29/29 live HTTP reproducers covering every fixed issue (plus confirmingISS-13on456744bf) — 29/29 passed, 0 failed.fetch()verification (which sendsAccept-Language: *by default) also surfaced therequestLanguages()/buildParameters()TypeError: languages is not iterableHTTP 500 bug, which is fixed and regression-tested in commit87f3d922.