Skip to content

feat: implement issue #969 — [Phase 1] Drift-guard CI: fail when template stubs diverge from standards/ - #983

Merged
don-petry merged 4 commits into
mainfrom
dev-lead/issue-969-20260628-0640
Jun 28, 2026
Merged

don-petry merged 4 commits into
mainfrom
dev-lead/issue-969-20260628-0640

Conversation

@don-petry

Copy link
Copy Markdown
Collaborator

Closes #969

Implemented by dev-lead agent. Please review.

@don-petry
don-petry requested a review from a team as a code owner June 28, 2026 06:54
@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 Jun 28, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

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

More reviews will be available in 5 minutes. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

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

🚦 How do rate 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 see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 16efc110-f5f1-4d3c-abfc-8e6ab60ca221

📥 Commits

Reviewing files that changed from the base of the PR and between 9b0a8b3 and 136f210.

📒 Files selected for processing (4)
  • .github/workflows/lint.yml
  • AGENTS.md
  • scripts/template_stub_drift.sh
  • tests/template_stub_drift.bats
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-969-20260628-0640

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.

@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 template drift guard script (scripts/template_stub_drift.sh) and corresponding tests (tests/template_stub_drift.bats) to ensure files in repo-template do not diverge from their standards-derived baseline, alongside updating AGENTS.md with documentation. The review feedback suggests adding set -euo pipefail for robust error handling, guarding the template_drift_annotate call to guarantee temporary file cleanup under set -e, and removing an unused base64 dependency check.

Comment thread scripts/template_stub_drift.sh Outdated
Comment thread scripts/template_stub_drift.sh
Comment thread scripts/template_stub_drift.sh
@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) June 28, 2026 07:01
@don-petry
don-petry disabled auto-merge June 28, 2026 07:01
@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) June 28, 2026 07:04
@don-petry
don-petry disabled auto-merge June 28, 2026 07:05
@don-petry
don-petry enabled auto-merge (squash) June 28, 2026 07:07
@don-petry
don-petry disabled auto-merge June 28, 2026 07:07
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
1. They are from a different bot than the one specified in the task (which is blank/SonarCloud)
2. They are COMMENTED reviews, not CHANGES_REQUESTED
3. The suggestions in those threads are either already implemented in the code (e.g., `set -euo pipefail` on line 2 of template_stub_drift.sh) or don't apply (no base64 dependency check exists in the code)
---
## Summary
**Bot:** SonarCloud  
**Issues addressed:** 0  
**Tier 1 blockers:** 0  
**Tier 2 open threads:** 3 (from gemini-code-assist, not in scope per task guidelines)
**Conclusion:** No actionable issues found. The SonarCloud quality gate has passed with zero new issues or security hotspots. All CI checks are passing. The PR is ready.

@don-petry
don-petry enabled auto-merge (squash) June 28, 2026 07:09
donpetry-bot
donpetry-bot previously approved these changes Jun 28, 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: 64a59aa268925230a31ec1594083cf65547df844
Review mode: triage-approved (single reviewer)

Summary

Adds a template-drift guard (script + bats + lint job + AGENTS.md docs) implementing #969. The new scripts/template_stub_drift.sh reuses fleet_stub_drift.sh's byte-identity ALIGNED/DRIFTED/MISSING model to fail CI when a file committed in petry-projects/repo-template diverges from its standards-derived baseline. Clean, well-tested, all CI green; triage's low-risk assessment confirmed.

Linked issue analysis

Closes #969 — all 4 acceptance criteria met: (1) reuses classify_stub_drift/stub_drift_row from fleet_stub_drift.sh for blob-SHA equality; (2) manifest covers the workflow stubs plus verbatim baselines (dependabot.yml, CODEOWNERS, CLAUDE.md) and excludes ci.yml via a documented TEMPLATE_DRIFT_ALLOWLIST with recorded rationale; (3) wired into the existing PR-triggered Lint workflow (no new cron) with ::error:: annotations naming the file and both short SHAs; (4) tests/template_stub_drift.bats exercises ALIGNED/DRIFTED/MISSING plus allowlist and 404→MISSING handling.

Findings

No blocking findings.

  • Dependencies verified at head SHA: scripts/seed-repo-template.sh (supports --emit-workflow / --emit-baseline) and scripts/fleet_stub_drift.sh helpers both present.
  • gemini-code-assist HIGH thread (set -e exiting before temp-file cleanup) is RESOLVED: main() guards the call with 'template_drift_annotate "$tsv" || rc=$?' so cleanup/return still run.
  • Two gemini threads remain marked unresolved but are MOOT against current head: 'set -euo pipefail' is already present (line 2), and the 'base64' dependency check no longer exists (main() checks only gh and git). No action needed.
  • Secret-scanning MCP tool unavailable in this environment; diff is shell/YAML/Markdown with no credentials. gitleaks CI check passed.
  • Minor (non-blocking): a transient seed-emit failure degrades a file's check to a ::warning:: skip rather than failing — intentional anti-flake behavior, but means a persistent emit failure could silently pass. Acceptable for Phase 1.

CI status

All required checks green: Lint (shellcheck, bats, template-drift, gh-aw-compile, validate-agent-profiles), CI (ShellCheck, secret-scan/gitleaks, CodeQL actions+python), unit-tests, SonarCloud (quality gate passed, 0 new issues), AgentShield, holdout-guard, test-deletion guard. coderabbitai APPROVED at head. CANCELLED/SKIPPED entries are benign (dev-lead ci-relay self-cancel via [skip ci-relay]; dependency-audit ecosystem matrix + dependabot-automerge skipped as non-applicable). mergeStateStatus BLOCKED only pending the requested org-leads human review — expected, not a defect.


Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

@don-petry

Copy link
Copy Markdown
Collaborator Author

@donpetry-bot this PR has been idle ~hours with unresolved gemini-code-assist threads blocking merge (required thread resolution), after fix-review attempts stalled under rate-limit/concurrency churn. All required CI is green. Please complete the fix-review pass: address the remaining review threads, resolve them, and provide the approving review so squash auto-merge can land.

@donpetry-bot

Copy link
Copy Markdown
Contributor

@don-petry I'm on it — starting a fresh review now. Results will appear in a few minutes.

@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: 64a59aa268925230a31ec1594083cf65547df844
Review mode: triage-approved (single reviewer)

Summary

Adds a template-drift guard (scripts/template_stub_drift.sh + tests/template_stub_drift.bats + a PR-triggered template-drift job in lint.yml + AGENTS.md docs) implementing #969. The script reuses fleet_stub_drift.sh's byte-identity ALIGNED/DRIFTED/MISSING model to fail CI when a file committed in petry-projects/repo-template diverges from its standards-derived baseline. Triage-approved confirmation: the low-risk assessment holds — clean diff, well tested, all CI green.

Linked issue analysis

Closes #969 — all 4 acceptance criteria met: (1) reuses classify_stub_drift/stub_drift_row from fleet_stub_drift.sh for blob-SHA equality; (2) manifest covers the workflow stubs plus verbatim baselines (dependabot.yml, CODEOWNERS, CLAUDE.md) and excludes ci.yml via a documented TEMPLATE_DRIFT_ALLOWLIST with recorded rationale; (3) wired into the existing PR-triggered Lint workflow (no new cron) with ::error:: annotations naming the file and both short SHAs; (4) tests exercise ALIGNED/DRIFTED/MISSING plus allowlist and 404->MISSING handling.

Findings

No blocking findings.

  • All three gemini-code-assist suggestions are already implemented at head 64a59aa: (a) HIGH 'set -e exits before temp-file cleanup' is RESOLVED/OUTDATED — main() guards the call with 'template_drift_annotate "$tsv" || rc=$?' so cleanup/return still run; (b) the 'add set -euo pipefail' thread is MOOT — it is already present on line 2; (c) the 'remove unused base64 dependency check' thread is MOOT — main() now checks only gh and git. The latter two threads remain marked unresolved only because gemini filed them against an earlier commit (aeb29b4) and they were not auto-outdated; their content is in the code. No code action required.
  • Workflow safety verified: lint.yml triggers on 'pull_request' (not pull_request_target), 'permissions: contents: read', checkout SHA-pinned (v6.0.3), GH_TOKEN is the default github.token. The drift job only reads cross-repo contents — no injection surface, no secrets.
  • Secret-scanning MCP tool unavailable in this environment; diff is shell/YAML/Markdown with no credentials. gitleaks CI check passed.
  • Minor (non-blocking, unchanged from prior review): a transient seed-emit failure degrades a file's check to a ::warning:: skip rather than failing — intentional anti-flake behavior; a persistent emit failure could silently pass. Acceptable for Phase 1.

CI status

All required checks green: Lint (shellcheck, bats, template-drift, gh-aw-compile, validate-agent-profiles), CI (ShellCheck, secret-scan/gitleaks, CodeQL actions+python), unit-tests, SonarCloud (quality gate passed, 0 new issues), AgentShield, holdout-guard, test-deletion guard. coderabbitai APPROVED at head. CANCELLED/SKIPPED entries are benign (dev-lead ci-relay self-cancel via [skip ci-relay]; dependency-audit ecosystem matrix + dependabot-automerge skipped as non-applicable). mergeStateStatus BLOCKED reflects required thread-resolution on the two stale-but-moot gemini threads and the pending human review — not a code defect.


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 June 28, 2026 11:29

Superseded by automated re-review at 64a59aa.

@don-petry
don-petry disabled auto-merge June 28, 2026 12:00
@sonarqubecloud

Copy link
Copy Markdown

@don-petry
don-petry enabled auto-merge (squash) June 28, 2026 12:02
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-06-28T13:02:24Z.

@don-petry
don-petry disabled auto-merge June 28, 2026 12:02
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
## Summary
**Bot:** SonarCloud  
**Issues addressed:** 0  
The SonarCloud quality gate **passed** with 0 new issues and 0 security hotspots. All CI checks are green.
**Gemini review threads resolved:** 3
1. **Cleanup guard under `set -e`**: Already fixed (lines 167–169 of `scripts/template_stub_drift.sh` guard `template_drift_annotate` with `|| rc=$?`). [replied + thread resolved]
2. **`set -euo pipefail`**: Already present (line 2 of `scripts/template_stub_drift.sh`). [replied + thread resolved]
3. **Unused `base64` check**: Already removed (lines 147–150 check only `gh git`). [replied + thread resolved]
**Files changed:** None (all addressed issues were already implemented at HEAD)
**Status:** All gemini threads now resolved. PR is ready for merge pending human review approvals.

@don-petry
don-petry merged commit 857bb18 into main Jun 28, 2026
36 of 48 checks passed
@don-petry
don-petry deleted the dev-lead/issue-969-20260628-0640 branch June 28, 2026 12:03
don-petry added a commit that referenced this pull request Aug 2, 2026
…late stubs diverge from standards/ (#983)

* feat: implement issue #969 — [Phase 1] Drift-guard CI: fail when template stubs diverge from standards/

* chore: dev-lead update (review-changes) [skip ci-relay]

* chore: dev-lead update (review-changes) [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 3, 2026
…late stubs diverge from standards/ (#983)

* feat: implement issue #969 — [Phase 1] Drift-guard CI: fail when template stubs diverge from standards/

* chore: dev-lead update (review-changes) [skip ci-relay]

* chore: dev-lead update (review-changes) [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 3, 2026
…late stubs diverge from standards/ (#983)

* feat: implement issue #969 — [Phase 1] Drift-guard CI: fail when template stubs diverge from standards/

* chore: dev-lead update (review-changes) [skip ci-relay]

* chore: dev-lead update (review-changes) [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 3, 2026
…late stubs diverge from standards/ (#983)

* feat: implement issue #969 — [Phase 1] Drift-guard CI: fail when template stubs diverge from standards/

* chore: dev-lead update (review-changes) [skip ci-relay]

* chore: dev-lead update (review-changes) [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 7, 2026
…late stubs diverge from standards/ (#983)

* feat: implement issue #969 — [Phase 1] Drift-guard CI: fail when template stubs diverge from standards/

* chore: dev-lead update (review-changes) [skip ci-relay]

* chore: dev-lead update (review-changes) [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 7, 2026
…late stubs diverge from standards/ (#983)

* feat: implement issue #969 — [Phase 1] Drift-guard CI: fail when template stubs diverge from standards/

* chore: dev-lead update (review-changes) [skip ci-relay]

* chore: dev-lead update (review-changes) [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 7, 2026
…late stubs diverge from standards/ (#983)

* feat: implement issue #969 — [Phase 1] Drift-guard CI: fail when template stubs diverge from standards/

* chore: dev-lead update (review-changes) [skip ci-relay]

* chore: dev-lead update (review-changes) [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 7, 2026
…late stubs diverge from standards/ (#983)

* feat: implement issue #969 — [Phase 1] Drift-guard CI: fail when template stubs diverge from standards/

* chore: dev-lead update (review-changes) [skip ci-relay]

* chore: dev-lead update (review-changes) [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 7, 2026
…late stubs diverge from standards/ (#983)

* feat: implement issue #969 — [Phase 1] Drift-guard CI: fail when template stubs diverge from standards/

* chore: dev-lead update (review-changes) [skip ci-relay]

* chore: dev-lead update (review-changes) [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 8, 2026
…late stubs diverge from standards/ (#983)

* feat: implement issue #969 — [Phase 1] Drift-guard CI: fail when template stubs diverge from standards/

* chore: dev-lead update (review-changes) [skip ci-relay]

* chore: dev-lead update (review-changes) [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
don-petry added a commit that referenced this pull request Aug 18, 2026
…late stubs diverge from standards/ (#983)

* feat: implement issue #969 — [Phase 1] Drift-guard CI: fail when template stubs diverge from standards/

* chore: dev-lead update (review-changes) [skip ci-relay]

* chore: dev-lead update (review-changes) [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
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.

[Phase 1] Drift-guard CI: fail when template stubs diverge from standards/

2 participants