test: fix the oracle layout and commit the minimal case's first oracles - #108
Merged
Merged
Conversation
ExtraToast
force-pushed
the
test/82-oracle-layout
branch
from
September 14, 2026 17:13
06c1c53 to
ec69111
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.
Closes #82 (parent #78)
What this branch does
The first oracle files exist, so the model-driven parser (#83) and the production parser (#38, rewritten in #77) have something to match before either is written.
src/infrastructure/canonical-json.ts, the production implementation's RFC 8785 writer and the first module undersrc/. Keys sort by UTF-16 code units, numbers format as ECMAScript does, andnull,undefined, non-finite numbers, non-JSON values (aDate, aMap, a function, abigint) and lone surrogates are refused with the JSON Pointer of where they sat.src/index.tsexports it, so the boundary lint stops skipping and enforces over real modules.spec/v1/examples/minimal/expected/intent.json:notes.project.ymlparsed, compared field by field with the authored file, written in canonical form.spec/v1/examples/minimal/expected/dependencies.json:{"applications":[{"edges":[],"id":"notes"}]}, sinceminimaldeclares no dependency.test/oracles.test.tsholds every tracked oracle file (expected/*.jsonand*.diagnostics.jsonunderspec/v1/examples/) to be byte-identical to its own canonicalisation, and checks eachdependencies.jsonhas oneidandedgesper Application.dependencies.jsonshape, and that an oracle has no final newline;.editorconfigsays the same for those paths.The decisions later tickets inherit
resolved.jsonforminimalmoves to #42. The ticket asked for it here, in model words. But the model-word shape of layer 2 is exactly what #42 designs; chapter 20's worked projection still spellsRollingUpdateandsecurityContext, and needs images-lock digestsminimalhas no lock for. A hand-written one here would decide #42's design first. #82, #42 and #92 are amended on GitHub. Nothing downstream waits: #77 and #83 only needintent.json.The two writers share cases, not code.
test/canonical-json.test.tscarries the same cases asemf/parity'sCanonicalJsonTest, including RFC 8785's key-sorting example, the ECMAScript number boundaries (1e-7,1e+21,5e-324) and lone surrogates. Number inputs are written as strings passed toNumber(), mirroring the Java table, and non-ASCII characters are built from code points so the test source stays ASCII.The parsed intent is the project file alone. Env files are a second authored document with their own grammar, so they get their own oracle when a parser reads them.
Verification
test/canonical-json.test.ts: 31 cases; the writer is at 100% statements, branches, functions and lines.test/oracles.test.ts: refuses keys out of order, insignificant whitespace, a trailing newline, a non-shortest number, anull(naming/a/0) and text that is not JSON; ignores non-oracle JSON; passes the committed files.npm run verifyexit 0:requirements lint: 20 rows clean,link lint: 175 files clean, dependency-cruiser clean oversrc/(2 modules), 402 tests. Coverage ratchet raised: statements 98.32 to 98.37, branches 92.82 to 93.1, functions 100, lines 98.19 to 98.25.Rebased on #106 and #107: the behaviour rows are
REQ-019andREQ-020, after #106'sREQ-017andREQ-018.