Skip to content

spec: referential-integrity gate for contracts/ + schemas/ (P2.11) - #1371

Merged
mdheller merged 2 commits into
mainfrom
feat/schema-ref-gate-prophet-platform
Aug 4, 2026
Merged

spec: referential-integrity gate for contracts/ + schemas/ (P2.11)#1371
mdheller merged 2 commits into
mainfrom
feat/schema-ref-gate-prophet-platform

Conversation

@mdheller

@mdheller mdheller commented Aug 4, 2026

Copy link
Copy Markdown
Member

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 $ref to a moved/renamed/typod target is a paper contract.

Adapted for a mixed tree (unlike sourceos-specs 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: mains Makefile currently carries duplicate .PHONY/validate: lines — a harmless merge artifact from #1346 + #1351 both appending (make unions the prereqs). Worth a dedupe follow-up; not touched here to avoid conflicting with other in-flight PRs.

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).
@mdheller
mdheller merged commit 6b48a05 into main Aug 4, 2026
84 of 85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant