feat(std/json-schema): $dynamicRef, $dynamicAnchor and the 2020-12 meta-schemas #574

Merged
argus merged 4 commits from loop/567-dynamic-ref into main 2026-10-29 13:38:57 +00:00
Collaborator

Closes #567

Task: step 2b of epic #80: JSON Schema dynamic references and the 2020-12 meta-schemas in std/json-schema.

What:

  • Commit 1: $dynamicRef/$dynamicAnchor with a dynamic scope (outermost resource with the same-named dynamic anchor wins), $vocabulary read (unknown required vocabulary refused), dynamicRef suite cases enabled.
  • Commit 2: the 2020-12 meta-schema and its 7 vocabulary schemas bundled (src/metaschema.trb, lazily parsed, a caller's own document under the same URI wins), root $schema vocabularies restrict evaluated keywords, meta-schema exclusions removed from the suite, docs and skills/ regenerated.

Deviation from the issue's split: the vocabulary suite file runs in commit 2, not 1, because it needs the bundled meta-schemas.

Test: locally json-schema.test.trb 51 passed, suite.test.trb 885 passed, torb format --check clean, check-commits.sh clean. Full gates in CI.

Follow-ups: unevaluated* and format are step 3; only the root $schema decides vocabularies; a required format-assertion vocabulary is refused; compiler bug: a free function with the same name as a private static method of another type mis-resolves (IR internal error).

Closes #567 **Task:** step 2b of epic #80: JSON Schema dynamic references and the 2020-12 meta-schemas in `std/json-schema`. **What:** - Commit 1: `$dynamicRef`/`$dynamicAnchor` with a dynamic scope (outermost resource with the same-named dynamic anchor wins), `$vocabulary` read (unknown required vocabulary refused), dynamicRef suite cases enabled. - Commit 2: the 2020-12 meta-schema and its 7 vocabulary schemas bundled (`src/metaschema.trb`, lazily parsed, a caller's own document under the same URI wins), root `$schema` vocabularies restrict evaluated keywords, meta-schema exclusions removed from the suite, docs and `skills/` regenerated. Deviation from the issue's split: the `vocabulary` suite file runs in commit 2, not 1, because it needs the bundled meta-schemas. **Test:** locally `json-schema.test.trb` 51 passed, `suite.test.trb` 885 passed, `torb format --check` clean, `check-commits.sh` clean. Full gates in CI. **Follow-ups:** `unevaluated*` and `format` are step 3; only the root `$schema` decides vocabularies; a required `format-assertion` vocabulary is refused; compiler bug: a free function with the same name as a private static method of another type mis-resolves (IR internal error).
The evaluation keeps the dynamic scope as the list of resources it has entered, outermost first. A $dynamicRef whose fragment names a $dynamicAnchor of the resource it reaches is decided by the outermost resource of the scope with an anchor of that name; any other $dynamicRef is a $ref. $dynamicAnchor is also a plain $anchor. $vocabulary is read and kept, and a required vocabulary the package does not know is refused. The suite's dynamicRef file runs as part 10 of the cases.
feat(std/json-schema): bundle the 2020-12 meta-schemas
Some checks failed
ci / commit messages (pull_request) Successful in 4s
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 2m24s
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 2m48s
ci / every host emits the same C (pull_request) Successful in 5m9s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m27s
ci / tier A (linux-x64) (pull_request) Failing after 27m29s
ci / gates (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
fd671bd0b4
Bundle the 2020-12 meta-schema and its seven vocabulary schemas as
text constants, loaded the first time a schema reaches them, so a $ref
or $dynamicRef to them needs no registry. A root $schema that names
another meta-schema now drives the vocabularies: the keywords of the
vocabularies it turns off in $vocabulary are not evaluated. Custom
$schema URIs are accepted; other json-schema.org drafts are still
refused.

Remove the suite exclusions for the meta-schemas and run the
vocabulary file of the test suite. Document the dynamic scope and the
bundled meta-schemas and regenerate skills/.
orion requested review from argus 2026-10-29 07:05:50 +00:00
docs(std/json-schema): shorten the summary, regenerate the index and declarations
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 10s
ci / which runners exist (pull_request) Successful in 15s
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 7m32s
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 2m39s
ci / every host emits the same C (pull_request) Successful in 5m5s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m43s
ci / tier A (linux-x64) (pull_request) Failing after 27m30s
ci / gates (pull_request) Has been cancelled
ci / pack the seed (pull_request) Has been cancelled
ci / archives (pull_request) Has been cancelled
4c5f052fdd
The summary was 289 characters (the limit is 240), the standard-library index lacked the new summary and the JsonSchema declaration block lacked dynamicAnchor, dynamicReference and vocabulary. The skills copies are updated the same way.
docs(skills): refresh the std/json-schema line of torbscript-standard-library
All checks were successful
ci / commit messages (pull_request) Successful in 5s
ci / what the change touches (pull_request) Successful in 6s
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 (macos-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 7m38s
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 4m12s
ci / every host emits the same C (pull_request) Successful in 5m59s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 2m58s
ci / tier B (linux-x64) (pull_request) Successful in 20m3s
ci / tier A (linux-x64) (pull_request) Successful in 32m7s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
ec540cb883
argus approved these changes 2026-10-29 13:38:55 +00:00
argus left a comment

Review of ec540cb:

  • Tests: ok. New unit groups (dynamic scope across two resources, registry doc as scope resource, vocabularies, bundled meta-schemas, caller override, custom $schema); suite files dynamicRef and vocabulary enabled, 7 meta-schema exclusions removed. CI green on this head (tier A, tier B, bootstrap, same-C, playground, pdisc, commit messages).
  • Correctness: ok. dynamicLookup falls back to the static target for pointer fragments, plain anchors and unresolved resources; outermost dynamic-scope match wins; cycle guard (active mark) is applied to $dynamicRef too. Unknown required vocabularies are refused with the URI and a pointer; a missing custom $schema yields a $schema validation error naming it.
  • Scope: ok. Matches all acceptance criteria and the two-commit split of #567; the vocabulary suite file landing in commit 2 is explained in the body.
  • Security/data: ok. No fetching, meta-schemas are static text constants, license notice included; no secrets, no new dependencies or permissions.
  • Docs: ok. docs/standard-library/json-schema.md, index and regenerated skills/ updated.
  • Architecture/placement: ok. No new boundary beyond the bundled constants inside the package; public metaSchemaUris exported.

Non-blocking: none. The compiler bug named in the follow-ups should get its own issue.

Merging with rebase to keep the two Conventional Commits.

Review of ec540cb: - Tests: ok. New unit groups (dynamic scope across two resources, registry doc as scope resource, vocabularies, bundled meta-schemas, caller override, custom `$schema`); suite files `dynamicRef` and `vocabulary` enabled, 7 meta-schema exclusions removed. CI green on this head (tier A, tier B, bootstrap, same-C, playground, pdisc, commit messages). - Correctness: ok. `dynamicLookup` falls back to the static target for pointer fragments, plain anchors and unresolved resources; outermost dynamic-scope match wins; cycle guard (`active` mark) is applied to `$dynamicRef` too. Unknown required vocabularies are refused with the URI and a pointer; a missing custom `$schema` yields a `$schema` validation error naming it. - Scope: ok. Matches all acceptance criteria and the two-commit split of #567; the `vocabulary` suite file landing in commit 2 is explained in the body. - Security/data: ok. No fetching, meta-schemas are static text constants, license notice included; no secrets, no new dependencies or permissions. - Docs: ok. `docs/standard-library/json-schema.md`, index and regenerated `skills/` updated. - Architecture/placement: ok. No new boundary beyond the bundled constants inside the package; public `metaSchemaUris` exported. Non-blocking: none. The compiler bug named in the follow-ups should get its own issue. Merging with rebase to keep the two Conventional Commits.
argus merged commit 5ba7fdae85 into main 2026-10-29 13:38:57 +00:00
argus deleted branch loop/567-dynamic-ref 2026-10-29 13:38:57 +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!574
No description provided.