Skip to content

fix(ci): expand changelog gate to cover template and scaffolding paths#1195

Merged
bradygaster merged 6 commits into
bradygaster:devfrom
obit91:squad/1156-changelog-gate-template-paths
Jun 6, 2026
Merged

fix(ci): expand changelog gate to cover template and scaffolding paths#1195
bradygaster merged 6 commits into
bradygaster:devfrom
obit91:squad/1156-changelog-gate-template-paths

Conversation

@obit91

@obit91 obit91 commented May 30, 2026

Copy link
Copy Markdown
Contributor

Summary

The changelog-gate job in .github/workflows/squad-ci.yml computed SDK_CLI_CHANGED using a pattern that only matched ^packages/squad-(sdk|cli)/src/. As a result, PRs that touched bundled templates, scaffolding, or agent files bypassed the changeset requirement silently.

This change expands the SDK_CLI_CHANGED grep pattern to also match:

  • packages/squad-(sdk|cli)/templates/
  • .squad-templates/
  • templates/

The two related summary/echo strings were updated to accurately reflect that the gate now also covers template changes ("no SDK/CLI source or template changes" / "SDK/CLI source or template files changed:"). No other logic was changed.

Closes #1156

Scope

  • repo-health change ΓÇö touches only .github/workflows/squad-ci.yml.
  • No product source modified (packages/*/src/ untouched).
  • No changeset required (does not modify packages/squad-sdk/src or packages/squad-cli/src).

Testing

  • Sanity-tested the new grep -E pattern against sample paths: packages/squad-sdk/src/z.ts, packages/squad-cli/templates/y.md, .squad-templates/foo.md, and templates/skills/x/SKILL.md all match, while README.md does not match.
  • Validated the workflow YAML remains well-formed (js-yaml parse ΓåÆ YAML OK).
  • npm run build passes from the repo root (YAML-only change, build unaffected).

Real-world example: PR #1035

#1035 ("fix: context overflow sentinel and coordinator size reduction", merged 2026-05-22) is a concrete case of this gap:

  • It changed 30+ template/scaffolding files across packages/squad-cli/templates/, packages/squad-sdk/templates/, .squad-templates/, and templates/ (~2,000+ lines), plus packages/squad-cli/package.json.
  • It touched zero packages/squad-(sdk|cli)/src/ files.
  • Under the old src/-only gate, SDK_CLI_CHANGED matched nothing -> the Changelog Gate reported "Not applicable" and passed -> no changeset was required or added, even though substantial shipped template content changed.
  • With this PR's widened gate, a change like fix: context overflow sentinel and coordinator size reduction #1035 would correctly require a changeset (or CHANGELOG.md update, or the skip-changelog label).

Automated gate test (added in this PR)

Added test/ci/changelog-gate.test.ts (vitest) to lock in the widened gate and guard #1156 against regression.

  • Reads the live SDK_CLI_PATH_REGEX directly from .github/workflows/squad-ci.yml (single source of truth), builds a JS RegExp, and asserts a table of paths. If the regex variable is renamed/removed, the suite fails loudly.
  • 8 governed paths must match (gate requires a changeset): packages/squad-sdk/src/, packages/squad-cli/src/, both packages/squad-(sdk|cli)/templates/ trees, .squad-templates/, and top-level templates/.
  • 7 unrelated paths must not match (gate stays silent): README.md, docs/..., .github/workflows/squad-ci.yml, package.json, packages/squad-cli/package.json (boundary case — not under src//templates/), scripts/..., and the test file itself.
  • Runs under npm test (vitest run, which only collects test/**/*.test.ts). npx vitest run test/ci/changelog-gate.test.ts -> 15 passed; npm run build passes.

@obit91
obit91 marked this pull request as ready for review May 30, 2026 16:36
Copilot AI review requested due to automatic review settings May 30, 2026 16:36

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the Squad CI workflow to also treat template changes as “SDK/CLI changes” that require a changeset or a CHANGELOG update.

Changes:

  • Expands the path filter from only packages/squad-(sdk|cli)/src/ to also include template directories.
  • Updates step-summary and error messaging to reflect the broader “source or template” scope.

Comment thread .github/workflows/squad-ci.yml Outdated
Comment thread .github/workflows/squad-ci.yml Outdated
@obit91

obit91 commented May 30, 2026

Copy link
Copy Markdown
Contributor Author

✅ Added a regression test for the changelog gate

Per review request, this PR now includes an automated suite that verifies the gate actually catches the paths it's supposed to.

New file: test/ci/changelog-gate.test.ts (vitest)

How it works: the test reads the live SDK_CLI_PATH_REGEX from .github/workflows/squad-ci.yml (so it can't drift from the real gate), compiles it to a JS RegExp, and asserts a table of cases:

Class Examples Expected
Governed (8 cases) packages/squad-sdk/src/index.ts, packages/squad-cli/src/cli/core/bootstrap.ts, packages/squad-{sdk,cli}/templates/..., .squad-templates/..., templates/... match -> changeset required
Unrelated (7 cases) README.md, docs/..., .github/workflows/squad-ci.yml, package.json, packages/squad-cli/package.json, scripts/..., the test file no match -> not gated

If anyone renames/removes the regex variable or narrows it (re-opening the #1156 gap), the suite fails. Runs under npm test.

npx vitest run test/ci/changelog-gate.test.ts -> 15 passed; npm run build passes.

Commit: bd3c9ac

@obit91

obit91 commented May 30, 2026

Copy link
Copy Markdown
Contributor Author

Added a changeset documenting this PR's changelog-gate scope widening. It records a patch bump for @bradygaster/squad-cli because template/scaffolding changes were previously able to ship without release-note entries; the widened gate ensures those user-facing template updates are no longer omitted.

@obit91

obit91 commented May 30, 2026

Copy link
Copy Markdown
Contributor Author

cc @tamirdresher @bradygaster — heads up: this PR changes how the changelog/changeset gate behaves, which affects what lands in release notes going forward.

What changes:

  • The Changelog gate in .github/workflows/squad-ci.yml previously required a changeset only for packages/squad-(sdk|cli)/src/ changes. It now also covers template/scaffolding paths: packages/squad-(sdk|cli)/templates/, .squad-templates/, and top-level templates/.
  • Net effect: user-facing template/scaffolding changes will now require a changeset and therefore show up in release notes, instead of being silently omitted.
  • Added a regression test (test/ci/changelog-gate.test.ts) and a changeset documenting the change itself.

Flagging since this alters contributor workflow (more PRs will be asked for a changeset) and the release-note pipeline. Closes #1156.

@tamirdresher

Copy link
Copy Markdown
Collaborator

Good use of #1035 as the regression example — that kind of real-world evidence makes the case much cleaner than a hypothetical. The test-reads-live-regex approach is the right call.

A few things before this lands.

.squad/agents/*/charter.md isn't in the regex.

Issue #1156 explicitly called that path out as a bypass path. The current SDK_CLI_PATH_REGEX doesn't match .squad/agents/troi/charter.md or anything else under .squad/agents/. So strictly speaking, #1156 isn't fully closed by this PR. Either add |^\.squad/agents/.+/charter\.md$ to the regex here, or open a follow-up issue and link it from #1156 — just don't close the issue until one of those happens.

The "full canonical mirror" comment is wrong.

The diff says: "The top-level templates/ tree is a full canonical mirror of .squad-templates/ (see scripts/sync-templates.mjs)". It isn't. sync-templates.mjs copies from .squad-templates/ into templates/ but never deletes, so templates/ is an append-only superset. Right now it has four files that have no counterpart in .squad-templates/: ghost-protocol.md, loop.md, personal-charter.md, and skills/rework-rate/SKILL.md. The gating is still correct — all four are governed scaffolding and should be behind the gate — but that comment is going to give the next reader a wrong mental model. Something like "primary sync target of .squad-templates/ — entire tree is governed scaffolding" would be accurate.

CONTRIBUTING.md is now out of date.

Lines 190 and 217 both still say the changeset gate applies only to packages/squad-(sdk|cli)/src/. Worth updating in this PR so the docs and the actual gate match, otherwise contributors are going to wonder why their template-only change is asking for a changeset.

One test hygiene note.

In changelog-gate.test.ts, line 17 calls expect(patternMatch, ...).not.toBeNull() at module scope — outside any describe or it block. That assertion runs during vitest''s collection phase. If SDK_CLI_PATH_REGEX ever gets renamed in the YAML, the failure surfaces as "failed to collect tests" instead of a readable assertion error. Two-line fix: wrap it in beforeAll. Not a blocker, but it''s the kind of pattern that gets copied into other CI tests.

Fix the first three; the fourth is up to you but I''d do it. Core logic is sound, changeset is appropriate.

obit91 added a commit to obit91/squad that referenced this pull request Jun 6, 2026
Address review on bradygaster#1195:
- Add .squad/agents/*/charter.md to SDK_CLI_PATH_REGEX (final bradygaster#1156 bypass path)
- Correct the templates/ comment: append-only superset of .squad-templates/, not a full mirror
- Update CONTRIBUTING.md changeset-gate scope to match the widened gate
- Wrap the regex-presence assertion in beforeAll so YAML drift surfaces as a readable failure
- Extend the gate test with governed/unrelated .squad/agents cases

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #1195

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 4
Files added 2
Files modified 2
Files deleted 0
Modules touched 3

🎯 Risk Factors

  • 4 files changed (≤5 → LOW)
  • 3 modules touched (2-4 → MEDIUM)

📦 Modules Affected

ci-workflows (1 file)
  • .github/workflows/squad-ci.yml
root (2 files)
  • .changeset/widen-changelog-gate-template-paths.md
  • CONTRIBUTING.md
tests (1 file)
  • test/ci/changelog-gate.test.ts

This report is generated automatically for every PR. See #733 for details.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit 7240262

PR Scope: 🔧 Infrastructure

⚠️ 3 item(s) to address before review

Status Check Details
Single commit 6 commits — consider squashing before review
Not in draft Ready for review
Branch up to date Up to date with dev
Copilot review No Copilot review yet — it may still be processing
Changeset present Changeset file found
Scope clean No .squad/ or docs/proposals/ files
No merge conflicts No merge conflicts
Copilot threads resolved 0 active Copilot thread(s) resolved (2 outdated skipped)
CI passing 7 check(s) still running

Files Changed (4 files, +84 −8)

File +/−
.changeset/widen-changelog-gate-template-paths.md +7 −0
.github/workflows/squad-ci.yml +10 −4
CONTRIBUTING.md +4 −4
test/ci/changelog-gate.test.ts +63 −0

Total: +84 −8


This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

@github-actions

github-actions Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

🏗️ Architectural Review

⚠️ Architectural review: 1 info.

Severity Category Finding Files
ℹ️ info template-sync Template files changed in .github/workflows/ but not in other template locations. If these templates should stay in sync, consider updating the others too. Changed: .github/workflows/, Unchanged: templates/, .squad-templates/, packages/squad-cli/templates/

Automated architectural review — informational only.

@obit91

obit91 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @tamirdresher — all addressed in 831cea8.

  1. .squad/agents/*/charter.md now gated. Added |^\.squad/agents/.+/charter\.md$ to SDK_CLI_PATH_REGEX, so the last fix(ci): changelog gate misses scaffolding and template file changes - only guards src/ #1156 bypass path is covered. Extended the regression suite with a governed case (.squad/agents/troi/charter.md → matches) plus unrelated negatives (.squad/agents/troi/notes.md, .squad/routing.md → don't match). fix(ci): changelog gate misses scaffolding and template file changes - only guards src/ #1156 is now fully closed.
  2. Fixed the misleading comment. Reworded to describe templates/ as the primary sync target of .squad-templates/ — an append-only superset whose entire tree is governed scaffolding, instead of "full canonical mirror".
  3. CONTRIBUTING.md updated. Both the contributor handoff note (~L190) and the PR Readiness Checklist row (~L217) now list the template/scaffolding paths (packages/squad-(sdk|cli)/templates/, .squad-templates/, top-level templates/, .squad/agents/*/charter.md) alongside src/, matching the actual gate.
  4. Test hygiene. Moved the module-scope expect(...).not.toBeNull() into beforeAll so a renamed/removed regex surfaces as a readable assertion rather than a "failed to collect tests" error.

Also refreshed the changeset to mention the charter path. npx vitest run test/ci/changelog-gate.test.ts → 18 passed; YAML validated; build green.

obit91 and others added 6 commits June 6, 2026 18:58
The changelog-gate job only matched packages/squad-(sdk|cli)/src/, so PRs
touching bundled templates, scaffolding, and agent files bypassed the
changeset requirement silently. Expand the SDK_CLI_CHANGED pattern to also
match packages/squad-(sdk|cli)/templates/, .squad-templates/, and templates/,
aligning CI enforcement with CONTRIBUTING.md.

Closes bradygaster#1156

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Follows up bradygaster#1156: the changelog gate now also fires on template/scaffolding path changes, so the failure message should mention template files, not only source.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address PR review feedback on the changelog gate: consolidate the grep -E alternation into a single SDK_CLI_PATH_REGEX variable for readability and safer extension, and document why the whole top-level templates/ tree is governed (it is a canonical mirror of .squad-templates/ per scripts/sync-templates.mjs). No behavioral change.

Closes bradygaster#1156

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add test/ci/changelog-gate.test.ts, which reads the live SDK_CLI_PATH_REGEX from .github/workflows/squad-ci.yml and asserts a table of governed paths (src/ + all template trees) match the gate while unrelated paths (docs, root configs, package.json) do not. The test extracts the pattern from the workflow itself so it stays in sync with the gate. Guards the fix for bradygaster#1156 against regression.

Closes bradygaster#1156

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Closes bradygaster#1156

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address review on bradygaster#1195:
- Add .squad/agents/*/charter.md to SDK_CLI_PATH_REGEX (final bradygaster#1156 bypass path)
- Correct the templates/ comment: append-only superset of .squad-templates/, not a full mirror
- Update CONTRIBUTING.md changeset-gate scope to match the widened gate
- Wrap the regex-presence assertion in beforeAll so YAML drift surfaces as a readable failure
- Extend the gate test with governed/unrelated .squad/agents cases

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@obit91
obit91 force-pushed the squad/1156-changelog-gate-template-paths branch from 831cea8 to 7240262 Compare June 6, 2026 15:59
@bradygaster
bradygaster merged commit 9d0c8d3 into bradygaster:dev Jun 6, 2026
14 checks passed
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.

fix(ci): changelog gate misses scaffolding and template file changes - only guards src/

4 participants