Repository navigation
Validate the value written to the extensible key in its accessor - #80
Merged
Merged
Conversation
The accessor for the extensible key (such as vertices) stored any value. A string was written out as a malformed list, a repeat with an unknown field kept it in epJSON output and lost it in IDF output, and [null] was stored before the reference update failed on it, leaving the reference graph without the list's edges. The accessor now throws a TypeError before writing unless the value is null, undefined (both still clear the list), or an array of plain objects whose keys are all fields of the repeat. Property assignment and set share the check, and extensibleValueProblem exports it so that other writers can ask the same question. Values given at construction do not pass through the accessor; validateObject still reports them, and its test now builds the malformed object the way a reader would. The Python library's single assignment already rejects the same values.
This was referenced Oct 21, 2026
samuelduchesne
added a commit
that referenced
this pull request
Oct 21, 2026
The level adds the five update cases, the update operation and the post-operation-epjson assertion, and removes the six typescript divergence entries for those cases, which #80 and #81 close. conformance.ts and the EPW sentinel table are regenerated from the new tag; only their recorded level changes. The publication gate's attested level moves with the pin, with the evidence taken at the tag in both languages.
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
The accessor for an object's extensible key (such as
verticesorbranches) stored any value it was given. Three consequences were observed:[null]was stored before the document's reference update failed on it, leaving the reference graph without the list's edges.The accessor now throws a
TypeErrorbefore writing unless the value isnull,undefined, or an array of plain objects whose keys are all fields of the repeat.nullandundefinedstill clear the list.Changes
packages/core/src/shape.ts: the extensible key's accessor validates its value throughextensibleValueProblem(value, groupFields), which is exported so that other writers can apply the same check. Property assignment andsetboth pass through it.packages/core/tests/document.test.ts:setand property assignment reject four invalid values ('x',[null],[[1]],[{ bogus: 1 }]) and leave the object unchanged;nullandundefinedclear the list.packages/core/tests/regressions.test.ts:[null]on aBranchListis rejected and the reference to the branch survives.packages/core/tests/validate.test.ts: the test that builds a malformed object forvalidateObjectnow writes to the object's data directly, as a reader does, becausesetrefuses the value.CHANGELOG.md: entry under Unreleased, Changed.Behaviour change
This is a behaviour change for
setand property assignment, recorded under Changed. Values given at construction (by a reader,addorclone) do not pass through the accessor and are not checked here, because a reader must accept whatever a file holds;validateObjectcontinues to report them. The Python library's single assignment already rejects the same values, so this aligns the two languages.Stack
This is the base of a two-pull-request stack. The pull request for
IdfObject.update(feature 015, idfkit/idfkit#235) builds on it:updaterefuses the same values during its examination, so that a malformed list cannot be written after earlier entries of the group.Verification
npm run typecheck: passes.npm run format:check: passes.npm test: 907 of 907 tests pass across 35 files.mainwithout the change toshape.ts.