Skip to content

feat(ci): add CHANGELOG and exports map completeness gates#673

Merged
tamirdresher merged 9 commits intobradygaster:devfrom
diberry:squad/104-pr-completeness-gates-upstream
Mar 29, 2026
Merged

feat(ci): add CHANGELOG and exports map completeness gates#673
tamirdresher merged 9 commits intobradygaster:devfrom
diberry:squad/104-pr-completeness-gates-upstream

Conversation

@diberry
Copy link
Copy Markdown
Collaborator

@diberry diberry commented Mar 28, 2026

Part 2 of 2: PR Completeness Gates (Repo Health)

What

Adds two automated CI enforcement gates to squad-ci.yml:

  1. CHANGELOG gate -- If a PR changes files in packages/squad-sdk/src/ or packages/squad-cli/src/, the CI requires CHANGELOG.md to also appear in the diff. Prevents SDK/CLI changes from shipping without changelog documentation.
  2. Exports map check -- A new script (scripts/check-exports-map.mjs) reads all src/*/index.ts barrel files in squad-sdk and verifies each has a corresponding entry in package.json exports. Catches missing subpath exports before they cause consumer import failures.

Why

Part 1 (PR #108 / upstream #672) added PR_REQUIREMENTS.md and PULL_REQUEST_TEMPLATE.md to document what a complete PR looks like. Part 2 enforces two of those requirements with automated CI checks that give immediate feedback rather than relying on human reviewers to catch missing entries.

How

  • Both gates are implemented as separate jobs in squad-ci.yml (run in parallel with existing jobs)
  • Both are feature-flagged: disabled when vars.SQUAD_CHANGELOG_CHECK or vars.SQUAD_EXPORTS_CHECK is set to false (enabled by default)
  • Both support per-PR skip labels: skip-changelog and skip-exports-check
  • The CHANGELOG gate only applies when SDK/CLI source files are in the diff
  • The exports check only applies when SDK source files are in the diff
  • check-exports-map.mjs uses only Node.js built-ins (fs, path) -- zero dependencies

Related Issues

Testing

  • scripts/check-exports-map.mjs tested locally -- correctly identifies 5 barrel directories (platform, remote, roles, streams, upstream) that exist in src/*/index.ts but lack package.json export entries
  • Build passes: npm run build succeeds
  • Tests pass: 179/183 test files pass (5024 tests), 4 pre-existing integration test failures unrelated to this change (aspire-integration, cli-packaging-smoke, human-journeys, speed-gates)

Preflight

  • npm run build -- passes
  • npm test -- passes (183 suites, 5024 tests passed, 117s runtime; 4 pre-existing integration failures)

Breaking Changes

None. Both gates are additive CI jobs and do not affect existing jobs.

Waivers

None required. Feature flags and skip labels provide escape hatches for all gates.

Part 2 of 2 for repo health. Adds two automated CI enforcement gates to squad-ci.yml:

1. CHANGELOG gate -- requires CHANGELOG.md update when SDK/CLI source changes
2. Exports map check -- verifies package.json exports match barrel files

Both feature-flagged (vars.SQUAD_CHANGELOG_CHECK, vars.SQUAD_EXPORTS_CHECK) with skip labels. Includes test coverage for check-exports-map.mjs.

Refs #104

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 28, 2026 23:41
@diberry diberry marked this pull request as draft March 28, 2026 23:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds CI enforcement gates to ensure PR completeness for SDK/CLI changes by requiring changelog updates and validating @bradygaster/squad-sdk subpath exports against src/*/index.ts barrel directories.

Changes:

  • Adds a changelog-gate job to require CHANGELOG.md updates when SDK/CLI source files change (with feature flag + skip label).
  • Adds an exports-map-check job plus scripts/check-exports-map.mjs to detect missing package.json exports entries for SDK barrel directories (with feature flag + skip label).
  • Adds a Vitest test that executes the new exports-map checker script and validates its structured output.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
test/check-exports-map.test.ts Adds a smoke test ensuring the exports-map checker script runs and emits expected output.
scripts/check-exports-map.mjs Implements the exports-vs-barrel-directory completeness check for packages/squad-sdk.
.github/workflows/squad-ci.yml Adds two new CI jobs (changelog gate + exports map check) with feature flags and skip-label escape hatches.

…missions

- Fix runScript() to reject on spawn errors instead of masking as exit code 1
- Replace gh pr view label checks with github.event payload labels
- Eliminates need for pull-requests: read permission

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@diberry diberry marked this pull request as ready for review March 29, 2026 00:09
@diberry
Copy link
Copy Markdown
Collaborator Author

diberry commented Mar 29, 2026

@bradygaster -- Same as #672 -- I'm iterating on how Squad interacts with Copilot code review. Most of Copilot's suggestions and comments resulted in changes to this PR. This is Part 2 of the repo health work (CI completeness gates). CI is green and ready to merge when you are.

@bradygaster
Copy link
Copy Markdown
Owner

so @diberry this is ready to merge? seems it has some opens

diberry pushed a commit to diberry/squad that referenced this pull request Mar 29, 2026
Remove changelog-gate and exports-map-check from this PR's diff.
Those gates are in PR bradygaster#673. This PR should only add samples-build.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@diberry diberry requested a review from Copilot March 29, 2026 02:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@diberry
Copy link
Copy Markdown
Collaborator Author

diberry commented Mar 29, 2026

@copilot apply changes based on the comments in this thread

- Replace substring-based label checks (contains+join) with exact
  match (contains on labels.*.name) for skip-changelog and
  skip-exports-check labels
- Refactor check-exports-map tests to run script once in beforeAll

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@diberry
Copy link
Copy Markdown
Collaborator Author

diberry commented Mar 29, 2026

Fixed all 4 Copilot review findings:

  1. skip-changelog: switched from substring to exact label match (accepted suggestion verbatim)
    2-3. skip-exports-check: same fix applied to both step conditions
  2. test/check-exports-map.test.ts: refactored to run script once in beforeAll

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

diberry and others added 3 commits March 28, 2026 19:36
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
readdirSync() ordering varies across platforms. Sort the list so
missing-barrel reports are stable and diffable.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@diberry
Copy link
Copy Markdown
Collaborator Author

diberry commented Mar 29, 2026

Fixed -- added .sort() to barrelDirs for deterministic CI output across platforms.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@diberry
Copy link
Copy Markdown
Collaborator Author

diberry commented Mar 29, 2026

@bradygaster Copilot is happy.

@tamirdresher tamirdresher merged commit 8abd106 into bradygaster:dev Mar 29, 2026
5 checks passed
tamirdresher pushed a commit that referenced this pull request Mar 29, 2026
…eed heuristic

- Fix sample count: 11 → 9 (actual count in samples/ directory)
- Mark samples-build and changelog/exports gates as pending merge (#673, #674)
- Add concrete heuristic for bleed check (scope by packages/ directory)
- Clarify bash snippet as reference commands, not literal agent execution

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
diberry pushed a commit to diberry/squad that referenced this pull request Mar 29, 2026
Remove changelog-gate and exports-map-check from this PR's diff.
Those gates are in PR bradygaster#673. This PR should only add samples-build.

Co-authored-by: Copilot <223556219+Copilot@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.

4 participants