ci(registry): add publication-completeness linter for policy entries#2361
Merged
ci(registry): add publication-completeness linter for policy entries#2361
Conversation
…2319) The PolicyEntry schema was relaxed in 3.0 from 6→3 required fields so buyers can author bespoke inline policies ergonomically. Registry-published entries still need full metadata so downstream consumers can aggregate across publishers — but schema validation can't tell the two contexts apart. Add scripts/check-registry-completeness.cjs + an npm script + a CI step in the JSON Schema Validation workflow. The linter enforces, for every file in static/registry/policies/*.json: source="registry", semver version, non-empty name, category ∈ {regulation, standard}, ISO alpha-2 jurisdictions (empty array valid), non-empty governance_domains, http(s) source_url, source_name, ISO effective_date, ≥1 exemplar pass + ≥1 fail with non-empty scenario and explanation, and policy_id matching the filename. Backfill all 14 existing entries with source: "registry". Two also got missing effective_date/source_url. Add static/registry/README.md documenting the publication bar and the flat snake_case policy_id decision. Closes #2319. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 tasks
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.
Summary
scripts/check-registry-completeness.cjs+ a CI step in the JSON Schema Validation workflow that enforces the publication bar for every file instatic/registry/policies/*.json."source": "registry". Two also got missingeffective_date/source_url.static/registry/README.mddocumenting the bar, the flat snake_casepolicy_iddecision, and which directories the linter currently covers.Why
In 3.0 GA we relaxed
PolicyEntryfrom 6→3 required fields so buyers can author bespoke inline policies ergonomically (insidesync-plans,content-standards,custom_policies). Registry-published entries still need full metadata so downstream consumers can aggregate across publishers — but schema validation can't tell the two contexts apart (both use the same type). CI is the enforcement point.What the linter enforces
For every
static/registry/policies/*.json:policy_idsource"registry"versionnamecategory"regulation"or"standard"jurisdictionsgovernance_domainssource_urlsource_nameeffective_dateYYYY-MM-DDexemplars.passscenario+explanationexemplars.failscenario+explanationInline bespoke
PolicyEntryvalues insync-plans,content-standards, andcustom_policiesare unaffected — the schema stays relaxed.Reviewed by
code-reviewerandad-tech-protocol-expertsubagents. Protocol reviewer drove thegovernance_domainsrequirement (without it, consumers can't route a registry policy to the right governance surface). Code reviewer drove the http(s) restriction onsource_urland ISO alpha-2 validation onjurisdictions.Test plan
npm run check:registry— 14 entries OKnpm run test:schemas && npm run test:json-schema && npm run test:composed && npm run test:extension-schemas— all greensource, bad semver, bad ISO date, non-http URL, non-alpha-2 jurisdictions, missing/emptygovernance_domains, empty exemplarscenario, whitespace-onlyexplanation, wrong category enum, filename/id mismatch, malformed JSON) — all caught with specific errorsCloses #2319.
🤖 Generated with Claude Code