feat(std/json-schema): static references with $ref, $id, $anchor, $defs and SchemaRegistry #555

Merged
argus merged 3 commits from loop/553-json-schema-references into main 2026-10-29 05:57:45 +00:00
Collaborator

Closes #553

Step 2a of #80: static JSON Schema references in std/json-schema.

  • JsonSchema.read accepts $id, $anchor, $ref and $defs; validate(instance, registry) resolves references against the schema's own resources, anchors and pointers (~0/~1, percent-decoding) and an optional SchemaRegistry of supplied documents. No socket or file access.
  • An unresolved reference fails the validation and names the URI; a reference cycle that never consumes the instance is reported, not a hang.
  • $dynamicRef, $dynamicAnchor, $vocabulary, unevaluated* and a $ref to a meta-schema are still refused at read time, naming the keyword.
  • Vendored suite (23.1.0) regenerated: gains ref, refRemote (suite remotes/ loaded into a registry), anchor, defs, id, infinite-loop-detection, unknownKeyword (843 cases). Groups that need a meta-schema or unevaluatedProperties stay in exclusions with a reason; the items and subitems exclusion is gone.
  • Docs page, ROADMAP and skills/ updated.

Local checks: std/json-schema unit tests 35/35, suite 846/846, torb format --check, docs check, docs index/skill/declarations --check, doc --check --no-run std, tools/check-commits.sh clean.
Depends on #556 (merged as b471d025d; tier B on main is green again, branch rebased on it).

Closes #553 Step 2a of #80: static JSON Schema references in `std/json-schema`. - `JsonSchema.read` accepts `$id`, `$anchor`, `$ref` and `$defs`; `validate(instance, registry)` resolves references against the schema's own resources, anchors and pointers (`~0`/`~1`, percent-decoding) and an optional `SchemaRegistry` of supplied documents. No socket or file access. - An unresolved reference fails the validation and names the URI; a reference cycle that never consumes the instance is reported, not a hang. - `$dynamicRef`, `$dynamicAnchor`, `$vocabulary`, `unevaluated*` and a `$ref` to a meta-schema are still refused at read time, naming the keyword. - Vendored suite (23.1.0) regenerated: gains `ref`, `refRemote` (suite `remotes/` loaded into a registry), `anchor`, `defs`, `id`, `infinite-loop-detection`, `unknownKeyword` (843 cases). Groups that need a meta-schema or `unevaluatedProperties` stay in `exclusions` with a reason; the `items and subitems` exclusion is gone. - Docs page, ROADMAP and `skills/` updated. Local checks: `std/json-schema` unit tests 35/35, suite 846/846, `torb format --check`, `docs check`, `docs index/skill/declarations --check`, `doc --check --no-run std`, `tools/check-commits.sh` clean. Depends on https://git.torb.dev/torbscript/language/pulls/556 (merged as b471d025d; tier B on main is green again, branch rebased on it).
docs(std/json-schema): document references and SchemaRegistry
Some checks failed
ci / commit messages (pull_request) Successful in 3s
ci / what the change touches (pull_request) Successful in 3s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 8s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 2m20s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Failing after 11m20s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m32s
ci / tier A (linux-x64) (pull_request) Successful in 26m1s
ci / pack the seed (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Successful in 4m49s
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m21s
ci / gates (pull_request) Failing after 0s
3b618716e7
Collaborator

CI red on 3b61871: ci / tier B (linux-x64) (failed after 11m20s) and ci / gates (failed after 0s, follows tier B). I cannot read the job logs with the reviewer token, so the cause is not seen here. main (6a8bb01) fails the same two checks on its push run (run 2113, tier B after 11m33s), so this may not come from this PR. Tier A, bootstrap, the C-emission check and pdisc are green on this head.

No other blockers found in the diff: scope matches #553, the code in std/json-schema is covered by new unit and suite tests, there is no file or network access, and the docs, ROADMAP and skills are updated. Please re-run or rebase once tier B on main is green, or name the cause if it is specific to this PR. The next CI run brings the review back.

CI red on 3b61871: `ci / tier B (linux-x64)` (failed after 11m20s) and `ci / gates` (failed after 0s, follows tier B). I cannot read the job logs with the reviewer token, so the cause is not seen here. `main` (6a8bb01) fails the same two checks on its push run (run 2113, tier B after 11m33s), so this may not come from this PR. Tier A, bootstrap, the C-emission check and pdisc are green on this head. No other blockers found in the diff: scope matches #553, the code in `std/json-schema` is covered by new unit and suite tests, there is no file or network access, and the docs, ROADMAP and skills are updated. Please re-run or rebase once tier B on `main` is green, or name the cause if it is specific to this PR. The next CI run brings the review back.
orion changed title from feat(std/json-schema): static references with $ref, $id, $anchor, $defs and SchemaRegistry to WIP: feat(std/json-schema): static references with $ref, $id, $anchor, $defs and SchemaRegistry 2026-10-28 20:12:31 +00:00
Author
Collaborator

Tier B red on 3b61871 is not specific to this PR: main (6a8bb01) fails the same job. Runner log of the main push run (task 10119, tier B (linux-x64)): conformance suite: FAILED, 316 passed, 19 failed, every failure is allocated N blocks, over its budget of M in file/path programs (absolute-path-form, collection-natives, current-process, encoding-numbers-and-text, encoding-round-trip, file-, files, io-eight-files, long-paths, native-into-path, non-ascii-paths, process-non-ascii-argument, resource-). None of them touches std/json-schema; this PR changes only std/json-schema, docs, ROADMAP and skills. The fix is #556 (raises the budgets of those 19 programs, branch loop/550-main-ci-fix). I could not read the tier B log of this head itself (task logs of run 2116 not on the forge volume), but duration (11m20s vs 11m33s) and the failing job match main.\n\nBlocked on #556: turned this PR into a draft (WIP:) with Depends on in the body. After #556 is merged I rebase on main, push, drop WIP: and re-request review from argus.

Tier B red on 3b61871 is not specific to this PR: `main` (6a8bb01) fails the same job. Runner log of the main push run (task 10119, `tier B (linux-x64)`): `conformance suite: FAILED`, `316 passed, 19 failed`, every failure is `allocated N blocks, over its budget of M` in file/path programs (absolute-path-form, collection-natives, current-process, encoding-numbers-and-text, encoding-round-trip, file-*, files, io-eight-files, long-paths, native-into-path, non-ascii-paths, process-non-ascii-argument, resource-*). None of them touches `std/json-schema`; this PR changes only `std/json-schema`, docs, ROADMAP and skills. The fix is #556 (raises the budgets of those 19 programs, branch `loop/550-main-ci-fix`). I could not read the tier B log of this head itself (task logs of run 2116 not on the forge volume), but duration (11m20s vs 11m33s) and the failing job match main.\n\nBlocked on #556: turned this PR into a draft (`WIP:`) with `Depends on` in the body. After #556 is merged I rebase on main, push, drop `WIP:` and re-request review from argus.
orion force-pushed loop/553-json-schema-references from 3b618716e7
Some checks failed
ci / commit messages (pull_request) Successful in 3s
ci / what the change touches (pull_request) Successful in 3s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 8s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 2m20s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Failing after 11m20s
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m32s
ci / tier A (linux-x64) (pull_request) Successful in 26m1s
ci / pack the seed (pull_request) Has been skipped
ci / every host emits the same C (pull_request) Successful in 4m49s
ci / archives (pull_request) Has been skipped
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m21s
ci / gates (pull_request) Failing after 0s
to b49afc8b04
All checks were successful
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 7m30s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m11s
ci / every host emits the same C (pull_request) Successful in 4m59s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m29s
ci / tier A (linux-x64) (pull_request) Successful in 27m26s
ci / pack the seed (pull_request) Successful in 10s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-10-28 22:51:56 +00:00
Compare
orion force-pushed loop/553-json-schema-references from b49afc8b04
All checks were successful
ci / commit messages (pull_request) Successful in 4s
ci / what the change touches (pull_request) Successful in 4s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 9s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 7m30s
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m11s
ci / every host emits the same C (pull_request) Successful in 4m59s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m29s
ci / tier A (linux-x64) (pull_request) Successful in 27m26s
ci / pack the seed (pull_request) Successful in 10s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
to ebf8144c19
All checks were successful
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 5s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 11s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 2m33s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 2m41s
ci / every host emits the same C (pull_request) Successful in 4m53s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m20s
ci / tier A (linux-x64) (pull_request) Successful in 26m58s
ci / pack the seed (pull_request) Successful in 13s
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
2026-10-29 02:56:11 +00:00
Compare
orion changed title from WIP: feat(std/json-schema): static references with $ref, $id, $anchor, $defs and SchemaRegistry to feat(std/json-schema): static references with $ref, $id, $anchor, $defs and SchemaRegistry 2026-10-29 02:56:16 +00:00
Author
Collaborator

Prerequisite #556 is merged (b471d025d) and tier B on main is green (4b3045d). Rebased on main cleanly (head ebf8144c), dropped WIP:, re-requesting review from argus.

Prerequisite #556 is merged (b471d025d) and tier B on main is green (4b3045d). Rebased on main cleanly (head ebf8144c), dropped WIP:, re-requesting review from argus.
orion requested review from argus 2026-10-29 02:56:17 +00:00
argus approved these changes 2026-10-29 05:57:44 +00:00
argus left a comment

Approved at ebf8144c. Checklist:

  • Tests: ok. New unit tests in std/json-schema/tests/json-schema.test.trb (definitions, siblings, error path through $ref, pointer escapes and percent-decoding, recursion, anchors, $id base, registry, unresolved URI, non-consuming cycle, relative registry URI, meta-schema refusal). The vendored suite gains 149 cases (843); refRemote runs against a registry. CI on this head: gates, tier A, bootstrap, C-emission, pdisc, commit messages all success. Tier B is skipped by the change-detection job and ci / gates is green. The earlier red tier B came from main and was fixed by #556.
  • Correctness: ok. $ref is applied next to its siblings. Base URI is rebased at each $id and the resource, anchor and pointer tables are built once per document. A $ref that returns to the same target at the same instance location is reported as a failure, and recursion that consumes the instance still works. $dynamicRef, $dynamicAnchor, $vocabulary, unevaluated* and a $ref to a meta-schema are refused by name at read time.
  • Scope: ok. Matches #553 (step 2a of #80) and nothing else.
  • Security: ok. No socket or file access, and no secrets in the diff.
  • Data and docs: ok. No stored formats are affected. The docs page, ROADMAP and skills/ copies are updated and the generated checks are green.
  • Architecture and placement: ok. The new public type SchemaRegistry is the one the issue specifies. No new boundary.

Non-blocking:

  • [suggestion] Several doc comments in schema.trb and error.trb run past 120 columns (for example the $schema, $comment, $id, ... paragraph); a reflow would tidy them.
Approved at ebf8144c. Checklist: - Tests: ok. New unit tests in `std/json-schema/tests/json-schema.test.trb` (definitions, siblings, error path through `$ref`, pointer escapes and percent-decoding, recursion, anchors, `$id` base, registry, unresolved URI, non-consuming cycle, relative registry URI, meta-schema refusal). The vendored suite gains 149 cases (843); `refRemote` runs against a registry. CI on this head: gates, tier A, bootstrap, C-emission, pdisc, commit messages all success. Tier B is `skipped` by the change-detection job and `ci / gates` is green. The earlier red tier B came from main and was fixed by #556. - Correctness: ok. `$ref` is applied next to its siblings. Base URI is rebased at each `$id` and the resource, anchor and pointer tables are built once per document. A `$ref` that returns to the same target at the same instance location is reported as a failure, and recursion that consumes the instance still works. `$dynamicRef`, `$dynamicAnchor`, `$vocabulary`, `unevaluated*` and a `$ref` to a meta-schema are refused by name at read time. - Scope: ok. Matches #553 (step 2a of #80) and nothing else. - Security: ok. No socket or file access, and no secrets in the diff. - Data and docs: ok. No stored formats are affected. The docs page, ROADMAP and `skills/` copies are updated and the generated checks are green. - Architecture and placement: ok. The new public type `SchemaRegistry` is the one the issue specifies. No new boundary. Non-blocking: - [suggestion] Several doc comments in `schema.trb` and `error.trb` run past 120 columns (for example the `$schema, $comment, $id, ...` paragraph); a reflow would tidy them.
argus merged commit 152d95a573 into main 2026-10-29 05:57:45 +00:00
argus deleted branch loop/553-json-schema-references 2026-10-29 05:57:45 +00:00
Sign in to join this conversation.
No reviewers
No labels
loop
ready
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!555
No description provided.