Repository navigation
Gate: scope per-server stages to touched servers, run each suite once, lighter draft gate - #5761
Conversation
The pre-push gate ran every test suite twice (the plain pass in each workspace's `validate` and in `validate:py`, then the same suites under coverage) and ran every server whatever a change touched. - `scripts/gate-servers.mjs` runs the per-server stages once, for the servers the change touches: each TypeScript workspace's new `check` (its `validate` without the tests) then `coverage`, `validate:py --no-pytest` then `coverage:py`, then the smoke. It prints the servers it chose and why. `scripts/lib/gate-scope.mjs` holds the rule: a change confined to `src/<server>/` gates those servers; any other file gates every server. - `npm run local:gate:draft` (under the same lease) is the gate for a push to a draft PR: `verify:dco` and the touched servers' `validate`. - CI: `typescript.yml` and `python.yml` run each suite once (the Node 24 validate leg and the Python test leg leave the suite to coverage), and a new `draft` job skips coverage and the smoke on a draft PR's pushes; the interface diff and the image smoke skip drafts too. `ready_for_review` runs what a draft skipped. - The workflow guard's tests read the per-server plan, so "the gate runs every check CI runs" stays enforced. - AGENTS.md, docs/quality-gate.md, CONTRIBUTING.md and the pre-push-gate and pr-flow skills describe the new rules. Closes #5759 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
GATE_BASE scoped only the per-server stages; interface-diff and image-smoke still compared against origin/v2/main, so on a stacked branch they could select a server the per-server stages never set up (a Python server with no .venv). resolveBase now falls back to GATE_BASE when no --base is given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
|
|
| Tools | Prompts | Resources | Resource templates | |
|---|---|---|---|---|
| Base | 1 | 0 | 0 | 0 |
| Head | 1 | 0 | 0 | 0 |
Updated by this run for 5d7b27e8cce8198d6bdedb944693a48b01bc5995.
|
| Tools | Prompts | Resources | Resource templates | |
|---|---|---|---|---|
| Base | 16 | 0 | 0 | 1 |
| Head | 16 | 0 | 0 | 1 |
Updated by this run for 5d7b27e8cce8198d6bdedb944693a48b01bc5995.
|
| Tools | Prompts | Resources | Resource templates | |
|---|---|---|---|---|
| Base | 9 | 0 | 1 | 0 |
| Head | 9 | 0 | 1 | 0 |
Updated by this run for 5d7b27e8cce8198d6bdedb944693a48b01bc5995.
|
| Tools | Prompts | Resources | Resource templates | |
|---|---|---|---|---|
| Base | 1 | 1 | 0 | 0 |
| Head | 1 | 1 | 0 | 0 |
Updated by this run for 5d7b27e8cce8198d6bdedb944693a48b01bc5995.
|
| Tools | Prompts | Resources | Resource templates | |
|---|---|---|---|---|
| Base | 3 | 0 | 0 | 0 |
| Head | 3 | 0 | 0 | 0 |
Updated by this run for 5d7b27e8cce8198d6bdedb944693a48b01bc5995.
|
| Tools | Prompts | Resources | Resource templates | |
|---|---|---|---|---|
| Base | 23 | 4 | 8 | 5 |
| Head | 23 | 4 | 8 | 5 |
Updated by this run for 5d7b27e8cce8198d6bdedb944693a48b01bc5995.
|
| Tools | Prompts | Resources | Resource templates | |
|---|---|---|---|---|
| Base | 14 | 2 | 0 | 0 |
| Head | 14 | 2 | 0 | 0 |
Updated by this run for 5d7b27e8cce8198d6bdedb944693a48b01bc5995.
There was a problem hiding this comment.
🟡 Changes recommended
The test fails on CI’s shallow checkout because HEAD~1 is unavailable, while draft-PR detection incorrectly skips coverage and Boot smoke checks for development-branch pushes.
2 open issues
What changed in this PR
Reduces pre-push gate time for the reference servers by limiting work to affected packages and removing duplicate test runs, addressing #5759.
Changes:
- Scope per-server checks to changed directories, with a shared
GATE_BASEoverride. - Run full-gate tests once under coverage.
- Add lighter draft gates and restore skipped CI checks when PRs become ready.
| File | Description |
|---|---|
src/sequentialthinking/package.json |
Separate checks from tests. |
src/memory/package.json |
Separate checks from tests. |
src/filesystem/package.json |
Separate checks from tests. |
src/everything/package.json |
Separate checks from tests. |
scripts/validate-py.test.mjs |
Test pytest-skip argument handling. |
scripts/validate-py.mjs |
Add --no-pytest. |
scripts/lib/workflow-gate.test.mjs |
Check scoped-stage CI parity. |
scripts/lib/gate-scope.test.mjs |
Test server selection rules. |
scripts/lib/gate-scope.mjs |
Determine affected servers. |
scripts/interface-diff.test.mjs |
Test base override precedence. |
scripts/interface-diff.mjs |
Honor GATE_BASE. |
scripts/image-smoke.mjs |
Document GATE_BASE usage. |
scripts/gate-servers.test.mjs |
Test plans and failure handling. |
scripts/gate-servers.mjs |
Execute scoped full or draft stages. |
package.json |
Wire scoped and draft gates. |
docs/quality-gate.md |
Explain revised gate behavior. |
CONTRIBUTING.md |
Update contributor gate guidance. |
AGENTS.md |
Update gate and testing rules. |
.github/workflows/typescript.yml |
Avoid duplicate tests; handle drafts. |
.github/workflows/python.yml |
Avoid duplicate tests; handle drafts. |
.github/workflows/mcp-interface-diff.yml |
Defer draft checks until ready. |
.github/workflows/image-smoke.yml |
Defer draft checks until ready. |
.claude/skills/pre-push-gate/SKILL.md |
Update gate troubleshooting. |
.claude/skills/pr-flow/SKILL.md |
Document draft-to-ready procedure. |
Review effort: Balanced
Copilot round 1 on #5761: - The draft lookup classified pushes to v2/main as a draft's when the release merge PR (head v2/main) is a draft, skipping coverage and the smoke there. Both workflows now skip the lookup for v2/main and main, and workflow-gate.test.mjs pins it. - The resolveBase test used HEAD~1, which CI's one-commit checkout does not hold. It now tests precedence with HEAD and a bad GATE_BASE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>
|
Copilot round 1: two findings, both defects in what this PR added, both fixed in e1aaff4. The gate exited 0 on that commit.
Requesting round 2. |
|
Copilot round 2: clean, with no open findings. Both round-1 findings show as resolved. The review loop ends on this first clean round. |
…ope-and-coverage docs/quality-gate.md: keeps "The lease covers `local:gate` and `local:gate:draft` only." followed by #5758's "### Lease slots" subsection, as agreed with #5758's author. docs/ai-software-factory.md's gate summary now says the per-server stages are scoped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: cliffhall <cliff@futurescale.com>


Closes #5759
Description
The pre-push gate now runs each test suite once, under coverage, and only for the servers a change touches. A lighter gate covers pushes to a draft PR.
scripts/gate-servers.mjsreplaces the per-server part of thelocal:gate:stageschain.scripts/lib/gate-scope.mjsdecides which servers to run from the files changed since the merge base withorigin/v2/main.src/<server>/directories gates those servers only. A pending changeset does not widen the scope.scripts/, a workflow, root configuration, a doc, or a skill. The rule is "anything outside a server directory", not a list of repository-wide files, because a list goes stale silently.[gate] servers: memory — every changed file is under `src/memory/`.GATE_BASE=<ref>scopes against another base, such as a stacked branch's parent.resolveBasereads it, so the interface diff and the image smoke compare against the same base.validate, then again undercoverage. Python's pytest ran twice the same way, invalidate:pyandcoverage:py.check(format, lint, typecheck, build), andvalidatebecomescheck && test, unchanged in effect.checkthencoverage.validate-py.mjsgains--no-pytest, so Python runsvalidate:py --no-pytestthencoverage:py.npm run local:gate:draftruns under the same lease:verify:dcoplus the touched servers' fullvalidateandvalidate:py, with no coverage and no smoke.draftjob decides this.ready_for_reviewruns the full set again: it is a new trigger ontypescript.ymlandpython.yml, and a newpull_requesttype onmcp-interface-diff.ymlandimage-smoke.yml.npm testruns only on the Node 26 leg or for a draft.workflow-gate.test.mjsreadsgatePlanwhen it checks that every npm script CI runs is reached bylocal:gate. So "the gate runs every check CI runs" in AGENTS.md is still enforced and still true.docs/quality-gate.md(the stage table, and new sections on scope, on running each suite once, and on draft PRs), AGENTS.md Before pushing, CONTRIBUTING.md, and thepre-push-gateandpr-flowskills.Server Details
None (repository-wide): gate tooling, CI workflows, docs and skills. Each TypeScript server's
package.jsongains acheckscript, and itsvalidatenow runscheck && test. Nothing a server publishes changes, so there is no changeset.Motivation and Context
See #5759. A fix confined to one server waited on all seven servers' suites, each run twice. On a saturated gate lease, that time multiplies across every queued gate.
How Has This Been Tested?
This change has no client-facing surface, so the evidence is targeted probes.
Gate timings for a one-server change. Each probe added one line to
src/memory/index.tsin a fresh worktree. The times below are how long each gate held the lease. Time spent waiting for the lease is excluded: it ran 5 to 30 minutes, because the lease was saturated.origin/v2/main002bcce)memoryvalidate:pycoverage:pyThe after probe ran with
GATE_BASEset to the branch tip, so that only the probe's own change counted.This branch's own gate. The branch changes repository-wide files, so this gate ran every server, and the interface diff and image smoke covered all seven.
npm run local:gateexited 0 on 1ad5861 in 3m30s. The full gate before this change took 5m22s even with the interface diff and image smoke covering memory only. The gain is the Python suites, which no longer run twice: 4m30s before, 2m13s after.A defect the probes caught, fixed in 1ad5861. The first after probe failed.
GATE_BASEnarrowed the per-server stages, but the interface diff still compared againstorigin/v2/main. It therefore selected the Python servers, whose.venvs the narrowed gate had never synced.resolveBasenow readsGATE_BASE, and the re-run passed.Unit tests. All of these run in
test:scripts.gate-scope.test.mjs: a one-server change; several servers across both languages; a changeset; every kind of repository-wide path; a sibling directory such assrc/memory-next/; an empty change.gate-servers.test.mjs: the plan for each scope, with no plain test pass in the full gate; the draft plan; the printed reason; fail-fast;GATE_BASE; bad arguments.validate-py.test.mjs:--no-pytest.interface-diff.test.mjs: the precedence--base, thenGATE_BASE.workflow-gate.test.mjs: the CI parity check, which now readsgatePlan.verify:skillsandverify:skills:clipass.The draft-PR path in CI (the
draftjob, and theready_for_reviewtrigger) is exercised for the first time by this PR's own runs.Breaking Changes
None for users. For contributors:
local:gategates only the servers a change touches. SetGATE_BASEon a stacked branch.local:gate:draftis new.Types of changes
Also a chore: gate tooling and CI.
Checklist
draftjobs holdpull-requests: readonly)npm run changeset) if this changes what a TypeScript server publishes (not applicable: onlypackage.jsonscripts change; nothing published changes)GATE_BASE,--draft,--no-pytest)Additional context
docs/quality-gate.md's lease paragraph. This PR leaves the lease mechanism alone.local:gateandlocal:gate:draftonly.", then Gate lease: configurable slots, with a per-gate Vitest worker share #5758's "Lease slots" subsection. Whichever PR merges second catches up onv2/mainand re-gates.local:gate:draftgoes through the samegate-lease.mjs, so it gets the lease slots for free.🤖 Generated with Claude Code