Skip to content

ci: scope new-service pull requests to their own integration suite - #805

Merged
Sarath1018 merged 3 commits into
mainfrom
ci/scope-ignore-package-json
Oct 5, 2026
Merged

Sarath1018 merged 3 commits into
mainfrom
ci/scope-ignore-package-json

Conversation

@Sarath1018

@Sarath1018 Sarath1018 commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #775 and #802. A new-service pull request such as #664 still ran the full integration suite, because files outside the domain folders change on every such PR. Each now has a rule:

Changed file Before Now
package.json (exports, scripts, version) everything nothing. A dependency change or version bump still runs everything, through package-lock.json.
tests/utils/ (unit-test fixtures and helpers; tests/unit/ was already ignored) everything except mocks/ nothing. Four fixture files under tests/utils/constants/ (agents.ts, memory.ts, http.ts, common.ts) are read by integration suites, so a fixture-only edit is knowingly uncovered until the weekly run or the next change to that suite.
tests/integration/config/unified-setup.ts when the change only adds lines, which is how a service is registered everything the always-on suites, which load the file. An edit that removes or changes a line still runs everything.
scripts/ everything nothing. It is CI and release tooling (API-surface check, sample builds, docs, release metadata, this resolver); nothing there takes part in an integration run, and each script has its own unit tests. A broken resolver fails the fail-closed integration-scope job.

Mechanics: --base now reads git diff --numstat, so the resolver knows which changed files only gained lines (parseNumstat, an additive set threaded through resolveArgs → resolveScope → classify). --files has no such information and keeps the conservative behaviour.

Verified against #664 (feat/platform-groups, rebased on main): scope=platform, with unified-setup.ts only adds lines (a service registration); the always-on suites load it in the log. Dry runs on single files:

File Resolves to
tests/utils/constants/platform.ts none
tests/utils/setup.ts none
package.json none
package.json + package-lock.json all

Accepted trade-offs, stated in the README: an edit to an npm script in package.json is not covered by a pull-request run; an additions-only edit to the registry that changes behaviour for one domain is covered only by the always-on suites; a fixture-only edit under tests/utils/ is not covered. Core, workflow and tests/integration/config changes other than that still run everything.

Docs: tests/integration/README.md ("Which suites run on a pull request").

Test plan

🤖 Generated with Claude Code

A new-service PR still ran every suite because three files outside the
domain folders change on each one:

- package.json (exports, scripts, version) is ignored. A dependency
  change or version bump still runs everything through package-lock.json.
- tests/utils/constants/<name>.ts is scoped like src/services/<name>/
  when <name> is a suite domain; common.ts and entity-named files still
  run everything.
- tests/integration/config/unified-setup.ts, where services are
  registered, runs only the always-on suites when the change only adds
  lines (learned from `git diff --numstat`); any other edit runs
  everything. The always-on suites load the file.

A drift guard fails when a domain-named constants file is used by another
suite. It found the observability agent-traces suite using agent fixtures
from agents.ts; those now live in common.ts as TEST_AGENT, which
AGENT_TEST_CONSTANTS references so the unit tests are unchanged.

Verified against #664 (feat/platform-groups): scope=platform.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@Sarath1018
Sarath1018 requested a review from a team October 5, 2026 10:24
@claude

claude Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

Everything under scripts/ is CI and release tooling (API-surface check,
sample builds, docs, release metadata, the scoping resolver itself);
nothing there takes part in an integration run, and each script has its
own unit tests. A broken resolver fails the fail-closed integration-scope
job rather than skipping anything silently.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@claude

claude Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

tests/unit was already ignored; tests/utils holds unit-test fixtures and
helpers. Four fixture files under tests/utils/constants are read by the
agents, http and observability suites, so a fixture-only edit is knowingly
uncovered until the weekly run or the next change to that suite.

This supersedes the by-name rule for tests/utils/constants/<name>.ts and
its drift guard, and reverts the TEST_AGENT fixture move they required.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@claude

claude Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

@sonarqubecloud

sonarqubecloud Bot commented Oct 5, 2026

Copy link
Copy Markdown

@Sarath1018
Sarath1018 merged commit 8e39b3e into main Oct 5, 2026
25 checks passed
@Sarath1018
Sarath1018 deleted the ci/scope-ignore-package-json branch October 5, 2026 11:07

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

Copilot review overview

🟢 Approval recommended

The changes match the intended trade-offs, with only a minor documentation inconsistency remaining.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Refines integration-test scoping so new-service PRs run their relevant suites rather than the full suite.

Changes:

  • Ignores package metadata, scripts, and test helpers.
  • Uses diff statistics to limit additions-only registry changes to always-on suites.
  • Updates resolver tests and documents coverage trade-offs.
File Description
tests/​unit/​scripts/​integration-scope.test.ts Tests exclusions, registry scoping, and diff parsing.
tests/​integration/​README.md Documents scoping rules and accepted coverage gaps.
scripts/​integration-scope.mjs Implements exclusions and additions-only detection.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +663 to +665
`tests/utils/` is ignored as a whole although a few fixture values under
`tests/utils/constants/` are read by the agents, http and observability suites, so a
fixture-only edit is not covered until the weekly run or the next change to that suite.
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