|
| 1 | +# SPDX-License-Identifier: PMPL-1.0-or-later |
| 2 | +# HYP-S005 — CRG Overclaim Detector |
| 3 | +# Flags repos self-declaring a CRG grade that lacks the evidence artefacts |
| 4 | +# required by CRG v2.0 (STRICT). Sibling rule to HYP-S001 (demotion detector): |
| 5 | +# HYP-S001 catches backwards moves; HYP-S005 catches forwards-overshoots. |
| 6 | +# |
| 7 | +# Evidence thresholds are derived from the boj-server 2026-04-18 audit, |
| 8 | +# which became the first worked example of a v2.0 grade read. See: |
| 9 | +# boj-server/docs/governance/CRG-AUDIT-2026-04-18.adoc |
| 10 | +# rsr-template-repo/docs/governance/CRG-AUDIT-TEMPLATE.adoc |
| 11 | + |
| 12 | +@rule(version="1.0"): |
| 13 | +id: HYP-S005 |
| 14 | +name: "CRG overclaim detector" |
| 15 | +description: "Alert when a self-declared CRG grade in STATE.a2ml is not backed by the v2.0 evidence artefacts required for that grade" |
| 16 | +severity: high |
| 17 | +category: StandardsCompliance |
| 18 | +auto_fixable: false |
| 19 | +source: standards/hypatia-rules |
| 20 | + |
| 21 | +@scanner(type="file-tree"): |
| 22 | +# Ingest the declared grade from every repo with machine-readable state. |
| 23 | +find: |
| 24 | + - glob: "**/.machine_readable/STATE.a2ml" |
| 25 | + - glob: "**/.machine_readable/6a2/STATE.a2ml" |
| 26 | + - glob: "**/.machine_readable/**/STATE.scm" |
| 27 | +@end |
| 28 | + |
| 29 | +@logic(engine="built-in"): |
| 30 | +# Parse the declared grade, then check evidence thresholds per grade. |
| 31 | +# A repo is *overclaimed* if its declared grade exceeds what the evidence |
| 32 | +# supports under v2.0. |
| 33 | +steps: |
| 34 | + - parse_state: "STATE.a2ml" |
| 35 | + extract: |
| 36 | + - key: "crg-grade" |
| 37 | + as: declared |
| 38 | + - key: "crg-grade-achieved" |
| 39 | + as: declared_date |
| 40 | + - classify_repo: "by declared grade" |
| 41 | + - run_evidence_checks: "per grade threshold below" |
| 42 | + - emit_if_gap |
| 43 | +@end |
| 44 | + |
| 45 | +@evidence_thresholds: |
| 46 | +# What each grade REQUIRES, as file-tree signals the scanner can verify. |
| 47 | +# If the declared grade is >= the row and any `requires` item is missing, |
| 48 | +# the repo is overclaimed and a finding is emitted. |
| 49 | + |
| 50 | +D: |
| 51 | + requires: |
| 52 | + # RSR D-floor (mandatory for D and above) |
| 53 | + - file: ".machine_readable/6a2/STATE.a2ml" |
| 54 | + or_file: ".machine_readable/STATE.a2ml" |
| 55 | + reason: "RSR R-040 (A2ML metadata)" |
| 56 | + - file: "README.adoc" |
| 57 | + or_file: "README.md" |
| 58 | + reason: "RSR R-001 (orientation)" |
| 59 | + - file: "LICENSE" |
| 60 | + reason: "RSR R-004" |
| 61 | + - file: "Justfile" |
| 62 | + or_file: "justfile" |
| 63 | + reason: "RSR R-020 (no Makefiles)" |
| 64 | + - path: "tests/" |
| 65 | + or_path: "test/" |
| 66 | + or_path: "spec/" |
| 67 | + reason: "v2.0 D needs a test matrix" |
| 68 | + - path: ".github/workflows/" |
| 69 | + reason: "CI evidence of D" |
| 70 | + evidence_of: |
| 71 | + - "test matrix documented in STATE.a2ml ([test-matrix] or total-tests)" |
| 72 | + - "scope documented in STATE.a2ml, ROADMAP.adoc or TOPOLOGY.md" |
| 73 | + |
| 74 | +C: |
| 75 | + requires_all_of: "D" |
| 76 | + requires: |
| 77 | + # v2.0 C adds: dogfooding, CI green, deep per-file + per-directory annotation |
| 78 | + - path: "docs/architecture/" |
| 79 | + reason: "C requires per-directory orientation — architecture subtree" |
| 80 | + - file: "docs/READINESS.md" |
| 81 | + or_file: "docs/READINESS.adoc" |
| 82 | + reason: "C needs a per-component readiness assessment" |
| 83 | + - file: "docs/EXPLAINME.adoc" |
| 84 | + reason: "RSR C annotation floor" |
| 85 | + - state_key: "dogfooding-status" |
| 86 | + in_file: ".machine_readable/6a2/STATE.a2ml" |
| 87 | + reason: "C requires documented dogfooding evidence" |
| 88 | + evidence_of: |
| 89 | + - "CI green in last 7 days (workflow run log)" |
| 90 | + - "per-<<unit>> README coverage >= 90% (cartridges, panels, plugins, modules)" |
| 91 | + - "per-directory orientation README in every non-trivial source subtree" |
| 92 | + - "non-axiomatic believe_me / Admitted / sorry / assert_total = 0" |
| 93 | + |
| 94 | +B: |
| 95 | + requires_all_of: "C" |
| 96 | + requires: |
| 97 | + - state_key: "external-targets" |
| 98 | + in_file: ".machine_readable/6a2/STATE.a2ml" |
| 99 | + reason: "B requires 6+ diverse external targets tested" |
| 100 | + - state_key: "issues-fed-back" |
| 101 | + in_file: ".machine_readable/6a2/STATE.a2ml" |
| 102 | + reason: "B requires an issues-fed-back pipeline" |
| 103 | + evidence_of: |
| 104 | + - "6+ diverse external-target entries, each with identity + date + outcome" |
| 105 | + - "external-issue label in the repo's issue tracker with >=1 closed issue" |
| 106 | + - "feedback log or changelog entry attributing a change to an external target" |
| 107 | + negative_signal: |
| 108 | + - "internal-capability items (QUIC, multinode, etc.) do NOT count as external targets" |
| 109 | + |
| 110 | +A: |
| 111 | + requires_all_of: "B" |
| 112 | + requires: |
| 113 | + - state_key: "field-signal" |
| 114 | + in_file: ".machine_readable/6a2/STATE.a2ml" |
| 115 | + reason: "A requires real-world external feedback confirming value" |
| 116 | + evidence_of: |
| 117 | + - "multi-source external usage confirmation (testimonials, third-party writeups, papers citing)" |
| 118 | + - "no harm signal: no unresolved safety / correctness incidents in last 90 days" |
| 119 | +@end |
| 120 | + |
| 121 | +@action: |
| 122 | +emit_signal: compliance.finding.new |
| 123 | +message_template: >- |
| 124 | + CRG overclaim: {component} self-declares {declared} but fails {missing_requirement} |
| 125 | + (reason: {reason}). Per CRG v2.0 "honest D > dishonest B" — demote or provide |
| 126 | + evidence. See rsr-template-repo/docs/governance/CRG-AUDIT-TEMPLATE.adoc. |
| 127 | +recipe: none |
| 128 | +halt_on_violation: false |
| 129 | +dedupe_window_days: 7 |
| 130 | +@end |
| 131 | + |
| 132 | +@sibling_rules: |
| 133 | +- HYP-S001 crg-demotion-detector — fires on backwards moves |
| 134 | +- HYP-S003 proof-freshness — fires on stale proof artefacts (C evidence) |
| 135 | +- HYP-S004 rsr-self-compliance — RSR D-floor verifier |
| 136 | +@end |
| 137 | + |
| 138 | +@end |
0 commit comments