Skip to content

feat: implement issue #1520 — duplicate-decl-gate: required CI check blocking the #1485 corruption class - #1528

Merged
don-petry merged 5 commits into
mainfrom
feat/1520-duplicate-decl-gate
Aug 18, 2026
Merged

don-petry merged 5 commits into
mainfrom
feat/1520-duplicate-decl-gate

Conversation

@don-petry

@don-petry don-petry commented Aug 18, 2026 •

Copy link
Copy Markdown
Collaborator

User description

Closes #1520

Maintainer-approved steering implementation. The merge-blocking backstop against the corruption class that reached main twice with green checks (#1292 on 2026-08-06, #1378 on 2026-08-14 — incident record in #1485).

Ground-truth validation: run against the actual #1378 corrupted engine.sh (5b65dabd), the gate reports all 13 duplicated functions (parse_reset_time x7, _emit_reset_iso x6, …) and exits 1; green on restored main.

Post-merge action (steering, maintainer-approved): add duplicate-decl-gate to 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

  • Added a CI check that scans shell scripts for repeated top-level function definitions and fails with the affected function names and incident guidance
  • The check runs on every pull request and pushes to main, including changes outside the scripts directory
  • Variable reassignments remain allowed, while nested script directories are also scanned
  • Added automated tests covering clean trees, corrupted files, nested directories, duplicate functions, and valid variable reassignment

Impact

✅ 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:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

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:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

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.

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>
@don-petry
don-petry requested a review from a team as a code owner August 18, 2026 15:07
@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.

@codeant-ai

codeant-ai Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR abfc217 Aug 18, 2026 · 15:07 15:10

@codeant-ai

codeant-ai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Aug 18, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@don-petry, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 6b3e952e-4be0-45e6-8e79-19ebe38bf99e

📥 Commits

Reviewing files that changed from the base of the PR and between 18e7c6d and b73b027.

📒 Files selected for processing (6)
  • .github/workflows/duplicate-decl-gate.yml
  • .github/workflows/lint.yml
  • docs/agentic-interaction-model.md
  • scripts/check-duplicate-decls.sh
  • scripts/lib/conflict-integrity.sh
  • tests/test_duplicate_decl_gate.bats

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.

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Aug 18, 2026

@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 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.

Comment thread tests/test_duplicate_decl_gate.bats Resolved
Comment thread scripts/check-duplicate-decls.sh Resolved
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) August 18, 2026 15:11
@don-petry
don-petry disabled auto-merge August 18, 2026 15:12
@donpetry-bot

Copy link
Copy Markdown
Contributor

CI checks on this PR are still running. Once they complete, re-mention @donpetry-bot to trigger a fresh review.

Posted by the donpetry-bot PR-review cascade.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) August 18, 2026 15:15
@don-petry
don-petry disabled auto-merge August 18, 2026 15:18
@donpetry-bot

Copy link
Copy Markdown
Contributor

CI checks on this PR are still running. Once they complete, re-mention @donpetry-bot to trigger a fresh review.

Posted by the donpetry-bot PR-review cascade.

@don-petry
don-petry enabled auto-merge (squash) August 18, 2026 15:21
donpetry-bot
donpetry-bot previously approved these changes Aug 18, 2026

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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-scoped contents: read, actions/checkout pinned to 3d3c42e5aac5ba805825da76410c181273ba90b1 (verified via GitHub API as the v7.0.1 release commit), persist-credentials: false, plain pull_request trigger, no untrusted-input interpolation.
  • Script correctness: set -euo pipefail with the grep-no-match case correctly neutralized; sort/uniq locale pinned with LC_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 missed name() 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.

@donpetry-bot
donpetry-bot dismissed their stale review August 18, 2026 15:34

Superseded by automated re-review at 01cfd4c.

@don-petry
don-petry disabled auto-merge August 18, 2026 15:45
@don-petry
don-petry enabled auto-merge (squash) August 18, 2026 15:45
@don-petry
don-petry disabled auto-merge August 18, 2026 15:48
@don-petry
don-petry enabled auto-merge (squash) August 18, 2026 15:48
@don-petry
don-petry disabled auto-merge August 18, 2026 17:05
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — waiting on PR blockers (intent: review-changes)

PR: #1528
No changes were committed, but the PR still has blocking checks or reviews (failing or cancelled checks, or changes-requested reviews). The retry cron will re-attempt automatically. Next attempt after: 2026-08-18T17:37:22Z

@don-petry

Copy link
Copy Markdown
Collaborator Author

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.
Next attempt after: 2026-08-18T17:37:22Z

@don-petry
don-petry enabled auto-merge (squash) August 18, 2026 17:07
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

2 participants