Skip to content

feat: implement issue #877 — [#850] make standards-deploy driver treat a missing S7635 marker as drift (propagate #876 markers to already-pinned consumers) - #878

Merged
don-petry merged 2 commits into
mainfrom
dev-lead/issue-877-20260722-1642
Jul 22, 2026
Merged

feat: implement issue #877 — [#850] make standards-deploy driver treat a missing S7635 marker as drift (propagate #876 markers to already-pinned consumers)#878
don-petry merged 2 commits into
mainfrom
dev-lead/issue-877-20260722-1642

Conversation

@don-petry

@don-petry don-petry commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

User description

Closes #877

Implemented by dev-lead agent. Please review.


CodeAnt-AI Description

Treat missing S7635 markers in pinned workflow stubs as drift

What Changed

  • Workflow sweeps now reopen a PR when a pinned stub is correct but has lost the required S7635 notice on secrets: inherit
  • Stubs that still have both the right pin and the marker stay compliant, avoiding unnecessary redeploys
  • Test coverage now includes both cases: marker missing causes drift, marker present does not

Impact

✅ Restores missing workflow markers
✅ Fewer skipped re-deploys for already-pinned consumers
✅ Less churn on compliant workflow stubs

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

…t a missing S7635 marker as drift (propagate #876 markers to already-pinned consumers)
@don-petry
don-petry requested a review from a team as a code owner July 22, 2026 16:52
@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 Jul 22, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR e4053a5 Jul 22, 2026 · 16:52 16:56

Updated in place by CodeAnt AI · last 5 reviews

@coderabbitai

coderabbitai Bot commented Jul 22, 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: 9 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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

Run ID: 9e64f2cd-556f-4b3d-9d4f-0a4c4b4bcfb9

📥 Commits

Reviewing files that changed from the base of the PR and between 070b8d7 and eb0ae59.

📒 Files selected for processing (3)
  • scripts/deploy-standard-workflows.sh
  • test/scripts/deploy-standard-workflows/dry-run.bats
  • test/scripts/deploy-standard-workflows/emit-vform.bats
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-877-20260722-1642

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:M This PR changes 30-99 lines, ignoring generated files label Jul 22, 2026
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) July 22, 2026 16:52
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Treat missing S7635 NOSONAR marker as drift in standards deploy

🐞 Bug fix 🧪 Tests 🕐 40+ Minutes

Grey Divider

AI Description

• Detect missing S7635 NOSONAR marker on secrets: inherit as deploy drift.
• Re-deploy already-pinned consumer stubs to propagate restored suppression markers.
• Add/adjust Bats fixtures to prevent false positives and cover marker drift cases.
Diagram

graph TD
  A["deploy-standard-workflows.sh"] --> B["GitHub API"] --> C["Existing stub"] --> E{"Pin+marker compliant?"} -->|"Yes"| F["Skip"]
  A --> D["Workflow template"] --> E
  E -->|"No"| G["Open PR / redeploy"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Strict stub↔template byte comparison
  • ➕ Simpler to reason about: any divergence triggers redeploy
  • ➕ Catches more classes of drift automatically
  • ➖ High churn on cosmetic diffs (formatting/comments/order)
  • ➖ Harder to support intentional, safe consumer-local edits
2. Parse YAML (yq/python) to detect secrets+marker
  • ➕ More robust than regex against YAML formatting edge cases
  • ➕ Can precisely bind marker to the correct node/line semantics
  • ➖ Adds dependencies and operational complexity to a shell-based deploy script
  • ➖ Harder to run consistently across environments/CI images

Recommendation: The chosen approach (augmenting compliance with a targeted marker-presence check only when the template truly uses secrets: inherit) is the best trade-off: it fixes the propagation gap from #875/#876 with minimal churn while avoiding a full byte-compare redeploy strategy. Regex-based detection is acceptable here because the check is intentionally narrow and guarded by the template predicate; adding a YAML parser would likely be overkill for this specific drift signal.

Files changed (3) +79 / -2

Bug fix (1) +36 / -1
deploy-standard-workflows.shAdd S7635 marker drift detection to compliance check +36/-1

Add S7635 marker drift detection to compliance check

• Introduces helpers to detect when a template contains a real 'secrets: inherit' line and whether an existing stub preserves the '# NOSONAR(githubactions:S7635)' marker on that line. Updates compliance logic to require both pin correctness and marker presence (when applicable), treating a missing marker as drift to force redeploy.

scripts/deploy-standard-workflows.sh

Tests (2) +43 / -1
dry-run.batsUpdate pinning fixture stub to include S7635 marker +3/-1

Update pinning fixture stub to include S7635 marker

• Adjusts the 'stub_pinning' helper to include the inline S7635 NOSONAR marker on 'secrets: inherit' so ring-awareness tests remain focused on pin/ring behavior rather than marker drift.

test/scripts/deploy-standard-workflows/dry-run.bats

emit-vform.batsAdd tests for marker-missing drift and marker-present no-churn +40/-0

Add tests for marker-missing drift and marker-present no-churn

• Adds a marker-carrying stub fixture and a marker-less fixture to model pre-#875/#876 consumer state. Introduces new tests asserting that a tier-correct pin without the marker is treated as drift (PR planned) while a tier-correct pin with the marker remains compliant (no churn).

test/scripts/deploy-standard-workflows/emit-vform.bats

@don-petry
don-petry disabled auto-merge July 22, 2026 16:53
@don-petry

Copy link
Copy Markdown
Contributor Author

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

Agent reasoning
Issues addressed: 0
Files changed: none
Skipped (no issues): quality gate passed, 0 new issues
```
No changes needed. The PR is ready to merge from a code quality perspective.

@don-petry
don-petry enabled auto-merge (squash) July 22, 2026 16:54

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the deployment script to detect and remediate workflow stubs that are missing the # NOSONAR(githubactions:S7635) marker on secrets: inherit lines, treating them as drifted even if their pins are correct. While the logic and tests for identifying this drift are solid, the reviewer identified a critical risk of infinite redeployment loops for body-preserving workflows and meta-repo consumer stubs, as the deployment driver does not currently inject the marker during re-deployment. A fix was suggested to patch the source content before deployment to prevent this churn.

Comment thread scripts/deploy-standard-workflows.sh
@don-petry
don-petry disabled auto-merge July 22, 2026 16:54
Comment thread scripts/deploy-standard-workflows.sh
@qodo-code-review

qodo-code-review Bot commented Jul 22, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 87 rules

Grey Divider


Action required

1. Marker drift can’t converge ✓ Resolved 🐞 Bug ≡ Correctness
Description
For SKIP_REPOS (.github/.github-private), the sweep can now flag a missing S7635 marker as drift,
but the deploy path for these repos repins the existing stub body in place and ring_repin_uses
never modifies the secrets: line, so the marker remains missing and the repo will keep re-drifting
on every sweep.
Code

scripts/deploy-standard-workflows.sh[R306-308]

+  if template_requires_s7635_marker "$template" \
+     && ! stub_has_s7635_marker <<< "$existing_content"; then
+    return 1
Relevance

⭐⭐⭐ High

Team fixes non-converging/perpetual-drift bugs in this script; SKIP_REPOS logic evolved recently
(#706/#859).

PR-#706
PR-#859
PR-#837

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The new drift check fails compliance when the template has a real secrets: inherit line and the
stub lacks the S7635 marker. But for SKIP_REPOS, the script writes the existing stub body to
repin_source (preserving the missing marker) and only applies ring_repin_uses, which cannot add
the marker because it only rewrites uses:/agent_ref:.

scripts/deploy-standard-workflows.sh[278-311]
scripts/deploy-standard-workflows.sh[467-527]
scripts/lib/ring-pins.sh[230-239]
standards/workflows/dev-lead.yml[57-70]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
`is_already_compliant()` now treats a missing `# NOSONAR(githubactions:S7635)` marker on `secrets: inherit` as drift. For SKIP_REPOS, the deploy loop intentionally preserves bespoke stub bodies by writing `existing_content` to `repin_source` and only running `ring_repin_uses` (which rewrites `uses:`/`agent_ref:` only). This means a marker-less stub in `.github` / `.github-private` will trigger drift but will never have the marker restored, so the sweep cannot converge.

### Issue Context
- SKIP_REPOS are handled specially to avoid clobbering meta-repo self-hosted/bespoke stubs.
- The new marker-drift check is correct for normal repos that deploy from the template verbatim, but the meta-repo “repin existing body” path must also be able to restore the marker.

### Fix Focus Areas
- scripts/deploy-standard-workflows.sh[278-311]
- scripts/deploy-standard-workflows.sh[467-527]
- scripts/lib/ring-pins.sh[230-239]

### Implementation guidance
- When `repin_source` is being populated from `existing_content` (meta-repo branch), if `template_requires_s7635_marker "$template"` and `stub_has_s7635_marker` is false, mutate the in-memory `existing_content` to add the canonical marker to the `secrets: inherit` line before writing it to `repin_source`.
- Keep this change narrowly-scoped: only modify the `secrets: inherit` line, preserve all other bespoke content.
- Consider extracting the canonical marker token/string from the template line (or reuse the same literal token) to avoid drift in the marker text.
- Add/extend a bats test to cover SKIP_REPOS + consumer stub missing marker, asserting the planned deployed content includes the marker (i.e., the drift is actually repaired).

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread scripts/deploy-standard-workflows.sh
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 22, 2026
@don-petry

Copy link
Copy Markdown
Contributor Author

Dev-Lead — fix-reviews (applied)

Changes committed and pushed.

@don-petry
don-petry disabled auto-merge July 22, 2026 17:04
@sonarqubecloud

Copy link
Copy Markdown

@don-petry
don-petry enabled auto-merge (squash) July 22, 2026 17:09
@don-petry don-petry added the dev-lead:hands-off Exclude this PR/issue from the dev-lead agent label Jul 22, 2026
@don-petry
don-petry merged commit ab0fa1b into main Jul 22, 2026
30 of 34 checks passed
@don-petry
don-petry deleted the dev-lead/issue-877-20260722-1642 branch July 22, 2026 17:23
don-petry pushed a commit that referenced this pull request Jul 22, 2026
…esolve merge conflict (#877/#878 backport)

Main added `stub_has_s7635_marker`, `is_pin_compliant`, and a new
`is_already_compliant` that checks both pin compliance and S7635 marker
presence. The PR branch defined `template_requires_s7635_marker` with
different semantics (returns true only when the template itself carries
the marker, not for bare `secrets: inherit`). The merge commit resolved
the conflict in favour of main's broader check, causing bats test 70
("false for a bare secrets: inherit line lacking the marker") to fail.

Fix: pull main's infrastructure into the PR branch while keeping the PR's
narrower Option-B `template_requires_s7635_marker` semantics, which tests
68–71 were written to verify. Also backport main's updated test fixtures
for dry-run.bats and emit-vform.bats (marked stubs + #877/#878 tests) so
the local suite matches the 88-test count the CI merge commit runs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev-lead:hands-off Exclude this PR/issue from the dev-lead agent size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[#850] make standards-deploy driver treat a missing S7635 marker as drift (propagate #876 markers to already-pinned consumers)

2 participants