Skip to content

Unify PA rule IDs into one canonical table - #232

Open
hyperpolymath wants to merge 3 commits into
mainfrom
claude/vigilant-turing-94eajv
Open

hyperpolymath wants to merge 3 commits into
mainfrom
claude/vigilant-turing-94eajv

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

Wave 0 item from the standards ultraplan (docs/ULTRAPLAN-KAUTZ-LADDER-2026-10-19.adoc): one PA-number table plus a drift test.

Before this change the repo had three PA-number schemes that disagreed:

  • SARIF / storage table (report::sarif::rule_id). This is the published scheme, with UnsafeCode = PA004.
  • Private aggregate::category_code. It had UnsafeCode → PA001 and PanicPath → PA006, and mapped only 14 of 30 categories.
  • Doc and fixture comments: "UnsafeCode (PA001)" and "UnboundedAllocation (PA015)".

The effect: an aggregate coverage spec sound:rule:PA004 never matched UnsafeCode findings, even though SARIF labels those findings PA004.

Changes

  • WeakPointCategory::rule_id() (a const fn) is now the only table. WeakPointCategory::ALL lists all 30 variants in ID order.
  • report::sarif::rule_id delegates to it. The storage hexads already called sarif, so they follow automatically.
  • aggregate::category_code is deleted. CoverageKind::RuleId now matches against the canonical IDs.
  • New tests:
    • An exhaustive-match ordinal check that ALL lists every variant once and in order. Adding a variant without listing it fails to compile or fails the test.
    • A uniqueness check on the IDs.
    • A golden array pinning all 30 IDs, so renumbering a public ID is a visible test edit.
    • An aggregate test that every category is covered by rule:<its own id> and agrees with SARIF.
  • Comment fixes in tests/aggregate_proof_fixture.rs, tests/fixtures/proofs/UnsafeCodeSoundness.idr and tests/unbounded_corpus.rs.

Behaviour change

Aggregate rule:PA00x coverage specs written against the old private scheme now resolve to the canonical (SARIF) IDs. Inside this repo, only the tests reference those specs.

Validation

  • cargo test --lib: 413 passed. The integration suites pass too, except as noted below.
  • cargo clippy --all-targets: no new findings in the touched files.
  • cargo fmt --check: the touched hunks are clean. The rest of the repo already has fmt drift on main (161 hunks), which this PR leaves alone.
  • Pre-existing, not from this PR: tests/readiness.rs readiness_c_diagnostics_output and readiness_d_diagnostics_runs fail identically on main ("self-diagnostics reported issues"). The unused import anyhow warning in src/scan/cargodeny.rs and the safe_path.rs dead-code warnings are also on main.

Out of scope (flag-only follow-ups, other repos)

  • A fourth historical scheme is in docs/campaigns/2026-05-26/01-triage.adoc. It is a dated record, so it is left as-is.
  • gitbot-fleet/scripts/fix-*.sh (for example fix-unbounded-loop.sh and fix-unchecked-error.sh) and the Hypatia PA001–PA020 patterns use PA numbers that should be checked against this table.

Generated by Claude Code

Three divergent PA-number schemes lived in this repo: the SARIF/storage
table, a private aggregate::category_code table (UnsafeCode->PA001,
PanicPath->PA006, 14 of 30 categories), and stale doc comments. A
`rule:PA004` coverage spec therefore never matched UnsafeCode findings
in aggregate, while SARIF published UnsafeCode as PA004.

- WeakPointCategory::rule_id() (const fn) is now the one table;
  WeakPointCategory::ALL enumerates every variant in ID order.
- report::sarif::rule_id delegates to it; aggregate's private table
  is removed and RuleId coverage uses the canonical IDs.
- Tests: exhaustive-match ordinal check that ALL lists every variant
  once and in order, uniqueness, a golden array pinning all 30 IDs,
  and an aggregate test that every category is covered by its own ID.
- Comment fixes: UnsafeCode is PA004, UnboundedAllocation is PA001b.

Behaviour change: aggregate `rule:PA00x` coverage specs written against
the old private scheme now resolve to the canonical (SARIF) IDs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PpQVLrCbURpoXtrdvy8V3B
@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You'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 31 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 883643d3-4f7a-497f-b3fd-7ef85e4df706
📥 Commits

Reviewing files that changed from the base of the PR and between 5f749f7 and ec0faee.

📒 Files selected for processing: 6
  • src/aggregate/mod.rs
  • src/report/sarif.rs
  • src/types.rs
  • tests/aggregate_proof_fixture.rs
  • tests/fixtures/proofs/UnsafeCodeSoundness.idr
  • tests/unbounded_corpus.rs
📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Corrected coverage and report mappings to use the canonical rule identifiers.
    • Corrected the UnsafeCode identifier to PA004.
    • Corrected the UnboundedAllocation identifier to PA001b.
  • Improvements

    • Added a complete, consistently ordered catalogue of weak-point categories and their rule identifiers.
  • Tests

    • Expanded validation to confirm category ordering, identifier uniqueness, and consistency with SARIF output.

The change adds an ordered public catalogue of weak-point categories and a canonical rule-ID mapping. Aggregate coverage and SARIF reporting use that mapping. Tests and fixture documentation reflect the category identifiers, including PA004 for UnsafeCode and PA001b for UnboundedAllocation.

Changes: Canonical weak-point rule IDs

Layer / File(s) Summary
Define the category catalogue and rule-ID mapping
src/types.rs
WeakPointCategory::ALL lists all 30 categories in rule-ID order. WeakPointCategory::rule_id() maps categories to identifiers, including PA001b for UnboundedAllocation. Tests check catalogue order and completeness, rule-ID uniqueness, and the published identifier sequence.
Use canonical rule IDs in coverage and reporting
src/aggregate/mod.rs, src/report/sarif.rs, tests/aggregate_proof_fixture.rs, tests/fixtures/proofs/UnsafeCodeSoundness.idr, tests/unbounded_corpus.rs
Aggregate coverage and SARIF reporting use WeakPointCategory::rule_id(). Tests check consistency between category and SARIF IDs, including PA004 for UnsafeCode. Fixture and corpus documentation now uses PA004 and PA001b respectively.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Suggested reviewers: metadatastician

Merge Risk: ⚪ Minimal · up to 5f749

This change unifies PA rule ID mappings into one canonical table used by aggregate coverage and SARIF output. Tests cover completeness and stability. No merge-blocking risk was identified.

Security architecture risk: ⚪ Minimal · up to 5f749

The published SARIF identifiers remain unchanged, and the new lookup does not add execution capability or permissions. Aggregate coverage now consistently uses those identifiers. Legacy proof annotations using the former aggregate numbering need checking when upgrading.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — Within the inspected consumers, the changed identifier semantics affect category-wide reconciliation within a supplied report. SARIF labels and stored finding labels remain stable. The new enum API is a static lookup, not an additional execution or privileged-operation path.

Trust Boundaries and Controls

  • observed — Proof authors and callers already control coverage selectors, including category names and file selectors. Canonical rule IDs change which category a rule selector denotes, but do not add authority beyond that existing selector capability. Matching remains an input to report reconciliation, not an authorization decision.

Hardening Proposals

  • proposed — Provide an explicit old-to-canonical mapping for downstream users migrating aggregate rule annotations, since unchanged annotation text can now refer to a different category.
Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: consolidating PA rule IDs into one canonical table.
Description check Passed The description directly explains the PA rule ID consolidation, implementation changes, tests, behaviour change, and validation results.
Docstring Coverage Passed Docstring coverage is 81.82% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 5 files. (1 skipped: 1 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 81.82% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 5 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
📝 Generate docstrings
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 19, 2026
@hyperpolymath
hyperpolymath marked this pull request as ready for review October 20, 2026 00:13
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-20T00:13:06.743571Z 5f749f7 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

✅ Coding Agent task started: View task and status

The task will inspect the CI failures, validate its fix, and commit the fix to this branch automatically.

Note: Fixing CI failures is a beta feature and may encounter errors. Expect some limitations and changes as we gather feedback and continue to improve it.

⏭️ Checks skipped: 24 · already failing on `main` (not caused by this PR)
  • GitHub Actions: Hypatia Security Scan / 0_hypatia _ Hypatia Neurosymbolic Analysis.txt
  • GitHub Actions: Rust CI / 4_rust-ci _ Detect Cargo.toml.txt
  • GitHub Actions: Secret Scanner / 0_scan _ gitleaks.txt
  • GitHub Actions: Secret Scanner / 1_scan _ shell-secrets.txt
  • GitHub Actions: Secret Scanner / 2_scan _ rust-secrets.txt
  • GitHub Actions: Governance / 8_governance _ Guix packaging policy (Nix retired).txt
  • GitHub Actions: Governance / 10_governance _ Live Actions policy (credentialed advisory).txt
  • GitHub Check: governance / Licence consistency
  • GitHub Check: governance / Allowlist Preflight
  • GitHub Check: governance / Workflow security linter
  • GitHub Check: governance / Actions lockfile verify
  • GitHub Check: governance / Security policy checks
  • GitHub Check: governance / Check Workflow Staleness
  • GitHub Check: governance / Live Actions policy (credentialed advisory)
  • GitHub Check: governance / Trusted-base reduction policy
  • GitHub Check: governance / Code quality + docs
  • GitHub Check: governance / Guix packaging policy (Nix retired)
  • GitHub Check: governance / Well-Known (RFC 9116 + RSR)
  • GitHub Check: governance / Language / package anti-pattern policy
  • GitHub Check: scan / shell-secrets
  • GitHub Check: scan / gitleaks
  • GitHub Check: hypatia / Hypatia Neurosymbolic Analysis
  • GitHub Check: rust-ci / Detect Cargo.toml
  • GitHub Check: scan / rust-secrets

@hyperpolymath
hyperpolymath enabled auto-merge (squash) October 20, 2026 00:25
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Completed: Generate docstrings for PR #232 — View commit b0df222

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Add Carrot credits or activate Agent usage billing to use Autofix

This branch has not been deployed

No deployments
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