Repository navigation
feat: implement issue #1520 — duplicate-decl-gate: required CI check blocking the #1485 corruption class - #1528
Conversation
Adds the merge-blocking backstop against the #1485 corruption class, which reached main twice (#1292, #1378) with green checks both times: - scripts/check-duplicate-decls.sh: tree-state scan of a scripts directory for top-level functions declared more than once, reusing lib/conflict-integrity.sh's extract_top_level_symbols and format_integrity_findings (#1520 AC: no second parser). Functions only — top-level variable reassignment is legitimate shell, and both incidents' signature was duplicated function bodies. No escape hatch by design. - .github/workflows/duplicate-decl-gate.yml: runs on every pull_request (no paths filter — a required check that path-skips blocks merges forever) and on main pushes. Seconds of runtime. - tests/test_duplicate_decl_gate.bats (wired into lint.yml's bats list): green on the repo tree, red on the #1496 corrupted fixture, names the duplicated symbol, cites #1485, functions-only semantics, nested lib/ scan. Validated against ground truth: red on the actual #1378 corrupted engine.sh (all 13 duplicated functions reported, parse_reset_time x7), green on restored main. After merge (maintainer/steering action): add the duplicate-decl-gate check to branch protection required status checks — the blocking property is the point (#1427 precedent: non-required red checks are silently ignored). Closes #1520 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
🤖 CodeAnt AI — Review Status
|
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
|
Warning Review limit reached
Next review available in: 37 minutes Limit details: You’ve used all 1 included review currently available under your plan. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces a new CI gate script, check-duplicate-decls.sh, along with a BATS test suite to detect duplicate top-level function declarations in shell scripts and prevent silent shadowing. The feedback suggests improving the test setup by utilizing the built-in $BATS_TEST_TMPDIR variable instead of manually creating and deleting temporary directories.
Dev-Lead — review-changes (applied)Changes committed and pushed. |
|
CI checks on this PR are still running. Once they complete, re-mention Posted by the donpetry-bot PR-review cascade. |
Dev-Lead — review-changes (applied)Changes committed and pushed. |
|
CI checks on this PR are still running. Once they complete, re-mention Posted by the donpetry-bot PR-review cascade. |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: MEDIUM
Reviewed commit: 01cfd4cf8dfe2c2ce24b7e0d71480c2b23ec32b3
Review mode: triage-approved (single reviewer)
Summary
Adds a required merge-blocking CI gate (duplicate-decl-gate) that fails any PR whose scripts/ tree contains a top-level shell function declared more than once — the corruption class from incidents #1292/#1378 (#1485). Reuses the existing conflict-integrity.sh parser (extended with the multiline 'name()\n{' form), adds a BATS suite wired into lint.yml, and registers the workflow in the interaction-model doc. Confirms the triage assessment: low-risk, well-scoped, well-hardened.
Linked issue analysis
Closes #1520. All acceptance criteria substantively met: tree-state (not diff-aware) scan reusing extract_top_level_symbols (no second parser), runs on every PR with no paths filter plus main pushes, failure output names each file/symbol with counts via format_integrity_findings and cites #1485, no escape hatch by design, validated green on the repo tree and red on the #1496 corrupted fixture. The functions-only narrowing (AC says 'function or variable') is explicitly maintainer-approved steering documented in the PR body — top-level variable reassignment is legitimate shell and both incidents' signature was duplicated function bodies. Adding the check to branch protection's required set is a documented post-merge admin action.
Findings
No blocking findings.
- Workflow hardening verified: top-level permissions: {}, job-scoped contents: read, actions/checkout pinned to 3d3c42e5aac5ba805825da76410c181273ba90b1 — confirmed via GitHub API to be exactly the v7.0.1 tag; persist-credentials: false, 5-minute timeout, ref-scoped concurrency with cancel-in-progress.
- All three bot review findings were fixed and verified present in head 01cfd4c: (1) gemini — BATS_TEST_TMPDIR now used in setup(), teardown removed; (2) codeant — multiline 'name()' + next-line-brace form now parsed by extract_top_level_symbols, with a dedicated bats test; (3) graphite — github.sha removed from the concurrency group. Two of these threads are not formally marked resolved in the UI, but each carries a maintainer fix reply and the fixes are confirmed in the current diff — substantively resolved.
- Secret scan: run_secret_scanning MCP tool unavailable in this environment; gitleaks CI check passed. No secrets in the diff.
- Script correctness spot-check: pipefail-safe grep handling for files with no functions, exit 2 on missing scan dir, LC_ALL=C stable sort. lint.yml change is a one-line bats-list addition; no thin caller stubs modified.
CI status
All CI checks green: shellcheck, actionlint, bats/unit-tests, CodeQL (actions + python), SonarCloud quality gate, gitleaks secret scan, agent-shield, holdout-guard, stub/permissions validators, and the new duplicate-decl-gate itself all SUCCESS. Only in-progress check is this review workflow. Ecosystem-specific dependency audits skipped (not applicable).
Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: MEDIUM
Reviewed commit: 01cfd4cf8dfe2c2ce24b7e0d71480c2b23ec32b3
Review mode: triage-approved (single reviewer)
Summary
Adds a required merge-blocking CI gate (duplicate-decl-gate) that fails any PR whose scripts/ tree contains a top-level shell function declared more than once — the #1485/#1292/#1378 corruption class. Reuses lib/conflict-integrity.sh's parser (extended for brace-on-next-line syntax), adds a bats suite wired into lint.yml, and updates the interaction-model doc table. Triage's low-risk assessment is confirmed; classified MEDIUM here only because it adds a new workflow and touches a shared lib parser.
Linked issue analysis
Closes #1520. AC1: gate reuses extract_top_level_symbols from lib/conflict-integrity.sh — no second parser (the lib change extends the existing awk, it does not fork it). The functions-only narrowing (issue asked for functions or variables) is explicitly documented in the PR body as maintainer-approved steering, with sound rationale (top-level var reassignment is legitimate shell; both incidents' signature was duplicated function bodies). AC2: runs on every pull_request with no paths filter plus main pushes; adding it to branch-protection required checks is correctly deferred to a documented post-merge maintainer action. AC3: tree-state semantics confirmed (scans the checked-out tree, not the diff). Tests cover green-on-clean-tree, red-on-corrupted-fixture naming the symbol, #1485 citation in output, functions-only semantics, multiline decl syntax, and nested lib/ scan.
Findings
No blocking findings.
- Workflow security: top-level
permissions: {}, job-scopedcontents: read,actions/checkoutpinned to3d3c42e5aac5ba805825da76410c181273ba90b1(verified via GitHub API as the v7.0.1 release commit),persist-credentials: false, plainpull_requesttrigger, no untrusted-input interpolation. - Script correctness:
set -euo pipefailwith the grep-no-match case correctly neutralized; sort/uniq locale pinned withLC_ALL=C; missing scan dir exits 2 with a distinct error. - Prior bot-review threads (2 formally unresolved, 1 resolved) — all three fixes verified present at head
01cfd4c: gemini (use $BATS_TEST_TMPDIR — setup() now uses it, teardown removed), codeant (parser missedname()with brace on next line — second awk pattern added plus a dedicated test), graphite (concurrency group included github.sha — removed, group is now ref-scoped). The two open threads are bot suggestions answered with committed fixes; nothing outstanding. - Secret scan: run_secret_scanning MCP tool not available in this run; gitleaks CI check is green and the diff contains no credential-like content.
- Minor, non-blocking: the column-0 parser can in principle match function-like lines inside unindented heredocs — a pre-existing limitation of the shared parser, not introduced here, and acceptable for a gate whose false-positive fix is a reviewed diff.
CI status
All checks green at head 01cfd4c: shellcheck, actionlint, bats/unit-tests, CodeQL (actions + python), SonarCloud quality gate, gitleaks secret scan, agent-shield, validate-* suite, duplicate-decl-gate itself (the new gate passes on its own tree). Only the review cascade job itself was in progress. Skipped checks are ecosystem-conditional dependency audits (no matching ecosystems).
Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.
Superseded by automated re-review at 01cfd4c.
Dev-Lead — waiting on PR blockers (intent: review-changes)PR: #1528 |
|
Note @don-petry I reviewed this PR and no code changes were needed, but it still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews), so I cannot mark it done yet. I'll re-check automatically. |
|



User description
Closes #1520
Maintainer-approved steering implementation. The merge-blocking backstop against the corruption class that reached
maintwice with green checks (#1292 on 2026-08-06, #1378 on 2026-08-14 — incident record in #1485).scripts/check-duplicate-decls.sh— tree-state scan for top-level functions declared more than once, reusinglib/conflict-integrity.sh's parser and formatter (no second parser, per AC). Functions only: top-level variable reassignment is legitimate shell; both incidents' signature was duplicated function bodies. No escape hatch by design..github/workflows/duplicate-decl-gate.yml— everypull_request(deliberately no paths filter: a required check that path-skips blocks merges forever) +mainpushes. Runs in seconds.tests/test_duplicate_decl_gate.bats(added tolint.yml's bats list) — green on the repo tree, red on the feat: implement issue #1482 — [Phase 4] Post-conflict-resolution integrity check — catch duplicated/corrupted content before it's trusted #1496 corrupted fixture naming the symbol, cites [Incident] Trunk corruption: main's scripts carry 3–6x duplicated function definitions (merged via #1420, #1292) — surgical restoration required #1485, functions-only semantics, nestedlib/scan.Ground-truth validation: run against the actual #1378 corrupted
engine.sh(5b65dabd), the gate reports all 13 duplicated functions (parse_reset_timex7,_emit_reset_isox6, …) and exits 1; green on restoredmain.Post-merge action (steering, maintainer-approved): add
duplicate-decl-gateto branch protection's required status checks — a non-required red check is silently ignored by the cascade (#1427).🤖 Generated with Claude Code
CodeAnt-AI Description
Block merges that contain duplicate top-level shell function declarations
What Changed
main, including changes outside the scripts directoryImpact
✅ Fewer corrupted merges✅ Clearer duplicate-function failure reports✅ Consistent protection across all pull requests💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.