Skip to content

Add RSR v2.0 specification + machine-readable criteria SSOT#465

Merged
hyperpolymath merged 2 commits into
mainfrom
claude/standards-repo-architecture-6j606d
Jul 3, 2026
Merged

Add RSR v2.0 specification + machine-readable criteria SSOT#465
hyperpolymath merged 2 commits into
mainfrom
claude/standards-repo-architecture-6j606d

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

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:

  1. The freeze was violated in place, not honoured. v1.0 declared its criteria "immutable" but LANGUAGE-POLICY.adoc advanced to v1.2.2 and TIERS.adoc was edited post-freeze. A prose banner is not a freeze.
  2. Spec, machine-spec, and reality diverged three ways. v1.0's machine criteria (spec.scm/compliance-criteria.scm) still require GitLab, Nix flakes, ReScript, RVC, SaltRover, and META/ECOSYSTEM/STATE.scm. The estate is GitHub, Guix-primary, AffineScript, Python/V/ReScript-banned, A2ML — every current repo fails the v1.0 machine criteria.
  3. No single oracle. Five checkers (rsr-audit.sh, rsr-check.scm, rsr-compliance-checklist.k9.ncl, COMPLIANCE_CHECKLIST.md, the rsr-certifier product) 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-merged RECORD-DIALECT-SPEC). 11 weighted categories, 74 criteria, each re-based on a measured survey of estate reality — the file set rsr-template-repo actually ships plus the rules hypatia actually enforces — not the abandoned .scm era. Every criterion carries:

    • detect — the hypatia rule id that checks it, or the literal manual (honest: no automated check yet), and
    • template_ref — where rsr-template-repo satisfies 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):

    • Capability-gated scoring — a repo is scored only against criteria its declared capabilities (rsr-profile.a2ml, per TEMPLATE-APPLICABILITY-POLICY) activate; non-applicable criteria are na and 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.
    • One normative oracle — the hypatia rsr-conformance rule family; the other five checkers are declared non-normative.
    • Hash-pinned freeze + CI guard replacing the prose "FROZEN" banner (fixes failure chore(deps): bump actions/checkout from 4 to 6 in the actions group #1 cryptographically).
    • A v1→v2 migration delta table (nix→guix, gitlab→github, .scm→.a2ml, 6a2→descriptiles, +ANCHOR/CLADE, LICENSE.txt→LICENSE, palimpsest→5-way-classified-flag-only).

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:

  1. the rsr-conformance oracle exists (this is the companion "HYP-S rule interpreter" work item — hypatia loading criteria from standards rather than hand-porting);
  2. the dogfood gate is green in real CI (no || echo SKIP) with rsr-template-repo at Gold;
  3. a corpus run publishes the per-repo tier distribution + residual non-conforming set to verisim-data;
  4. traceability checks pass (no dangling template_ref);
  5. owner ratification → bump [meta].status to stable and freeze.

Scope / follow-ups (not in this PR)

  • The generator (SSOT → prose checklist / checker config / badges) — mechanical.
  • The rsr-conformance hypatia oracle + freeze guard — the next work item.
  • RSR-V1-TO-V2-DELTA.adoc (full per-criterion mapping) — generated.
  • Freezing v1.0 into 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 existing spec/ convention). Licence-classification criterion 7.1.1 is explicitly detection-only / :review, never auto-edited. .machine_readable/REGISTRY.a2ml regenerated with scripts/build-registry.sh (the sanctioned generator — not hand-edited); --check passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_0112RkdER2wtwHdNmbEhThUz


Generated by Claude Code

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 hyperpolymath marked this pull request as ready for review July 3, 2026 02:37
@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

@hyperpolymath hyperpolymath enabled auto-merge (squash) July 3, 2026 02:37
@hyperpolymath hyperpolymath disabled auto-merge July 3, 2026 02:38
@hyperpolymath hyperpolymath merged commit 0d76543 into main Jul 3, 2026
20 checks passed
@hyperpolymath hyperpolymath deleted the claude/standards-repo-architecture-6j606d branch July 3, 2026 02:38
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>
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.

2 participants