Skip to content

fix(xtask): reject duplicate count-policy rows and stale executable allowlist entries - #5216

Merged
EffortlessSteven merged 3 commits into
mainfrom
cursor/reject-duplicate-count-allowlist-cec2
Oct 4, 2026
Merged

EffortlessSteven merged 3 commits into
mainfrom
cursor/reject-duplicate-count-allowlist-cec2

Conversation

@EffortlessSteven

@EffortlessSteven EffortlessSteven commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Reject a repeated count-policy (path, pattern) row with a line-numbered error, and reverse-check executable_allowlist.txt so a missing or non-100755 path fails. This closes the two dead-entry classes #5078 found after the f04ec8d6f audit (zero live drift; recurrence prevention still missing).

Closes #5078

Swarm / Source Boundary

This PR targets EffortlessMetrics/ripr-swarm, the normal development trunk for
trusted same-repo ripr work. Confirm the change belongs here:

  • ordinary feature, analyzer, editor, docs, spec, fixture, badge,
    dependency, or repo-ops development for ripr-swarm
  • repair or follow-up for a same-repo swarm PR
  • swarm-only CI, runner, routing, source-of-truth, or agent-operating
    surface
  • other swarm-scoped work:

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-cec2
Stack 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/main 9da89e2d326710eaa2f0e6ae195817405e37f02e before coding. Squash 9da89e2d (#5187) only changed xtask/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:

  • One production behavior
  • One public contract
  • One architectural seam
  • Docs/spec/test-only evidence package
  • Other:

Production delta:

  • read_count_allowlist and read_count_policy_allowlist reject a repeated (path, pattern) key with a line-numbered is duplicated (first declared near line N) error, mirroring the static-language duplicate-matcher rejection.
  • check_executable_files_impl flags an executable_allowlist.txt row whose path is absent from git ls-files --stage or present with a mode other than 100755.

Evidence/support delta:

  • Discriminating tests: duplicate count row fails; unique row still passes; stale executable row fails (missing and demoted 100644); live 100755 row still passes.

Single acceptance criterion:

  • A later duplicate count row with a higher max_count cannot silently widen the budget, and a deleted or demoted executable allowlist row cannot remain invisible.

Non-goals:

Support-tier Impact

  • none
  • updates docs/status/SUPPORT_TIERS.md
  • changes a README, release, docs, CLI, JSON, editor, CI, or package claim

Claim/proof notes:

  • Policy gates become fail-closed for two previously invisible dead-entry classes. No user-facing product claim changes.

Policy Impact

  • none
  • doc artifacts
  • CI lane
  • package boundary
  • lint / Clippy
  • no-panic
  • file policy
  • generated artifact
  • dependency
  • process/network

Ledger or exception notes:

  • No allowlist rows added or removed. Existing process/network/executable lists are unchanged; the readers and executable reverse-check now reject duplicates and stale executable rows. Generated target/ripr/reports/executable-files.md (and process/network reports on parse failure) may mention the new violation text.

Proof

git fetch origin main
cargo test -p xtask count_policy_allowlist
cargo test -p xtask executable_allowlist
cargo xtask check-no-panic-family
cargo xtask precommit
cargo clippy -p xtask --all-targets -- -D warnings

Result, failures, or skipped proof:

  • Four discriminating tests passed on this candidate: duplicate count row fails; unique row still passes; stale executable row fails; live 100755 row still passes.
  • First precommit failed on .expect() in the new tests (check-no-panic-family). Tests now return Result<(), String>; check-no-panic-family then passed.
  • cargo xtask precommit passed on the repaired tests, including check-executable-files, check-process-policy, and check-network-policy.
  • cargo clippy -p xtask --all-targets -- -D warnings exited 0.
  • Hosted required checks are in flight on the published head. This PR does not claim CI-equivalent completeness from precommit.

Exact candidate SHA: b0743a85ef5a497cc61e688579c407756e6afeaa

Claim Boundary

What may be claimed after this PR? What must not be claimed yet?

  • May claim: duplicate count-policy keys fail closed with a line-numbered error; stale executable allowlist rows fail closed.
  • Must not claim: the live process/network/executable lists were dirty (audit at f04ec8d6f found zero drift, and this PR does not re-audit every row); runtime mutation results; that check-policy-all exists; that hosted required checks have passed until they do on this exact head.

Rollback

How can this PR be reverted safely?

  • Revert the commits. Existing allowlists have no duplicates or stale executable rows, so rollback restores the previous silent overwrite / no reverse-check behavior without requiring ledger edits.

Spec-Test-Code Traceability

Static Language Check

  • Static output avoids killed, survived, untested, proven, and adequate.
  • Unknowns include stop reasons where applicable.

CI Economics

  • LEM impact: none intended (existing check-process-policy / check-network-policy / check-executable-files steps; fail-fast on malformed allowlists)
  • Workflows touched: none
  • Branch protection impact: none
  • Failure mode caught: duplicate count-policy overwrite; stale executable allowlist row
  • Cheaper signal considered: unit tests on the retained parse/stage helpers
  • Required lanes affected: existing Rust gates that already run these checks
  • Advisory lanes affected: none
  • On-demand/release lanes affected: none
  • Labels that alter behavior: none
  • Artifact families affected: policy reports under target/ripr/reports/
  • Rollback path: revert the commits

Engineering Check

  • No new panic, unwrap, expect, todo, or unimplemented in production code.
  • No new panic, unwrap, expect, todo, or unimplemented in tests.
  • New non-Rust programming files are allowlisted with owner, surface, and reason.
  • New generated, dependency, process-spawn, or network surfaces are allowlisted with owner and reason.
  • Errors are reported with actionable context.
  • Public JSON/schema changes are documented.

Gates

  • cargo fmt --check (via cargo xtask precommit)
  • cargo check --workspace --all-targets
  • cargo test -p xtask focused discriminators
  • cargo clippy -p xtask --all-targets -- -D warnings
  • cargo doc --workspace --no-deps
  • cargo package -p ripr --list
  • cargo publish -p ripr --dry-run
  • cargo xtask check-static-language
  • cargo xtask check-doc-artifacts
  • cargo xtask check-no-panic-family
  • cargo xtask check-allow-attributes
  • cargo xtask check-local-context
  • cargo xtask check-file-policy
  • cargo xtask check-covered-by
  • cargo xtask check-executable-files
  • cargo xtask check-workflows
  • cargo xtask check-spec-format
  • cargo xtask check-spec-numbering
  • cargo xtask check-fixture-contracts
  • cargo xtask check-generated
  • cargo xtask check-badge-diff-policy
  • cargo xtask check-generated-clean
  • cargo xtask check-dependencies
  • cargo xtask check-process-policy
  • cargo xtask check-network-policy
  • cargo xtask precommit (authoritative local shift-left; not CI-equivalent)

Hosted required checks remain the merge authority.

Open in Web Open in Cursor 

…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>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 4, 2026 •

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 ✅ Completed 2026-10-04T00:37:25.944090Z 9ead014 PR opened
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 480760c6-a634-48fe-8609-40f4c2cb87f7
📥 Commits

Reviewing files that changed from the base of the PR and between 9ead014 and b0743a8.

📒 Files selected for processing (2)
  • xtask/src/main.rs
  • xtask/src/tests.rs
🔗 Linked repositories identified

CodeRabbit 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

  • Bug Fixes
    • Validation now reports duplicate path-and-pattern entries and identifies both the duplicate and original line numbers.
    • Executable-file checks flag allowlist entries for missing files or files without executable permissions, as well as executable files missing from the allowlist.
    • Count-policy checks reject duplicate normalized entries while continuing to accept unique entries and retain their configured bounds.

Walkthrough

The xtask policy checks now reject duplicate count-allowlist rows and report executable-allowlist entries whose paths are missing or whose staged mode is not 100755. Tests cover these cases and valid entries.

Changes

Policy allowlist validation

Layer / File(s) Summary
Count allowlist duplicate checks
xtask/src/main.rs, xtask/src/tests.rs
Both count-allowlist parsers reject duplicate normalized path-and-pattern keys and report the duplicate and first declaration line numbers. Tests cover duplicate and distinct keys.
Executable allowlist validation
xtask/src/main.rs, xtask/src/tests.rs
Executable-file validation reports allowlist entries for missing paths or paths whose staged mode is not 100755. Tests also cover a matching 100755 entry.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to b0743

The supplied evidence identifies no issue that should block merging. Complete the planned xtask tests and required checks.

Architecture Summary

Architecture risk: 🟡 Medium · up to b0743

The change affects 1 system.

Changed systems: xtask

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — xtask (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in xtask/src/main.rs: check_executable_files_impl delegates violation collection to a helper that also detects stale allowlist entries.
  • observed — Modified behavior in xtask/src/main.rs: The policy guidance now says to remove allowlist entries when the path is missing or its staged mode is not 100755.
  • observed — Modified behavior in xtask/src/main.rs: The new helpers record staged modes, report unallowlisted files with mode 100755, and report allowlist entries whose path is absent or whose mode differs from 100755.
  • observed — Modified behavior in xtask/src/main.rs: read_count_allowlist now passes file contents to a parser, which initializes parsed values and first-declaration-line tracking.

Reliability and maintainability

  • inferred — Risk-relevant change factors for xtask: blast_radius_1; direct_dependents_1
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes both primary changes: rejecting duplicate count-policy rows and detecting stale executable allowlist entries.
Description check ✅ Passed The description follows the repository template and explains the scope, acceptance criteria, tests, proof status, claim boundaries, and rollback. It also identifies hosted required checks as pending.
Linked Issues check ✅ Passed #5078 requires both count-allowlist parsers to reject duplicate (path, pattern) keys and the executable check to reject allowlist paths that are missing or not mode 100755. xtask/src/main.rs imp…
Out of Scope Changes check ✅ Passed The changes in xtask/src/main.rs and xtask/src/tests.rs implement #5078. The diff adds no unrelated behavior and does not change allowlist contents.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks each path and row,
And spots repeats that should not grow.
Missing files and modes that stray
Now bring a clear report their way.
One live executable passes through,
While tidy lists keep errors few.

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread xtask/src/main.rs Resolved
cursoragent and others added 2 commits October 4, 2026 00:44
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 EffortlessSteven left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.rs policy owners: read_count_allowlist / parse_count_allowlist (workflow runtime + allow-attributes consumers), read_count_policy_allowlist / parse_count_policy_allowlist (check_count_policy for process/network), insert_unique_count_allowlist_row, check_executable_files_impl → executable_file_violations → executable_allowlist_stale_row_violations.
  • Tests in xtask/src/tests.rs call 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, and check-executable-files gates 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 9ead014 had no actionable comments. That review is stale relative to b0743a85e (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-family passed after removing .expect(); cargo xtask precommit passed; cargo clippy -p xtask --all-targets -- -D warnings exited 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-repair BTreeMap::insert overwrite 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 100644 path. A live 100755 row 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 b0743a85e are not yet established.
  • Tests exercise the parse/stage helpers, not a temp-file read_* wrapper or a live git ls-files --stage subprocess. 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.

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.

gate(xtask): reject duplicate count-policy allowlist rows and stale executable_allowlist rows (audit at f04ec8d6f: zero live drift)

2 participants