diff --git a/governance/versioning.md b/governance/versioning.md index 76a2c83..219b543 100644 --- a/governance/versioning.md +++ b/governance/versioning.md @@ -7,6 +7,16 @@ already-defined outcome. Tags are immutable. Consumers pin the exact 40-characte A contract change is accepted only after every implementation claiming the affected capability passes the candidate commit. Capabilities are `syntax`, `semantics`, `layout`, and `safety`. +## Schema identity + +Every file in `schemas/` carries an `$id` ending `/schemas//.schema.json`. The +`$id` is an identity, not a fetch target: it names the contract revision a schema belongs to, so +two consumers that resolve "the case schema" through a pinned commit are resolving the same +document. The `` segment tracks the `VERSION` file's major and minor. A schema change +that alters what validates is at least a minor release and moves the segment with it; a patch +release leaves every `$id` untouched. Consumers still pin the commit SHA, which is what makes any +`$id` reproducible. + ## The consumer manifest A consumer records what it pins and what it claims in a `medui-conformance.toml` at its repository diff --git a/schemas/case.schema.json b/schemas/case.schema.json index 887f0d2..aa5bc46 100644 --- a/schemas/case.schema.json +++ b/schemas/case.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/Compliatory/MedUI/raw/main/schemas/case.schema.json", + "$id": "https://github.com/Compliatory/MedUI/schemas/0.2/case.schema.json", "title": "MedUI conformance case", "type": "object", "additionalProperties": false, diff --git a/schemas/consumer-manifest.schema.json b/schemas/consumer-manifest.schema.json index bdddb31..03668bb 100644 --- a/schemas/consumer-manifest.schema.json +++ b/schemas/consumer-manifest.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/Compliatory/MedUI/raw/main/schemas/consumer-manifest.schema.json", + "$id": "https://github.com/Compliatory/MedUI/schemas/0.2/consumer-manifest.schema.json", "title": "MedUI consumer manifest", "description": "The parsed structure of a consumer's medui-conformance.toml. The file on disk is TOML; this describes what a harness sees after parsing it.", "type": "object", diff --git a/schemas/diagnostic.schema.json b/schemas/diagnostic.schema.json index f0725d6..1d11d96 100644 --- a/schemas/diagnostic.schema.json +++ b/schemas/diagnostic.schema.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://github.com/Compliatory/MedUI/raw/main/schemas/diagnostic.schema.json", + "$id": "https://github.com/Compliatory/MedUI/schemas/0.2/diagnostic.schema.json", "title": "MedUI diagnostic envelope", "type": "object", "additionalProperties": false, diff --git a/tools/validate.py b/tools/validate.py index 64e38df..566a800 100644 --- a/tools/validate.py +++ b/tools/validate.py @@ -66,6 +66,15 @@ def main() -> None: if decision_numbers != list(range(1, len(decision_numbers) + 1)): fail(f"decision identifiers are not contiguous from 001: {decision_numbers}") + # Every schema's $id names the contract minor it belongs to (governance/versioning.md). + minor = ".".join(version.split(".")[:2]) + for schema_path in sorted((ROOT / "schemas").glob("*.schema.json")): + schema_id = load_json(schema_path).get("$id") + if not isinstance(schema_id, str): + fail(f"{schema_path.name} has no string $id") + if not schema_id.endswith(f"/schemas/{minor}/{schema_path.name}"): + fail(f"{schema_path.name} $id does not carry the {minor} contract minor: {schema_id}") + registry_text = (ROOT / "spec/diagnostics.md").read_text(encoding="utf-8") code_phase = {code: phase for code, phase in REGISTRY_ROW.findall(registry_text)} code_list = re.findall(r"^\|\s*`(MEDUI-E[0-9]{3})`\s*\|", registry_text, flags=re.MULTILINE)