Repository navigation
Rule registry: generate hypatia_rules_praxis.deed (standards A5) from the code - #1070
Conversation
…axis.deed Owner ruling 2026-11-13: every existing hypatia rule id gets its A5 form by prefix (`<module>/<ID>` -> `hypatia/<module>/<ID>`). No emitted id changes. - scripts/gen-rules-praxis.sh writes the registry from lib/rules/*.ex and lib/pattern_registry.ex, with the extraction of gen-rule-catalogue.sh plus moduledoc id tables and A5-form modules (@Domain, hypatia#1064). Output is deterministic; --check fails on a stale file. - Clashes get a new superseding id: pr_automerge PA001-PA006, ERR-WF-013, WF-025 (folded into WF025), and the cicd_rules and actions_lock meanings of duplicate_workflow. The old ids stay active with :superseded-by. - SD012 and HYP-DOG-002 are kept with :status retired. - tests/rules-praxis-test.sh: staleness, idempotence, no duplicate id, no `*`, A5 grammar, supersession pointers both ways, retired tombstones, negative controls, and deed_lint.js when DEED_LINT is set. - quality.yml runs the test with deed_lint.js from a pinned standards commit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZmHbN98VWzhw9EshkN
The literal-map window stopped at `rule_id: "WF-025"`, the second key of the same map, so WF025 had no :severity. Stop only at a new map's leading rule:/id: key. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZmHbN98VWzhw9EshkN
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 20 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Build Test Images fails on this PR, but the cause is not in this PR.
I am not fixing it here, because it needs a change to the Rust or container toolchain, which is outside this PR. Generated by Claude Code |
|
Integration Status is red for the same reason as Build Test Images (see the comment above). It is the summary job of the same Generated by Claude Code |
|
Rust Dependency Audit (and the Security Status verdict that depends on it) fails here, but the cause is not in this PR. The step Generated by Claude Code |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e214f53ad6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # 1a. prefixed ids in rule:/id: literals (gen-rule-catalogue.sh's regex). | ||
| ids=$({ grep -ohE "(rule|id): \"?$idre\"?" "$f" || true; } | { grep -oE "$idre" || true; } | sort -u) |
There was a problem hiding this comment.
Include the rule IDs that scanners actually emit
For normal scans, this uppercase-only extraction omits most canonical IDs: for example, CodeSafety defines id: :js_exec_sync, the CLI normalizes it to type: "js_exec_sync" (lib/hypatia/cli.ex:1280-1285), and SARIF emits hypatia/code_safety/js_exec_sync (lib/hypatia/sarif.ex:98-104), but that ID is absent from the registry. The same applies to many WorkflowAudit :type values, so standards deviations or lookups keyed by the IDs users actually receive cannot resolve; extract the atom-based emitted types rather than limiting the registry to uppercase catalogue codes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and already stated as the first item of the PR description ("Open question first"). The registry has the coded ids, not the atom type names such as js_exec_sync. Extracting those is a heuristic over the finding normalisers in lib/hypatia/cli.ex, so I left it for the owner to decide. I am not changing the scope in this PR without that decision.
Generated by Claude Code
| # 1a. prefixed ids in rule:/id: literals (gen-rule-catalogue.sh's regex). | ||
| ids=$({ grep -ohE "(rule|id): \"?$idre\"?" "$f" || true; } | { grep -oE "$idre" || true; } | sort -u) | ||
| for id in $ids; do | ||
| grep -qE "^ *\| $id \| " "$f" && continue |
There was a problem hiding this comment.
Skip only IDs emitted by the parsed severity table
When an ID appears in any documentation table, this unconditional check skips its literal even if lines 137-143 did not parse that table. Both branch_protection.ex and supply_chain.ex have provenance rows such as | BP001 | CIS GH 1.1.x | ... |, so all BP001-BP009 and SC001-SC013 findings are dropped and the generated registry contains no entries for either opt-in scanner, even though run_opt_in/2 emits those exact rule IDs. Restrict the skip to rows actually extracted from the severity table.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in 9c6bba6. branch_protection.ex and supply_chain.ex carry a provenance table, and the skip fired for any table row. It now skips only rows of the severity table. BP001-BP009 and SC001-SC013 are registered (168 to 190 rules), and tests/rules-praxis-test.sh checks BP001 and SC001.
Generated by Claude Code
| for (i = hit - 3; i <= hit + 12; i++) { | ||
| if (i < 1 || !(i in line)) continue | ||
| if (i > hit && line[i] ~ /^ *(rule|id): "[A-Z]/ && line[i] !~ ("\"" id "\"")) break | ||
| if (match(line[i], /severity: "?:?(critical|high|medium|warn|low|info)/)) { |
There was a problem hiding this comment.
Preserve advisory-only rules as advisory
The severity matcher excludes advisory, while the class detector recognizes only a separate advisory: true field. GitState.GS007 is explicitly emitted with severity: :advisory and documented as never hard-gating a merge (lib/rules/git_state.ex:336-364), but the generated deed records it as :class gate with no severity (hypatia_rules_praxis.deed:494-501). Standards consumers can therefore treat an ambient stale-branch notice as a blocking gate; recognize severity: :advisory as an advisory class.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in 9c6bba6. GS007 emits severity: :advisory. The generator now reads that as :class advisory and leaves :severity out, because A5 has no advisory severity value. A test checks it.
Generated by Claude Code
| near() { # <file> <id> | ||
| awk -v id="$2" ' | ||
| { line[NR] = $0 } | ||
| !hit && ($0 ~ ("(rule|id): \"" id "\"") || $0 ~ ("(rule|id): \"" id "[^0-9]")) { hit = NR } |
There was a problem hiding this comment.
Do not derive canonical severity from only the first occurrence
For rule IDs emitted at multiple severities, !hit permanently selects the first literal and ignores later branches. CSA006 is consequently registered as :severity minor from maintained_id_finding/4's :info finding, even though code_review_id_finding/4 emits the same CSA006 ID at :medium (lib/rules/code_scanning_alerts.ex:633-647); consumers relying on the deed can under-prioritize or fail to gate that medium finding. Detect all occurrences and either choose the canonical maximum, omit severity for variable-severity IDs, or split the IDs.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in 9c6bba6. The generator now reads every emitting literal of an id. The registry keeps the highest severity (CSA006 is now medium), and a rule is advisory only when all its literals are. A test checks CSA006.
Generated by Claude Code
| echo ';; SPDX-License-Identifier: MPL-2.0' | ||
| echo ';;' | ||
| echo ';; GENERATED by scripts/gen-rules-praxis.sh. Do not edit by hand:' | ||
| echo ';; run the script and commit the result. `just rules-praxis-check` fails' |
There was a problem hiding this comment.
Remove the reference to the nonexistent just recipe
Every generated registry tells contributors that just rules-praxis-check performs the drift check, but neither Justfile nor its optional contractile.just import defines that recipe. Following the committed regeneration instructions therefore fails with an unknown-recipe error instead of checking the deed; either add the advertised recipe or direct contributors to the existing scripts/gen-rules-praxis.sh --check command.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in 9c6bba6. There is no just rules-praxis-check recipe, and I did not add one because the README quotes the recipe count. The generated header now names scripts/gen-rules-praxis.sh --check.
Generated by Claude Code
…verity Review findings on #1070, each checked against the code: - BP001-BP009 and SC001-SC013 were dropped: their modules carry a provenance table (`| BP001 | CIS GH 1.1.x | ... |`) and the skip fired for any table row. Skip only rows of the severity table. - GS007 emits `severity: :advisory` and was registered as `:class gate`. Read it as advisory (severity is then omitted: A5 has no such value). - CSA006 fires at info and at medium, and the first literal won. Read every emitting literal: the highest severity, and advisory only when all are. - The header named a `just rules-praxis-check` recipe that does not exist. It now names `scripts/gen-rules-praxis.sh --check`. The registry goes from 168 to 190 rules. tests/rules-praxis-test.sh gains a check for each of the first three. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZmHbN98VWzhw9EshkN
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c6bba6847
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Skip only an id already emitted from the severity table above; a | ||
| # provenance table (`| BP001 | CIS GH 1.1.x | ... |`) is not one. | ||
| grep -qE "^ *\| $id \| (critical|high|medium|low|info|warn) \| " "$f" && continue | ||
| IFS=$'\037' read -r sev adv desc <<<"$(near "$f" "$id")" |
There was a problem hiding this comment.
Record derived severities for AuditPrevention rules
When standards consumers prioritize AuditPrevention findings, every AP row lacks a severity because near recognizes only a nearby severity: literal. These findings instead derive severity from each record's action: for example, AP003 has action: "block_release", action_severity/1 emits :high, and the opt-in CLI forwards that severity, yet hypatia/audit_prevention/AP003 has no :severity. Extract the action-to-severity mapping so the registry does not under-specify these emitted findings.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in a72076d. AuditPrevention takes its severity from the record action (action_severity/1). The generator now reads the action and maps it the same way (AP003 is high, AP001 is medium). I checked all 15 records against their action lines: no mismatch. The generator refuses to run if audit_prevention.ex loses that mapping, so the copy cannot go stale quietly.
Generated by Claude Code
| ;; defaulted: class excusable-at scope-form | ||
| (rule-def | ||
| :id "hypatia/secret_scanning_alerts/SSA002" | ||
| :text "Severity summary" |
There was a problem hiding this comment.
Give distinct rules distinct texts
The generated registry reuses this exact text for hypatia/code_scanning_alerts/CSA002, despite the generator's stated A5 RL3/R08 invariant that different rows must not share rule text; the same collision occurs for the two Stale open alerts rows. Consumers using the canonical text to compare or reconcile rules can therefore conflate code-scanning and secret-scanning findings, while the new tests miss the violation because they check duplicate IDs but not duplicate texts.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in a72076d. CSA002/SSA002 ("Severity summary") and CSA003/SSA003 ("Stale open alerts") shared a text. A shared text is now qualified with its module, for example "Severity summary (code_scanning_alerts)". The test now refuses a shared text and has a planted control for it.
Generated by Claude Code
Two more review findings on #1070, both checked against the code: - AuditPrevention findings take their severity from the record action (action_severity/1), not a severity literal, so AP001-AP015 had none. near() now reads the action and maps it the same way. The generator refuses to run when audit_prevention.ex no longer has that mapping. All 15 records were checked against their action lines. - CSA002/SSA002 ("Severity summary") and CSA003/SSA003 ("Stale open alerts") shared a text, against A5 RL3/R08. A shared text is now qualified with its module. The test refuses a shared text. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZmHbN98VWzhw9EshkN
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
main gained WF030 (#1072, #1073) after this branch was cut. CI checks out the merge of the branch and main, so the staleness check failed: the deed lacked hypatia/workflow_audit/WF030. Regenerated with scripts/gen-rules-praxis.sh after merging main. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZmHbN98VWzhw9EshkN
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a36d29169e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if [ -n "$table" ]; then | ||
| while IFS='|' read -r _ id sev text _; do | ||
| id=$(echo "$id" | tr -d ' '); sev=$(echo "$sev" | tr -d ' ') | ||
| emit "hypatia/$m/$id" "$(printf '%s' "$text" | clean)" "$(sev_map "$sev")" gate active "" "" "class excusable-at scope-form" |
There was a problem hiding this comment.
Preserve advisory classification for table-derived rules
When PI005 is registered from pin_integrity.ex's severity table, this unconditional gate marks it as blocking even though the rule is explicitly documented as advisory and its emitted detail carries repair: "advisory". Because the subsequent literal pass skips every ID already found in the table, it never has an opportunity to correct the class, and standards consumers can treat the informational stale-pin notice as a gate.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in the next commit. PI005's table row reads "(stale-pin, advisory)" and its finding carries repair: "advisory", but table rows were always :class gate. A row whose text says advisory is now :class advisory. A test checks it.
Generated by Claude Code
| class=${adv:-gate} | ||
| [ -z "$adv" ] && d="${d}class " |
There was a problem hiding this comment.
Map explicit nonblocking classes to advisory
When DR001 is generated, the nearby source explicitly declares class: :disambiguation and describes its :info finding as advisory and nonblocking, but this fallback recognizes only the separate adv flag and therefore emits hypatia/disambiguation_rules/DR001 as :class gate. A standards consumer can consequently turn an intentional review question into a blocking rule; explicit nonblocking classes need to map to the deed's advisory class.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in the next commit. The DR001 moduledoc says severity: :info (advisory, not blocking). An info finding in a module whose doc says so is now :class advisory. I did not make every info rule advisory, because the code states it only here. The regenerated deed differs from before in exactly two rows, PI005 and DR001. A test checks both.
Generated by Claude Code
Two more review findings on #1070, both checked against the code: - PI005's severity-table row reads "(stale-pin, advisory)" and its finding carries repair: "advisory", but table rows were always class gate. A row whose text says advisory is now class advisory. - DR001's moduledoc says `severity: :info` (advisory, not blocking), but only an `advisory: true` literal was read. An info finding in a module whose doc says so is now class advisory. Only PI005 and DR001 change; the diff of the regenerated deed is those two rows. A test checks both. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZmHbN98VWzhw9EshkN
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc5dfb5bb5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Named atom-typed ids: refuse to register one the code no longer has. | ||
| while IFS=$'\t' read -r id f lit text; do | ||
| grep -qF -- "$lit" "$f" || { echo "gen-rules-praxis: $f no longer has '$lit' ($id)" >&2; exit 1; } | ||
| emit "$id" "$text" "" gate active "" "" "class excusable-at scope-form" |
There was a problem hiding this comment.
Carry severities into the named atom rules
When consumers prioritize the newly named atom rules, this unconditional empty severity discards metadata that is explicit at their sources: workflow_audit/duplicate_workflow emits severity: :low (lib/rules/workflow_audit.ex:670-673), while cicd_rules/duplicate_workflow is declared :medium (lib/rules/cicd_rules.ex:1283-1288). Their generated rows—and the superseding waste_duplicate_workflow row copied from the latter—therefore have no severity, so consumers cannot apply the same prioritization as Hypatia; include severity in NAMED or derive it from each verified literal.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in the next commit. The generator now reads the severity from the 4 lines after each verified literal: workflow_audit/duplicate_workflow is minor (:low), and both cicd_rules rows (duplicate_workflow and the superseding waste_duplicate_workflow) are medium. actions_lock states no severity, so those rows stay without one. The regenerated deed differs in exactly those three rows, and a test checks two of them.
Generated by Claude Code
Review finding on #1070, checked against the code: the three named duplicate_workflow rows were registered with no severity, though workflow_audit emits `severity: :low` and cicd_rules declares `:medium`. The severity is now read from the 4 lines after each verified literal (actions_lock states none, so its rows stay without one). Three rows change: the two cicd_rules rows get medium, workflow_audit gets minor. A test checks the two. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZmHbN98VWzhw9EshkN
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ca90b09d8c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # (action_severity/1 in lib/rules/audit_prevention.ex, guarded below). | ||
| if (i > hits[h] && match(line[i], /^ *action: "[a-z_]+"/)) { act = substr(line[i], RSTART, RLENGTH); sub(/^ *action: "/, "", act); sub(/"$/, "", act) } | ||
| if (i > hits[h] + 12) continue | ||
| if (match(line[i], /severity: "?:?(critical|high|medium|warn|low|info)/)) { |
There was a problem hiding this comment.
Include computed severities when selecting the maximum
When a rule assigns severity through an expression rather than a literal, this matcher silently leaves the registry severity empty. For example, SC012 emits :high when Dependabot fan-out exceeds 10 or 20 (lib/rules/supply_chain.ex:626-667), but hypatia/supply_chain/SC012 has no :severity; CSA001 and DA001 are similarly computed. This contradicts the generator's maximum-severity policy and prevents registry consumers from prioritizing high findings consistently, so the extraction needs to account for these computed branches.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in the next commit. The generator now takes the highest atom of a one-line computed severity (severity = if ..., do: :high, else: :warn, or the inline if(...) form) and of a one-line severity helper. SC012 is now high and SD008 is critical. RE001 also changes from medium to high, because four of its literals call re001_severity/1. CSA001 and DA001 take their level from the alert data at run time, so there is no static value to record and they stay without a severity (A5 makes the field optional). The regenerated deed differs in exactly those three rows, and a test checks all four.
Generated by Claude Code
Review finding on #1070, checked against the code: a severity set by an expression or a helper was left empty. The generator now takes the highest atom of a one-line `severity ... if(..., do: :a, else: :b)` (up to 10 lines back, not past the previous rule literal) and of a one-line severity helper such as re001_severity/1. Three rows change, each matching the code: SC012 high, SD008 critical, RE001 high (was medium: four of its literals call the helper). CSA001 and DA001 take their level from the alert data at run time, so they stay without a severity. A test checks all four. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0136P7ZmHbN98VWzhw9EshkN
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|
…ss) (#1082) ## What Follow-up to #1070. The A5 registry had the coded ids (`WF013`, `SD001`, `PA001`) but not the plain `type` names that most findings carry, for example `code_safety/js_exec_sync` and `workflow_audit/missing_workflow`. SARIF ruleIds, `.hypatia-baseline.json` and `.hypatia-ignore` key on those names. A deviation against them did not resolve. This PR adds them. **It is additive: 236 to 433 rules (main's current count), 197 added, none changed, none removed. No rule code changes and no emitted id changes.** `workflow_audit` is the reason the coded ids were not enough. `cli.ex` emits `Map.get(f, :type) || Map.get(f, :rule)`, so a finding that carries both (for example `WF013` and `npermissions_typo`) is emitted under the type. Both names are now registered. A finding that declares a `rule_id` of the form `hypatia/<module>/<name>` is emitted under that module (WF029 is `ci_failure_triage/always_after_cancel`), so the generator does not register that name under the source module. ## Where each name comes from The generator reads the code that `lib/hypatia/cli.ex` turns into `type`: | Module | Source | Rows | |---|---|---| | `code_safety` | `id: :name` entries with a `pattern:` in `code_safety.ex` | 95 | | `content_patterns` | `@blocked_patterns` entries with `applies_to:` in `cicd_rules.ex` | 11 | | `workflow_audit` | `type: :name` atoms and `rule: "name"` strings | 44 | | `honest_completion` | `type: :name` atoms | 9 | | `green_web` | `type: :name` atoms | 8 | | `root_hygiene` | `type: :name` atoms | 3 | | `scorecard` | the `category:` of each of the 20 checks | 20 | | `workflow_hardening` | the lowercase `rule: "invalid_actions_lock"` | 1 | | fixed names | `cicd_rules/missing_requirement`, `cicd_rules/banned_language_file`, `migration_rules/deprecated_api`, `security_errors/secret_detected`, `structured_format/SF001`, `implementation_inside_canon/HYP-S009` (plus `no_workflows_dir` and `inflated_completion`, counted above) | | Each fixed name is proved by a literal in the code that emits it, and so is the severity the code states for it (beside the literal, or in the named file). The generator refuses to run if a proof goes away. A name that already has a row is skipped. `audit_prevention` needs no new rows: its finding sets `rule: record.id` (`AP001` to `AP015`), and `cli.ex` emits that, not the lowercase `record.rule`. ## Tests `tests/rules-praxis-test.sh`: 23 passed, 0 failed, under both gawk and mawk. The checks that matter here: - **Every real baseline pair resolves.** Ground truth: every `rule_module/type` pair in this repo's `.hypatia-baseline.json` plus the 17 pairs A5 counts in the standards baseline. A planted control shows a missing pair is caught. - **Every literal `rule_module`/`type` pair** in `cli.ex` and the rule files is in the registry, with a control that names the missing pair. - **Portability.** The generator runs under every awk found, with SIGPIPE ignored as on the CI runner, and must print nothing and give the committed bytes. Two CI failures on this PR came from differences between my sandbox and the runner (a `\[` in an awk `-v` value, and `head -1` pipes); this test now catches both on a dev machine. - **Stale baseline names.** Nine names resolve to nothing, because no code under `lib/` mentions them: `inbox_automation/IA001` to `IA007` and `workflow_audit/inbox_steward_intake_missing` and `inbox_steward_missing`. The test lists them as stale and checks that claim against `lib/`. **For the owner:** those baseline entries suppress nothing in this tree and could be removed, or the rules that emitted them are on another branch. - `deed_lint.js` (standards `bfdb066`) accepts the deed. `scripts/check-readme-claims.sh` passes. ## Defaulted fields, for owner review Every defaulted row carries a `;; defaulted:` comment. Of the 197 new rows: - **`:excusable-at repo`** and **`:scope-form exact-paths`**: all 197 (A5 G3 and 4.1 defaults). - **`:class gate`**: 193. **`:class advisory`**: 4, because the code says so (`structured_format/SF001`, `known_broken_reusable_revision`, `reusable_call_to_moved_repository`, `sha_pinned_toolchain_without_input`). - **`:text` is a placeholder** (`"<id> in lib/rules/<module>.ex."`) on 62 rows, because the code gives no one-line text: `workflow_audit` 42, `green_web` 8, `honest_completion` 8, `root_hygiene` 3, `workflow_hardening` 1. The other 135 texts come from a `description:` or `reason:` in the code. - **`:severity` is omitted** on 24 rows where the code states none: the 20 `scorecard` rows (the level comes from the scan), `root_hygiene` 3 and `workflow_audit` 1. Content patterns state none, so they take the `medium` default that `cli.ex` states. Two judgement points for the owner: - **`green_web` confirmations.** `green_hosting_confirmed`, `green_badge_present`, `green_registry_confirmed` and `domain_green_check_needed` are severity `info` and read like confirmations, not violations. I left them `:class gate`, because the code does not say "advisory". The owner may want them advisory. - **`root_hygiene`.** The names are generic (`banned`, `missing`, `stale`) because that is what the code emits. ## What this does not cover - I could not run Elixir here, so I did not compare against a real scan. CI and review are the check. The extraction reads source text with patterns, so a name defined in an unusual shape could be missed. The baseline-pair and `cli.ex` pair tests are where a gap would show. - Names that are emitted only from data at run time (for example a scorecard check the repo does not list) are not knowable from the code. ## Next Whichever PR merges next and adds a type to one of these files must run `scripts/gen-rules-praxis.sh` and commit the deed, or the "Rule registry" step fails as stale. I told the Extended Hypatia session before opening this. This PR already had to be regenerated once after `main` gained WF031 and `github_state_unreadable`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0136P7ZmHbN98VWzhw9EshkN --------- Co-authored-by: Claude <[email protected]>



Open question first
The registry has the ids that
gen-rule-catalogue.shalready extracts (prefixed codes such asWF013andSD001), plus the ids the ruling names. It does not have the atomtypenames that most findings carry, for examplecode_safety/js_exec_syncandworkflow_audit/npermissions_typo. SARIF ruleIds,.hypatia-baseline.jsonand.hypatia-ignorekey on those names. For research_extensions, git_state and the alert modules the code is also the emitted type, so those ids resolve. For most other modules a deviation against an emitted id will not resolve in this registry yet. Should a second generator pass extract the emittedtypenames? That needs a heuristic over thecollect_findingsnormalisers inlib/hypatia/cli.ex, so I did not add it. (The Codex review raised the same point.)What
Owner ruling 2026-11-13: every existing hypatia rule id gets standards A5 form by prefix,
<module>/<ID>tohypatia/<module>/<ID>. No id that hypatia emits changes. No rule code changes.hypatia_rules_praxis.deed(new, generated): apraxis-deedwith(rule-domain :name "hypatia" :owner "hyperpolymath/hypatia")and 190rule-defs, in the form of A5 section 4.:beholding-chora #u5"estate/chora", as inhypatia_chora.deedand the standards praxis deeds. SPDXMPL-2.0, as inhypatia_chora.deed.scripts/gen-rules-praxis.sh(new): the generator, in the shape ofgen-rule-catalogue.sh. Its sources:rule:/id:literals inlib/rules/*.ex(the catalogue regex).| ID | severity | text |(this addspr_automergePA001-PA006 andpin_integrityPI001-PI005, which the catalogue regex misses).@domain "hypatia/<module>"plusname:maps (ci_failure_triage.ex, CI failure triage rules: layered precedence, rerun budget, WF029, replay corpus #1064).lib/pattern_registry.exPA001-PA025.# ─── <ID>: TOMBSTONEcomments.The output has no date and its rows are sorted, so a second run gives the same bytes.
--checkexits 1 on a stale file. Where an id is emitted at several severities, the registry keeps the highest. A rule is:class advisoryonly when every emitting literal is advisory (advisory: trueorseverity: :advisory).tests/rules-praxis-test.sh(new): the committed file matches a fresh run, two runs are byte-equal, no:idappears twice, no id has*, each id fits the A5 3.1 grammar in thehypatiadomain with at most 200 characters, every:supersedes/:superseded-byresolves both ways, SD012 and HYP-DOG-002 areretired, and three code-stated facts are read back (BP001/SC001 registered, GS007 advisory, CSA006 medium). Each invariant also has a planted negative control. WithDEED_LINTset, it runsdeed_lint.js..github/workflows/quality.yml, jobvalidate-docs: one step fetchesdeed_lint.jswith plain git at standardsbfdb066(no newuses:, soactions.lockis unchanged) and runs the test. It passes on this PR.Supersessions (ruling step 2)
The old id stays
:status activewith:superseded-by, because it is not changed at its source. Its text starts with "Superseded by ... (same rule ...)", so no two rows share a text (A5 RL3/R08). The kept meaning is the oldest, bygit log -Sonmain.hypatia/pr_automerge/PA001-PA006.../denylisted_pin,major_version_jump,version_disagreement,unresolved_version_delta,manifest_without_lockfile,not_automatablepattern_registry.exPA001-PA025 date from 2026-02-12;pr_automerge.exfrom 2026-09-26.hypatia/workflow_audit/ERR-WF-013hypatia/workflow_audit/missing_timeout_minutesWF013(2026-04-03) is older thanERR-WF-013(2026-05-27). The new id is therule:name the finding already carries.hypatia/workflow_audit/WF-025hypatia/workflow_audit/WF025(existing)WF025gains:supersedes; it is not a new id. Judgement call.hypatia/cicd_rules/duplicate_workflow(waste pattern)hypatia/cicd_rules/waste_duplicate_workflowhypatia/actions_lock/duplicate_workflow(parse error)hypatia/actions_lock/duplicate_workflow_entryThe module prefix alone already separates these strings. The supersessions remove the clash of the bare codes, as the ruling asks.
Retired (ruling step 3):
hypatia/structural_drift/SD012andhypatia/dogfooding/HYP-DOG-002.Defaulted fields (ruling step 4), for owner review
Each row in the deed has a
;; defaulted:comment that names its defaulted fields. In summary::excusable-at repo: all 190 rows (A5 G3 default for a canon gate rule). The code states no level.:scope-form exact-paths: all 190 rows (A5 4.1 sample). The code states no scope form.:class gate: 185 rows, every row except the 5 that the code marks advisory. Those 5 are:class advisory:hypatia/git_state/GS007,hypatia/structural_drift/SD004,hypatia/workflow_audit/WF026,WF027,WF028.:textis a placeholder ("<ID> in lib/rules/<module>.ex.") on 4 rows, because the code gives no one-line text:hypatia/root_hygiene/ERR-GIT-001,hypatia/rules/ERR-LIC-001,hypatia/workflow_audit/ERR-WF-013,hypatia/workflow_audit/WF-025. All other texts come from a code header, a doc line, adescription:, a moduledoc table or areason:. Some are cut at a wrapped line (for example WH014, AP007, AP009).:severityis taken from the severity atom next to the id (warntomedium,low/infotominor). Where the code states none, or the only severity isadvisory, the field is omitted, not defaulted (A5 makes it 0..1): the 25pattern_registryrows, AP001-AP015, CSA001, DA001, GS007, SD008 (computed at run time), the two tombstones and theduplicate_workflowrows.auto_fixableis not used: A5 has no field that it maps to.Interaction with #1064
ci_failure_triage.exis not onmainyet. I ran the generator on a local merge of #1064's head (c8d8a62) before the 9c6bba6 fix. It found 205 rules (36hypatia/ci_failure_triage/<name>ids as they are, plushypatia/workflow_audit/WF029), and the test anddeed_lint.jspassed. Expect about 227 after 9c6bba6; I have not rerun it. Whichever PR lands second must runscripts/gen-rules-praxis.shand commit the deed, or the new step fails as stale. I told the session that owns #1064.Testing
DEED_LINT=<standards bfdb066>/1-formats/deed/tools/deed_lint.js bash tests/rules-praxis-test.sh: 11 passed, 0 failed.deed_lint.js:OK hypatia_rules_praxis.deed.validate-docsjob, which runs the new step, is green. The failing jobs (Build Test Images, Integration Status, Rust Dependency Audit, Security Status) also fail onmain; this PR changes no Rust or container code.bash scripts/check-readme-claims.shstill passes. I added nojustrecipe, because the README quotes the recipe count.🤖 Generated with Claude Code
https://claude.ai/code/session_0136P7ZmHbN98VWzhw9EshkN