Repository navigation
fix(xtask): reject duplicate count-policy rows and stale executable allowlist entries - #5216
Conversation
…llowlist entries Count-policy readers now fail a repeated path|pattern key with a line-numbered error instead of silently overwriting a higher max_count. check-executable-files reverse-checks executable_allowlist.txt against git ls-files --stage so a deleted or demoted 100755 row is a violation. Closes #5078 Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
Codex Review SummaryThis 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. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. Summary by CodeRabbit
WalkthroughThe xtask policy checks now reject duplicate count-allowlist rows and report executable-allowlist entries whose paths are missing or whose staged mode is not ChangesPolicy allowlist validation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to The supplied evidence identifies no issue that should block merging. Complete the planned xtask tests and required checks. Architecture SummaryArchitecture risk: 🟡 Medium · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
Reliability and maintainability
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
A rabbit checks each path and row, Comment |
There was a problem hiding this comment.
Code Review
This pull request refactors the executable file checking logic in xtask/src/main.rs to detect stale allowlist entries and extracts count allowlist parsing to detect duplicate entries. Feedback suggests optimizing executable_file_violations by storing borrowed &str modes in staged_modes instead of allocating a new String for every file, which avoids unnecessary heap allocations inside the loop.
Keep the duplicate/unique count-row and stale/live executable-row oracles, but return Result instead of expect so check-no-panic-family stays fail-closed. Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
Store mode tokens from git ls-files --stage without cloning each mode string, matching the review note on executable_file_violations. Co-authored-by: Steven Zimmerman, CPA <EffortlessSteven@users.noreply.github.com>
EffortlessSteven
left a comment
There was a problem hiding this comment.
reviewed_head_sha: b0743a85ef5a497cc61e688579c407756e6afeaa
integration_basis: origin/main 9da89e2d326710eaa2f0e6ae195817405e37f02e
claim_boundary: Reject a repeated count-policy (path, pattern) key with a line-numbered error in both readers; reverse-check executable_allowlist.txt against git ls-files --stage for missing or non-100755 paths. Closes #5078. Neighbors #5073, #5150/#5187, #5148, #4861/#4882, #5103, #4999/#5160, #5096/#5207, #5092, and .github/workflows/routed-rust.yml stay out of scope.
changed_surfaces_and_semantic_owners_inspected:
xtask/src/main.rspolicy owners:read_count_allowlist/parse_count_allowlist(workflow runtime + allow-attributes consumers),read_count_policy_allowlist/parse_count_policy_allowlist(check_count_policyfor process/network),insert_unique_count_allowlist_row,check_executable_files_impl→executable_file_violations→executable_allowlist_stale_row_violations.- Tests in
xtask/src/tests.rscall the same parse/stage helpers the production gates use. - Live allowlist files were not edited. Precommit ran the live
check-process-policy,check-network-policy, andcheck-executable-filesgates on this tree.
blocking_findings: none on source/oracle for this claim.
non_blocking_suggestions:
- Gemini asked to borrow mode tokens instead of
mode.to_string(). Landed on this head (BTreeMap<String, &str>). - Slash-normalized duplicate keys are rejected but not separately tested; unique-row tests already keep distinct path|pattern pairs.
refuted_or_stale_findings:
- CodeRabbit/Codex on
9ead014had no actionable comments. That review is stale relative tob0743a85e(test Result rewrite + borrowed modes) and is not current-head review. - Devin Review on the first head reported trial expired / skipped; that is missing provider review, not a clean pass.
proof_and_ci_observed:
- Local: four discriminators passed;
check-no-panic-familypassed after removing.expect();cargo xtask precommitpassed;cargo clippy -p xtask --all-targets -- -D warningsexited 0. - Hosted: required Rust-small routing and related jobs were in progress on an earlier published SHA; this exact head needs current hosted receipts.
oracle challenge:
- Duplicate rows use a later higher
max_count(1 then 9 / 1 then 4). The pre-repairBTreeMap::insertoverwrite would have accepted that input and widened the budget; the tests require a line-numbered duplicate error naming the first declaration. - Unique-row tests keep same-path/different-pattern and same-pattern/different-path keys, so a path-only or pattern-only uniqueness check would fail.
- Stale executable tests cover a missing path and a demoted
100644path. A live100755row still produces zero violations. A helper that always failed allowlist rows would fail the live case; a helper that only checked filesystem presence would miss the demoted mode.
proof_or_review_missing:
- Hosted exact-head required checks, artifacts, and current-head external review for
b0743a85eare not yet established. - Tests exercise the parse/stage helpers, not a temp-file
read_*wrapper or a livegit ls-files --stagesubprocess. Those wrappers remain thin.
affected_currentness_dimensions: production implementation, test stimulus, test oracle, candidate head identity. Public claim/generated/conflict/integration basis unchanged.
residual_assumptions_and_non_claims:
- Does not re-audit live process/network/executable row counts.
- Does not claim runtime mutation results.
- Does not add
check-policy-all. - Author cannot REQUEST_CHANGES on their own PR; this COMMENT is not GitHub approval.
disposition: REVIEW_INCOMPLETE until hosted required checks and a current published-head review bind to b0743a85e. Source and oracle inspection of this head found no blocker.
Summary
Reject a repeated count-policy
(path, pattern)row with a line-numbered error, and reverse-checkexecutable_allowlist.txtso a missing or non-100755path fails. This closes the two dead-entry classes #5078 found after thef04ec8d6faudit (zero live drift; recurrence prevention still missing).Closes #5078
Swarm / Source Boundary
This PR targets
EffortlessMetrics/ripr-swarm, the normal development trunk fortrusted same-repo
riprwork. Confirm the change belongs here:dependency, or repo-ops development for
ripr-swarmsurface
Source-of-truth Links
Proposal: n/a
Spec: n/a (xtask policy-gate honesty; same family as #2413/#2466)
ADR: n/a
Plan item: n/a
Governing issue or accepted claim: #5078
Acceptance delta (one sentence): Duplicate count-policy keys fail closed, and a stale executable allowlist row fails closed, without changing live allowlist contents.
Candidate Relationships
Candidate branch (GitHub PR head is authoritative after publication):
cursor/reject-duplicate-count-allowlist-cec2Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Acceptance retained from a replaced candidate (if any): n/a
Accepted winner and losing candidate disposition (when decided): n/a
Verified against
origin/main9da89e2d326710eaa2f0e6ae195817405e37f02ebefore coding. Squash9da89e2d(#5187) only changedxtask/src/reports/pr_evidence.rs. No equivalent open or merged PR implements #5078.Scope
Stay in the xtask count-policy readers and
check-executable-files. Do not absorb #5073, #5150/#5187, #5148, #4861/#4882, #5103, #4999/#5160, #5096/#5207, #5092, or.github/workflows/routed-rust.yml.Scope Classification
This PR is scoped by:
Production delta:
read_count_allowlistandread_count_policy_allowlistreject a repeated(path, pattern)key with a line-numberedis duplicated (first declared near line N)error, mirroring the static-language duplicate-matcher rejection.check_executable_files_implflags anexecutable_allowlist.txtrow whose path is absent fromgit ls-files --stageor present with a mode other than100755.Evidence/support delta:
100644); live100755row still passes.Single acceptance criterion:
max_countcannot silently widen the budget, and a deleted or demoted executable allowlist row cannot remain invisible.Non-goals:
check-policy-allcomposite (ci(policy): reconcile delivered collect-all and supersede duplicate hosted-scan proposal #5073)Support-tier Impact
docs/status/SUPPORT_TIERS.mdClaim/proof notes:
Policy Impact
Ledger or exception notes:
target/ripr/reports/executable-files.md(and process/network reports on parse failure) may mention the new violation text.Proof
Result, failures, or skipped proof:
100755row still passes..expect()in the new tests (check-no-panic-family). Tests now returnResult<(), String>;check-no-panic-familythen passed.cargo xtask precommitpassed on the repaired tests, includingcheck-executable-files,check-process-policy, andcheck-network-policy.cargo clippy -p xtask --all-targets -- -D warningsexited 0.Exact candidate SHA:
b0743a85ef5a497cc61e688579c407756e6afeaaClaim Boundary
What may be claimed after this PR? What must not be claimed yet?
f04ec8d6ffound zero drift, and this PR does not re-audit every row); runtime mutation results; thatcheck-policy-allexists; that hosted required checks have passed until they do on this exact head.Rollback
How can this PR be reverted safely?
Spec-Test-Code Traceability
count_policy_allowlist_rejects_duplicate_path_pattern_row,count_policy_allowlist_accepts_unique_path_pattern_row,executable_allowlist_rejects_stale_row,executable_allowlist_accepts_live_100755_rowparse_count_allowlist,parse_count_policy_allowlist,insert_unique_count_allowlist_row,executable_file_violations,executable_allowlist_stale_row_violationsStatic Language Check
killed,survived,untested,proven, andadequate.CI Economics
check-process-policy/check-network-policy/check-executable-filessteps; fail-fast on malformed allowlists)target/ripr/reports/Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.Gates
cargo fmt --check(viacargo xtask precommit)cargo check --workspace --all-targetscargo test -p xtaskfocused discriminatorscargo clippy -p xtask --all-targets -- -D warningscargo doc --workspace --no-depscargo package -p ripr --listcargo publish -p ripr --dry-runcargo xtask check-static-languagecargo xtask check-doc-artifactscargo xtask check-no-panic-familycargo xtask check-allow-attributescargo xtask check-local-contextcargo xtask check-file-policycargo xtask check-covered-bycargo xtask check-executable-filescargo xtask check-workflowscargo xtask check-spec-formatcargo xtask check-spec-numberingcargo xtask check-fixture-contractscargo xtask check-generatedcargo xtask check-badge-diff-policycargo xtask check-generated-cleancargo xtask check-dependenciescargo xtask check-process-policycargo xtask check-network-policycargo xtask precommit(authoritative local shift-left; not CI-equivalent)Hosted required checks remain the merge authority.