Repository navigation
feat: implement issue #607 — Story (D): full-file on:/permissions drift guard in compliance-audit [#604] - #692
Conversation
…ft guard in compliance-audit [#604]
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 12 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. 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 Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
There was a problem hiding this comment.
Code Review
This pull request introduces a caller-stub surface-drift guard in scripts/compliance-audit.sh to prevent deployed workflow stubs from silently drifting from their canonical templates in terms of triggers, permissions, and concurrency blocks, supported by a comprehensive suite of BATS unit tests. The review feedback provides valuable shell scripting improvements, including stripping carriage returns to robustly handle Windows CRLF line endings, using explicit return 0 instead of bare return statements, and optimizing file reading by replacing cat with the Bash builtin.
Dev-Lead — fix-reviews (applied)Changes committed and pushed. |
|
Dev-Lead — review-changes (no-changes)No changes were needed for this PR. |
donpetry-bot
left a comment
There was a problem hiding this comment.
Automated review — APPROVED ✓
Risk: MEDIUM
Reviewed commit: 01a7339bfa4f5f6e30ef61a70afc35df6ad583f7
Review mode: triage-approved (single reviewer)
Summary
Adds a caller-stub surface-drift guard to scripts/compliance-audit.sh (issue #607): three pure helpers (stub_extract_blocks / stub_normalize_surface / stub_surface_drift) plus check_stub_surface_drift(), which compares each enrolled shim's on:/permissions:/concurrency: surfaces against the canonical templates in standards/workflows/. Purely additive (416 additions, 0 deletions) with a 276-line bats suite covering both acceptance criteria.
Linked issue analysis
Issue #607 (Story D of the shim-identity epic #604) requires guarding the on: trigger set, permissions: grants, and per-stub concurrency: block for dev-lead and all RING shims, via a tier-normalized full-file check OR explicit sub-checks. The PR implements the explicit sub-checks branch and documents why (a full-file byte guard would false-positive on documented per-repo with: liberties and feature-ideation's allowed cron retune). Both acceptance criteria are test-covered: a trimmed on: block is flagged; a stub differing only by its correct tier channel pin is clean (the guarded surfaces carry no channel pin, so the comparison is tier-invariant by construction). Substantively addressed.
Findings
No blocking findings.
- Helpers are pure (args in, stdout out) and unit-tested; the awk extractor requires the key as the first non-space token, so commented-out keys cannot start a block (test-covered).
- Cron values are normalized to a placeholder so feature-ideation's documented per-repo schedule retune is not flagged (test-covered).
- Severity split is sound: drifted on:/permissions: = error (breaks functionality), drifted concurrency: = warning (degrades runs, #402).
- dev-lead's permissions/concurrency surfaces are deliberately left to the existing higher-signal check_dev_lead_stub(); this check adds its previously-unguarded on: surface — no overlap or gap.
- Graceful degradation: missing canonical template warns and skips; non-adopted stubs and undecodable content are skipped.
- Prior gemini-code-assist feedback (CRLF stripping via tr -d '\r', explicit return codes, $(< file) builtin) was applied in the fix commit; all 3 review threads are resolved.
- Secret scan: run_secret_scanning MCP tool unavailable in this environment; the gitleaks CI check passed and the diff contains no credential-like content.
- Minor (non-blocking): the shims list must be kept in lockstep with check_centralized_workflow_stubs() / RING_REUSABLES — already noted in an in-code comment.
CI status
All checks green: ShellCheck, Lint, Agent Security Scan, Secret scan (gitleaks), Compliance Audit Tests (lint + bats), CodeQL, SonarCloud (Quality Gate passed, 0 issues, 0 hotspots), AgentShield, Dependency audit (npm audit passed; other ecosystems skipped as not present), CodeRabbit status SUCCESS. Skipped checks are conditional ecosystem jobs, not failures.
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: 01a7339bfa4f5f6e30ef61a70afc35df6ad583f7
Review mode: triage-approved (single reviewer)
Summary
Adds a caller-stub surface-drift guard to scripts/compliance-audit.sh (issue #607): three pure, unit-tested helpers (stub_extract_blocks / stub_normalize_surface / stub_surface_drift) plus check_stub_surface_drift(), which compares each enrolled shim's on:/permissions:/concurrency: surfaces against the canonical templates in standards/workflows/. Purely additive (416 additions, 0 deletions) with a 276-line bats suite covering both acceptance criteria.
Linked issue analysis
Issue #607 (Story D of shim-identity epic #604) requires guarding the on: trigger set, permissions: grants, and per-stub concurrency: block for dev-lead and all RING shims, via a tier-normalized full-file check OR explicit sub-checks. The PR implements the explicit sub-checks branch and documents why (a full-file byte guard would false-positive on documented per-repo with: liberties and feature-ideation's allowed cron retune). Both acceptance criteria are test-covered: a trimmed on: block is flagged; a stub differing only by its correct tier channel pin is clean (the guarded surfaces carry no channel pin, so the comparison is tier-invariant by construction). Substantively addressed.
Findings
No blocking findings.
- Helpers are pure (args in, stdout out) and unit-tested; the awk extractor requires the key as the first non-space token, so commented-out keys cannot start a block (test-covered).
- Cron values are normalized to a placeholder so feature-ideation's documented per-repo schedule retune is not flagged (test-covered).
- Severity split is sound: drifted on:/permissions: = error (breaks functionality), drifted concurrency: = warning (degrades runs, #402).
- dev-lead's permissions/concurrency surfaces are deliberately left to the existing higher-signal check_dev_lead_stub(); this check adds its previously-unguarded on: surface — no overlap or gap.
- Graceful degradation: missing canonical template warns and skips; non-adopted stubs and undecodable content are skipped.
- All 3 prior gemini-code-assist review threads (CRLF stripping via tr -d '\r', explicit return codes, $(< file) builtin) are resolved; fixes applied in the second commit.
- Secret scan: run_secret_scanning MCP tool unavailable in this environment; the gitleaks CI check passed and the diff contains no credential-like content.
- Minor (non-blocking): the shims list must be kept in lockstep with check_centralized_workflow_stubs() / RING_REUSABLES — already noted in an in-code comment.
- Note: a prior automated approval already exists at this same head SHA; this re-review confirms the same verdict.
CI status
All checks green: ShellCheck, Lint, Agent Security Scan, Secret scan (gitleaks), Compliance Audit Tests (lint + bats), CodeQL, SonarCloud (Quality Gate passed, 0 issues, 0 hotspots), AgentShield, Dependency audit (npm audit passed). Skipped checks are conditional ecosystem jobs, not failures.
Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.
…ft guard in compliance-audit [#604] (#692) * feat: implement issue #607 — Story (D): full-file on:/permissions drift guard in compliance-audit [#604] * fix(reviews): address review comments [skip ci-relay] --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>



Closes #607
Implemented by dev-lead agent. Please review.