feat(ci): add CHANGELOG and exports map completeness gates#673
Conversation
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>
There was a problem hiding this comment.
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-gatejob to requireCHANGELOG.mdupdates when SDK/CLI source files change (with feature flag + skip label). - Adds an
exports-map-checkjob plusscripts/check-exports-map.mjsto detect missingpackage.jsonexportsentries 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>
|
@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. |
|
so @diberry this is ready to merge? seems it has some opens |
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>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@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>
|
Fixed all 4 Copilot review findings:
|
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>
|
Fixed -- added .sort() to barrelDirs for deterministic CI output across platforms. |
|
@bradygaster Copilot is happy. |
…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>
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>
Part 2 of 2: PR Completeness Gates (Repo Health)
What
Adds two automated CI enforcement gates to squad-ci.yml:
packages/squad-sdk/src/orpackages/squad-cli/src/, the CI requiresCHANGELOG.mdto also appear in the diff. Prevents SDK/CLI changes from shipping without changelog documentation.scripts/check-exports-map.mjs) reads allsrc/*/index.tsbarrel files in squad-sdk and verifies each has a corresponding entry inpackage.jsonexports. Catches missing subpath exports before they cause consumer import failures.Why
Part 1 (PR #108 / upstream #672) added
PR_REQUIREMENTS.mdandPULL_REQUEST_TEMPLATE.mdto 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
squad-ci.yml(run in parallel with existing jobs)vars.SQUAD_CHANGELOG_CHECKorvars.SQUAD_EXPORTS_CHECKis set tofalse(enabled by default)skip-changelogandskip-exports-checkcheck-exports-map.mjsuses only Node.js built-ins (fs, path) -- zero dependenciesRelated Issues
Testing
scripts/check-exports-map.mjstested locally -- correctly identifies 5 barrel directories (platform, remote, roles, streams, upstream) that exist insrc/*/index.tsbut lackpackage.jsonexport entriesnpm run buildsucceedsPreflight
npm run build-- passesnpm 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.