Skip to content

feat: implement issue #1448 — [bug] seed-repo-template fetches standards unpinned — pin to published stable, compliance accepts N-1 (continues #1436) - #1507

Merged
don-petry merged 4 commits into
mainfrom
dev-lead/issue-1448-20260812-2039
Aug 12, 2026
Merged

don-petry merged 4 commits into
mainfrom
dev-lead/issue-1448-20260812-2039

Conversation

@don-petry

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

Copy link
Copy Markdown
Collaborator

User description

Closes #1448

Implemented by dev-lead agent. Please review.


CodeAnt-AI Description

Pin standards inputs and allow controlled N-1 template propagation

What Changed

  • Standards content is fetched from a resolved stable channel or explicit commit/ref instead of an unpinned default branch; the resolved ref and commit are reported.
  • Template drift checks accept files matching the current published version (N) or the immediately preceding version (N-1), while visibly notifying when propagation is pending.
  • Legacy non-major-scoped reusable workflow pins are rejected in both current and preceding standards baselines.
  • Added coverage for pinned fetching, fallback resolution, N/N-1 matching, reporting, notifications, and legacy-pin rejection.

Impact

✅ Reproducible template seeding
✅ Fewer false drift failures during standards promotion
✅ Prevented legacy workflow pins

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

Summary by CodeRabbit

  • New Features

    • Added standards-reference resolution with support for local overrides, explicit pins, published channels, and logged fallback behavior.
    • Added reporting of resolved references and commits for drift analysis.
    • Added N and N-1 template baseline comparison with version-aware results and notices.
    • Added validation for major-scoped reusable workflow pins.
  • Bug Fixes

    • Improved drift reporting, including compatibility with legacy annotations and empty fields.
    • Ensured template content is fetched from the resolved standards reference.
  • Tests

    • Added coverage for reference resolution, pinned content retrieval, baseline matching, reporting, and workflow pin validation.

…rds unpinned — pin to published stable, compliance accepts N-1 (continues #1436)
@don-petry
don-petry requested a review from a team as a code owner August 12, 2026 21: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 12, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 6112e48 Aug 12, 2026 · 21:08 21:10

@codeant-ai

codeant-ai Bot commented Aug 12, 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 12, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 26 minutes

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: 35402906-1891-4ce8-9724-49805317282b

📥 Commits

Reviewing files that changed from the base of the PR and between 6112e48 and 9ffcfe7.

📒 Files selected for processing (4)
  • scripts/seed-repo-template.sh
  • scripts/template_stub_drift.sh
  • tests/template_stub_drift.bats
  • tests/test_seed_repo_template.bats
📝 Walkthrough

Walkthrough

seed-repo-template.sh now resolves and logs explicit standards references. template_stub_drift.sh compares current and N-1 emissions, reports matched versions, and rejects legacy reusable-workflow pins. Bats tests cover resolution, fallback, reporting, classification, notices, and pin validation.

Changes

Standards resolution and drift validation

Layer / File(s) Summary
Resolve and expose standards references
scripts/seed-repo-template.sh, tests/test_seed_repo_template.bats
Standards resolution supports local overrides, explicit refs, published channels, and logged HEAD fallback. Fetches use the resolved ref. --print-ref and tests expose ref, commit, and source details.
Compare versioned emissions and enforce pins
scripts/template_stub_drift.sh
Drift checks compare current and N-1 emissions. Five-field rows identify the matched version. N-1 matches emit notices. Both baselines undergo major-scoped reusable-workflow pin validation.
Validate resolution and drift behavior
tests/template_stub_drift.bats
Tests cover versioned classification, annotations, report metadata, and reusable-workflow pin enforcement.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SeedScript
  participant StandardsAPI
  participant DriftCheck
  participant StubFiles
  SeedScript->>StandardsAPI: Resolve and fetch standards at a pinned ref
  StandardsAPI-->>SeedScript: Return standards content and commit
  DriftCheck->>StandardsAPI: Emit current and N-1 baselines
  StandardsAPI-->>DriftCheck: Return baseline content and refs
  DriftCheck->>StubFiles: Compare expected SHAs
  StubFiles-->>DriftCheck: Return current, N-1, or drift status
  DriftCheck-->>DriftCheck: Validate major-scoped reusable-workflow pins
Loading

Possibly related PRs

Suggested labels: standards-sync

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the implementation but omits the required Interaction contract and Checklist sections from the repository template. Add the required Interaction contract section with N/A selected, then complete the shellcheck and documentation checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the standards pinning and N-1 compliance changes addressed by the pull request.
Linked Issues check ✅ Passed The changes implement explicit standards references, logging, N/N-1 acceptance, propagation notices, and legacy-pin guards required by issue #1448.
Out of Scope Changes check ✅ Passed The scripts and tests changed are directly related to standards pinning, template drift handling, and issue #1448 requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-1448-20260812-2039

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 12, 2026
@don-petry

Copy link
Copy Markdown
Collaborator Author

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

PR: #1507
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-12T21:39:13Z

@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-12T21:39:13Z

@don-petry
don-petry enabled auto-merge (squash) August 12, 2026 21:09
Comment thread scripts/seed-repo-template.sh Outdated

@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 implements a robust N / N-1 acceptance scheme for template stub drift checks, ensuring fetches are pinned to explicit, logged standards refs and preventing unpinned default-branch reads. It also introduces a guard against legacy non-major-scoped reusable pins. The feedback focuses on improving shell script robustness under strict execution flags (avoiding short-circuit conditional execution and SIGPIPE from head commands), enhancing portability by fetching raw contents directly from the GitHub API, fixing a potential blocking stdin read, and utilizing BATS-native temporary directories for cleaner test isolation.

Comment thread scripts/seed-repo-template.sh Outdated
Comment thread scripts/template_stub_drift.sh Outdated
Comment thread scripts/seed-repo-template.sh Outdated
Comment thread scripts/template_stub_drift.sh Outdated
Comment thread tests/template_stub_drift.bats Outdated
Comment thread tests/template_stub_drift.bats Outdated
@don-petry
don-petry disabled auto-merge August 12, 2026 21:11
coderabbitai[bot]
coderabbitai Bot previously requested changes Aug 12, 2026

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/seed-repo-template.sh`:
- Around line 176-184: Update the standards-loading function around the
STANDARDS_DIR branch so that when STANDARDS_DIR is set but the requested file is
absent, it returns an error instead of continuing to the remote API path;
preserve the existing local-file read behavior. Add a regression test covering a
partial STANDARDS_DIR checkout and verifying the missing-file request fails
without an unpinned remote read.
- Around line 180-187: Update the ref-qualified branch in the standards content
retrieval flow around _resolve_standards_ref to include --method GET alongside
the ref field. Preserve the existing no-ref behavior and the current gh api
path, jq extraction, and base64 decoding.

In `@scripts/template_stub_drift.sh`:
- Around line 133-143: Update template_drift_report_header to accept the
canonical standards repository as an argument and use it in the baseline header
instead of TEMPLATE_REPO. Update each call site to pass that repository, and
extend the report-header test to assert the canonical repository identity.
- Around line 278-299: Update the baseline emission handling in the loop around
_template_drift_emit and template_drift_annotate so every required baseline
failure sets guard_rc=1 and records a TSV failure row instead of continuing
silently. Apply this to N failures, and to prev_ref/N-1 failures when
STANDARDS_PREV_REF is configured, while preserving the existing N-only
comparison behavior only when no previous reference is configured.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d398e674-951e-47db-9b7a-034ed5e12e50

📥 Commits

Reviewing files that changed from the base of the PR and between 2dddf8a and 6112e48.

📒 Files selected for processing (4)
  • scripts/seed-repo-template.sh
  • scripts/template_stub_drift.sh
  • tests/template_stub_drift.bats
  • tests/test_seed_repo_template.bats

Comment thread scripts/seed-repo-template.sh
Comment thread scripts/seed-repo-template.sh Outdated
Comment thread scripts/template_stub_drift.sh
Comment thread scripts/template_stub_drift.sh
@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

@coderabbitai resolve

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-reviews (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) August 12, 2026 21:19
@donpetry-bot
donpetry-bot dismissed coderabbitai[bot]’s stale review August 12, 2026 21:19

Auto-dismissed (#617): coderabbitai[bot] CHANGES_REQUESTED on a superseded commit. The bot re-reviews the new head automatically — a valid concern will return as a fresh review.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 12, 2026
@don-petry
don-petry disabled auto-merge August 12, 2026 21:20
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
✅ Action performed

Comments resolved and changes approved.

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

@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 — waiting on PR blockers (intent: review-changes)

PR: #1507
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-12T22:04:10Z

@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-12T22:04:10Z

@don-petry
don-petry enabled auto-merge (squash) August 12, 2026 21:34
Comment thread scripts/template_stub_drift.sh Outdated
@don-petry
don-petry disabled auto-merge August 12, 2026 21:37
donpetry-bot
donpetry-bot previously approved these changes Aug 12, 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: f9b6329aba825c241709fb770af6cca3dd42f92a
Review mode: triage-approved (single reviewer)

Summary

PR #1507 pins standards fetching in seed-repo-template.sh to an explicit, logged ref (STANDARDS_REF/STANDARDS_CHANNEL with a documented HEAD-SHA fallback per AC #10), adds N/N-1 acceptance to the template drift check with a visible propagation notice (AC #8), and adds a legacy non-major-scoped pin guard (AC #9). All ACs of #1448 that live in this repo are substantively addressed, CI is fully green, and all 11 review threads are resolved.

Linked issue analysis

Closes #1448 (ACs 7-10, continuing #1436). AC #7: _fetch_standard now always passes an explicit ?ref= (resolved channel > explicit STANDARDS_REF > HEAD commit SHA fallback), and the resolved ref+SHA+source are logged and surfaced in the drift report header via the new --print-ref subcommand. AC #8: template_drift_classify/row5 accept N or N-1; an N-1 match emits a ::notice:: (propagation pending), not a silent pass. AC #9: template_drift_assert_major_scoped rejects pre-#1184 bare-tier reusable pins in both N and N-1 baselines, with positive+negative tests. AC #10: when the corpus channel is unpublished, the fetch resolves the default-branch HEAD to a concrete logged SHA — never an unpinned read. The cross-repo step-1 prerequisite (publishing standards/v1-stable in petry-projects/.github) is correctly treated as a tracked dependency; the head-fallback keeps this PR valuable before it lands.

Findings

No blocking findings. Notable quality points: (1) the || true → || content="" fix closes a real defect where a gh api 404 JSON body was captured as content and bypassed the empty-content guard — now regression-tested for workflow, gitleaks, and dependabot paths; (2) template_drift_annotate switched to explicit tab-peeling to avoid IFS whitespace-collapsing on empty fields, and stays backward-compatible with 4-field rows. Non-blocking notes: (a) in template_stub_drift.sh main, the IFS=$'\t' read of --print-ref output would collapse an empty middle (SHA) field, shifting n_src into n_sha — cosmetic only (report header wording) since n_ref remains correct and is what pins the child emits; (b) when STANDARDS_DIR is set but a file is absent locally, _fetch_standard still falls through to an unpinned API read (pre-existing test-seam behavior, unchanged by this PR). Secret-scanning MCP tool unavailable in this environment; gitleaks CI check passed.

CI status

All required checks green: shellcheck, bats, unit-tests, Lint, actionlint, CodeQL (actions+python), SonarCloud quality gate, Secret scan (gitleaks), agent-shield, template-drift, caller-stub-freeze, and all validate-* checks SUCCESS. The two CANCELLED 'review / review' runs are this review cascade's own superseded runs and are not code-quality signals. All 11 review threads resolved; CodeRabbit review dismissed/resolved; no changes-requested reviews outstanding.


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

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 12, 2026
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-reviews (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) August 12, 2026 21:41
@don-petry
don-petry disabled auto-merge August 12, 2026 21:42
@sonarqubecloud

Copy link
Copy Markdown

@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 — waiting on PR blockers (intent: review-changes)

PR: #1507
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-12T22:16:02Z

@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-12T22:16:02Z

@don-petry
don-petry enabled auto-merge (squash) August 12, 2026 21:46

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

Summary

Implements issue #1448 (ACs 7–10): pins the standards fetch in seed-repo-template.sh to a resolved, logged ref (explicit STANDARDS_REF → published channel STANDARDS_CHANNEL → HEAD commit SHA fallback per AC #10), teaches template_stub_drift.sh to accept N or N-1 published versions with a visible ::notice:: on N-1 matches, and adds the AC #9 guard rejecting pre-#1184 legacy non-major-scoped reusable pins in either baseline. Also fixes a real latent bug: '|| true' → '|| content=""' so a gh api 404 JSON body can no longer be silently shipped as expected content (with regression tests). 4 files, +481/−27, all logic covered by new bats tests.

Linked issue analysis

Closes #1448. All four acceptance criteria are substantively addressed: AC #7 (explicit resolved ref, logged and reported via --print-ref and the drift report header), AC #8 (N/N-1 classify with matched-version column and visible propagation notice), AC #9 (major-scoped pin guard applied to both N and N-1 emissions, failing the job on any legacy pin), AC #10 (HEAD-fallback resolves and logs a concrete commit SHA while the corpus-level publication channel is unpublished, keeping runs explainable). The issue's blocking-prerequisite warning is respected — the default channel standards/v1-stable is only used if it actually resolves; otherwise the fetch stays on a logged HEAD SHA rather than pinning to a stale tag.

Findings

No blocking findings. Non-blocking observations: (1) in template_stub_drift.sh main(), 'IFS=$'''\t''' read … < <(… --print-ref …)' will exit the script without a message under set -e if the seed script hard-crashes and emits nothing — the job would fail anyway, but less explainably; (2) the STANDARDS_DIR test seam still falls back to an unpinned contents-API read when a file is absent from the local checkout (pre-existing seam behavior, test-only); (3) empty-array expansion "${ref_q[@]}" under set -u requires bash ≥ 4.4 — fine on Actions runners. Manual tab-field peeling in template_drift_annotate correctly preserves empty fields on MISSING rows, and the legacy-pin regex cannot false-positive on major-scoped v- refs. No secrets, no injection vectors, no workflow/permission changes. The run_secret_scanning MCP tool was not available in this session; the gitleaks CI check passed.

CI status

All required checks green at 9ffcfe7: shellcheck, ShellCheck, bats, unit-tests, Lint, CodeQL (actions + python), SonarCloud quality gate, gitleaks secret scan, agent-shield, actionlint, template-drift, caller-stub-freeze, all validate-* jobs. Three CANCELLED 'review / review' entries are superseded runs of this review cascade cancelled by newer pushes — not code-related failures. No unresolved review threads (verified via GraphQL); CodeRabbit threads resolved and prior bot reviews dismissed after fixes.


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

@don-petry
don-petry merged commit ca918ee into main Aug 12, 2026
43 of 46 checks passed
@don-petry
don-petry deleted the dev-lead/issue-1448-20260812-2039 branch August 12, 2026 21:49
@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-08-12T22:50:15Z.

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

Development

Successfully merging this pull request may close these issues.

[bug] seed-repo-template fetches standards unpinned — pin to published stable, compliance accepts N-1 (continues #1436)

2 participants