Skip to content

test: fix the oracle layout and commit the minimal case's first oracles - #108

Merged
ExtraToast merged 1 commit into
mainfrom
test/82-oracle-layout
Sep 14, 2026
Merged

ExtraToast merged 1 commit into
mainfrom
test/82-oracle-layout

Conversation

@ExtraToast

@ExtraToast ExtraToast commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

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 under src/. Keys sort by UTF-16 code units, numbers format as ECMAScript does, and null, undefined, non-finite numbers, non-JSON values (a Date, a Map, a function, a bigint) and lone surrogates are refused with the JSON Pointer of where they sat. src/index.ts exports it, so the boundary lint stops skipping and enforces over real modules.
  • spec/v1/examples/minimal/expected/intent.json: notes.project.yml parsed, compared field by field with the authored file, written in canonical form.
  • spec/v1/examples/minimal/expected/dependencies.json: {"applications":[{"edges":[],"id":"notes"}]}, since minimal declares no dependency.
  • test/oracles.test.ts holds every tracked oracle file (expected/*.json and *.diagnostics.json under spec/v1/examples/) to be byte-identical to its own canonicalisation, and checks each dependencies.json has one id and edges per Application.
  • The parity contract states the ownership rule (whichever implementation lands a case first commits its reviewed oracle, and the other matches it), the dependencies.json shape, and that an oracle has no final newline; .editorconfig says the same for those paths.

The decisions later tickets inherit

resolved.json for minimal moves 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 spells RollingUpdate and securityContext, and needs images-lock digests minimal has 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 need intent.json.

The two writers share cases, not code. test/canonical-json.test.ts carries the same cases as emf/parity's CanonicalJsonTest, 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 to Number(), 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, a null (naming /a/0) and text that is not JSON; ignores non-oracle JSON; passes the committed files.
  • npm run verify exit 0: requirements lint: 20 rows clean, link lint: 175 files clean, dependency-cruiser clean over src/ (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-019 and REQ-020, after #106's REQ-017 and REQ-018.

@ExtraToast ExtraToast added type: test Test coverage, fixtures, or validation changes. area: deploy homelab-deploy, deploy-v2, manifests, and rollout flow. component: tests Unit, integration, system, or contract test concern. labels Sep 14, 2026
@ExtraToast ExtraToast self-assigned this Sep 14, 2026
@ExtraToast
ExtraToast force-pushed the test/82-oracle-layout branch from 06c1c53 to ec69111 Compare September 14, 2026 17:13
@ExtraToast
ExtraToast merged commit d84c6d9 into main Sep 14, 2026
17 of 18 checks passed
@ExtraToast
ExtraToast deleted the test/82-oracle-layout branch September 14, 2026 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: deploy homelab-deploy, deploy-v2, manifests, and rollout flow. component: tests Unit, integration, system, or contract test concern. type: test Test coverage, fixtures, or validation changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix the oracle layout and commit the minimal case's oracles

1 participant