spec: referential-integrity gate for contracts/ + schemas/ (P2.11) - #1371
Merged
Conversation
Generalizes the sourceos-spec ref-gate (SourceOS-Linux/sourceos-spec #277) to prophet-platform: ~288 schemas across contracts/ + schemas/ with cross-file $refs, and nothing checked they resolve. A $ref to a moved/renamed target is a paper contract. Adapted for a MIXED tree (unlike sourceos-spec's single-purpose schemas/): only files declaring $schema/$id are treated as schemas; data/examples are skipped, not metaschema-checked. $refs resolve path-relative (referring dir first), then by basename, then by $id. Self-excluding; inline negative control proves teeth every run; fails closed on an empty scan. 5 tests. Wired into make validate. First run: 288 schemas valid, all 215 $refs resolve — clean today, kept clean by a gate that can fail. NOTE: main's Makefile currently has duplicate .PHONY/validate: lines (a merge artifact from #1346 + #1351 both appending). Functional (make unions prereqs) but worth a dedupe follow-up; not fixed here to avoid conflicting with in-flight PRs.
….org) Adversarial hardening: a legitimate $ref to https://json-schema.org/... was false-flagged as a dangling reference (not in the local registry). Now standard external meta-schemas resolve; any OTHER external URL still fails (vendor it or it's a typo — the gate stays strict). +1 test (json-schema.org passes, unknown external fails).
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.
P2.11 of the SOTA backlog — generalize the ref-gate cross-repo.
Brings the sourceos-spec referential-integrity gate (SourceOS-Linux/sourceos-spec#277) to prophet-platform: ~288 schemas across
contracts/+schemas/with cross-file$refs, previously unchecked. A$refto a moved/renamed/typod target is a paper contract.Adapted for a mixed tree (unlike sourceos-specs single-purpose
schemas/): only files declaring$schema/$idare treated as schemas — data/examples are skipped, not metaschema-checked.$refs resolve path-relative (referring dir first), then by basename, then by$id. Self-excluding; inline negative control proves teeth every run; fails closed on an empty scan. 5 tests; wired intomake validate.First run: 288 schemas valid, all 215
$refs resolve — clean today, kept clean by a gate that can fail.