Add RSR v2.0 specification + machine-readable criteria SSOT#465
Merged
Conversation
RSR v1.0 can no longer describe the estate it governs: its "frozen" spec was edited in place, its machine criteria (spec.scm) still require GitLab/Nix/ ReScript/.scm/RVC/SaltRover (every current repo fails them), and five divergent checkers each claimed to check RSR with none normative or in CI. This adds RSR v2.0 as a DRAFT era-change that fixes all three: - spec/rsr-criteria-v2.a2ml — the single source of truth, authored in the A2ML record dialect (dogfoods the just-merged RECORD-DIALECT-SPEC). 11 weighted categories, 74 criteria, each re-based on MEASURED estate reality (the file set rsr-template-repo ships + the rules hypatia enforces), each carrying a `detect` (hypatia rule id or "manual") and `template_ref` for machine-checkable spec->checker->template traceability. - spec/RSR-SPEC-v2.adoc — the normative spec (RFC-2119): capability-gated scoring (a leaf repo is scored only against criteria its declared capabilities activate, per TEMPLATE-APPLICABILITY-POLICY), the four tiers, ONE normative oracle (hypatia `rsr-conformance`) with the other five checkers declared non-normative, a hash-pinned freeze + CI guard replacing the prose "FROZEN" banner, and a v1->v2 migration delta. Status is DRAFT and the spec states plainly it MUST NOT be cited as ratified until the oracle exists, the dogfood gate is green in real CI, and a corpus run is published (ratification bar in the spec). Registry regenerated with build-registry.sh (--check passes); no licence content touched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0112RkdER2wtwHdNmbEhThUz
|
hyperpolymath
added a commit
to hyperpolymath/hypatia
that referenced
this pull request
Jul 3, 2026
#581) ## What & why The seven `standards/hypatia-rules/*.a2ml` rule definitions (HYP-S001..S007) declare each rule's identity, severity, scanner globs, router strategy caps, emitted signal, and recipe. But they were **specified in standards and ghost in hypatia** — the README says "Rules live as `.a2ml` files… consumed by Hypatia's rule loader," yet **no loader existed**. So the audit's central ask — *"standards is the single source of truth; hypatia rules are compiled from it"* — was unwired. This is **HYP-S increment 1**: the loader that closes that gap. ## What it does `Hypatia.Rules.RuleLoader` + `RuleDef` parse the A2ML markup block dialect (`@block(attrs): key: value / - list @end`) into structured rule definitions, extracting the **declarative, safe-to-source** parts: - identity / severity / category / auto_fixable / source - scanner globs (`@scanner` → `find:`/`glob:`) - routing (`@router` → `default_strategy`, `recipe`, and **`strategy_caps`**) — including the safety-critical **Manual-Only licence cap** (any SPDX/licence-overlapping finding demoted to `:review`); `licence_caps/1` surfaces these for audit - action (`@action` → `emit_signal`, `recipe`) The `@logic` step-DSL is **preserved verbatim** (`logic_raw`) but deliberately **not interpreted** in this increment — the loader does not invent detection behaviour it cannot yet verify. Executing `@logic` (by delegating to existing hypatia capabilities or a rule's own `command:`, à la `scorecard_ingestor`) is a follow-up. ## Verification (toolchain installed in-session) Built and tested against **Elixir 1.17.3 / OTP 25** (hypatia CI targets 1.17): - `mix compile` clean — **zero new warnings** from this module (hypatia CI does not use `--warnings-as-errors`; every existing warning is in pre-existing files) - **10 new unit tests, 0 failures**, using the three real rule files (`registry-staleness`, `rsr-self-compliance`, `profile-drift-detector`) as **hermetic fixtures** under `test/fixtures/hypatia_rules/` (`test/` is scanner-exempt per the repo's scanner-hygiene note) - **No regression**: rules domain 160 → 170 tests, the *same* 3 pre-existing failures (2 vlang, 1 chapel), none in `rule_loader` - Tests assert the licence cap is parsed and demotes to `:review`, and that `licence_caps/1` surfaces exactly the licence-overlapping caps ## Scope / follow-ups - Execute `@logic` per rule (delegate to existing capabilities / `command:`, not a general DSL interpreter). - Consume the RSR v2.0 criteria SSOT (`hyperpolymath/standards#465`, merged) — same loader family, record-dialect variant. - Wire loaded `strategy_caps` into `TriangleRouter`/`FleetDispatcher` so the file-sourced licence cap governs live routing. ## Guardrails New `lib/*.ex` carries `MPL-2.0` SPDX matching the existing `lib/` convention; fixtures are verbatim copies of standards rule files (no licence content authored or altered). The licence cap this loader extracts is the estate's Manual-Only licence guardrail — this PR makes it *machine-auditable*, never auto-editing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0112RkdER2wtwHdNmbEhThUz --- _Generated by [Claude Code](https://claude.ai/code/session_0112RkdER2wtwHdNmbEhThUz)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
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.



What & why
RSR v1.0 (frozen 2025-12-27) can no longer describe the estate it governs. This PR adds RSR v2.0 as a DRAFT era-change that fixes the three structural failures the recent audit surfaced:
LANGUAGE-POLICY.adocadvanced to v1.2.2 andTIERS.adocwas edited post-freeze. A prose banner is not a freeze.spec.scm/compliance-criteria.scm) still require GitLab, Nix flakes, ReScript, RVC, SaltRover, andMETA/ECOSYSTEM/STATE.scm. The estate is GitHub, Guix-primary, AffineScript, Python/V/ReScript-banned, A2ML — every current repo fails the v1.0 machine criteria.rsr-audit.sh,rsr-check.scm,rsr-compliance-checklist.k9.ncl,COMPLIANCE_CHECKLIST.md, thersr-certifierproduct) each claimed to check RSR, disagreed, and none ran in CI.Contents
rhodium-standard-repositories/spec/rsr-criteria-v2.a2ml— the single source of truth, authored in the A2ML record dialect (dogfoods the just-mergedRECORD-DIALECT-SPEC). 11 weighted categories, 74 criteria, each re-based on a measured survey of estate reality — the file setrsr-template-repoactually ships plus the ruleshypatiaactually enforces — not the abandoned.scmera. Every criterion carries:detect— the hypatia rule id that checks it, or the literalmanual(honest: no automated check yet), andtemplate_ref— wherersr-template-reposatisfies it,making spec → checker → template traceability machine-checkable (the matrix v1.0 never had).
rhodium-standard-repositories/spec/RSR-SPEC-v2.adoc— the normative spec (RFC-2119):rsr-profile.a2ml, perTEMPLATE-APPLICABILITY-POLICY) activate; non-applicable criteria arenaand excluded from the denominator. Fixes v1.0's flat "every repo needs all 11 categories", which marked a small Rust CLI non-compliant for lacking a mobile shell.rsr-conformancerule family; the other five checkers are declared non-normative.Key design decision
RSR v2.0 makes one of the three currently-disagreeing sources (frozen spec / template / hypatia rules) canonical — the machine-readable SSOT — and requires everything else (prose checklist, checker rule table, badge thresholds) to be generated from it. "Solutions at source" applied to the standard itself; hand-editing a generated artefact becomes a defect.
Status: Draft (deliberately)
Per the no-overclaim doctrine, the spec states it MUST NOT be cited as ratified until the ratification bar in §10 is met:
rsr-conformanceoracle exists (this is the companion "HYP-S rule interpreter" work item — hypatia loading criteria from standards rather than hand-porting);|| echo SKIP) withrsr-template-repoat Gold;template_ref);[meta].statustostableand freeze.Scope / follow-ups (not in this PR)
rsr-conformancehypatia oracle + freeze guard — the next work item.RSR-V1-TO-V2-DELTA.adoc(full per-criterion mapping) — generated.spec/archive/— deferred until v2.0 is ratified; v1.0 files are left in place (no deletion by access-recency).Guardrails respected
No licence content touched; no SPDX sweeps; new files carry correct SPDX from birth (
.adoc→ CC-BY-SA-4.0,.a2ml→ MPL-2.0, matching the existingspec/convention). Licence-classification criterion7.1.1is explicitly detection-only /:review, never auto-edited..machine_readable/REGISTRY.a2mlregenerated withscripts/build-registry.sh(the sanctioned generator — not hand-edited);--checkpasses.🤖 Generated with Claude Code
https://claude.ai/code/session_0112RkdER2wtwHdNmbEhThUz
Generated by Claude Code