Skip to content

ci(canary): downstream fixture project on every PR — older install, customized files, init-on-initialized, MCP handshake — plus an npm next-tag soak before latest #1098

Closed

Description

@admarble

Blocked by: #1093 Tier: mechanical Doc: guard plan 2026-09-18 (16-bug classification; research: Amazon one-box stage, Kayenta canary)

Why

Five of the sixteen recent bugs were found only by field use, days to weeks after release: the 12-repo sync found #1053, a downstream project hit #1078 twice and #1084 once, the Codex gate found #1076 and #1079. CI has nothing that resembles a downstream project, so every one of these was invisible until a human ran a real install. Amazon's one-box stage and Netflix's canary exist for this class. The cheap version for a CLI is a fixture downstream project in CI and a soak on the next tag before latest.

Change

  1. __tests__/canary/downstream.integration.test.ts, run as its own CI job on every PR:
  2. Release skill: publish to the next dist-tag first; promote to latest only after the canary job has passed against the published tarball and a manual soak on the maintainer's own projects (npx sequant@next sync --dry-run across the local repo set) shows only expected decisions. The skill prints the soak checklist and refuses latest without a --soaked flag.

Release-graph plan — guard-2026-09 (2026-09-20)

Graph: guard-2026-09 Tier: mechanical Wave: 3
May touch: .github/workflows/ci.yml (new canary job only), __tests__/canary/downstream.integration.test.ts, __tests__/canary/fixture/, release SKILL.md ×3 (next publish + --soaked), src/lib/__tests__/release-skill-soak.test.ts, CHANGELOG.md

The npm run build && npm test AC is verified by the runner from a clean shell after the PR opens (PLAN I-1); the agent runs only the test files its ACs name. Mutation markers use failedTest starting with the test file path (I-4). Fixture first: the downstream fixture project and its customizations land before the assertions. Real npm install of the previous minor and a real MCP initialize over stdio, no mocks (I-6). Phase 0 measured the full local suite at 433 s; the 6-minute AC-6 budget is for the canary job alone (OQ-2). Skill edits: I-3 applies.

Acceptance criteria

Not in scope

Running the canary on macOS and Windows runners (follow-up once the ubuntu job is stable). Requiring the canary check and the next soak decision are #1110's.

Activity

  1. added
    enhancement
    cli
    on Sep 19, 2026
  2. admarble commented on Sep 20, 2026

    @admarble
    ContributorAuthor

    Runner context — guard-2026-09 wave 3 launch, 2026-09-20. Base: origin/main at 138d12ac (waves 1 and 2 merged: #1093 settle-against-base script + red-main rule + CI job test, #1069 merge-not-rebase, #1087, #1097, plus all of wave 1). These rules override the exec AND qa skills' defaults for this run:

    • No full npm test in the worktree — this applies to the qa phase too. Under concurrent phase agents that one call exceeds the 30-minute no-progress wall and the phase is killed (three wave-1 phases died this way). Verify each AC by its own command; run only the test files the ACs name. The runner runs the full suite once per PR from a clean shell and records it on the PR.
    • A named test file red before your change: the suite is now hermetic (bug(test): suite isn't hermetic against the SEQUANT_* env phases inject — exec sees red tests it didn't cause and opens no PR #1086), so a red file is real. Name the issue number and the base-vs-head result in the PR body.
    • Mutation marker (gate-test ACs): <!-- SEQUANT_MUTATION: {"ac":"AC-N","mutation":"<what you deleted>","failedTest":"<test file path> > <describe> > <case>"} --> in the PR body. failedTest MUST start with the test file path. Run parseMutationMarkers on your body before opening the PR. Commit before mutating.
    • 30-minute no-progress wall per phase. Commit a WIP checkpoint before any long command; every command foreground, with timeout.
    • Commits: single-line git commit -m "...", no Co-Authored-By. Push the branch and open the PR yourself (one wave-1 exec forgot). Never rebase or force-push after pushing. One AC per line in the PR body, ids AC-N only.
    • Stop at the PR. Do not merge.

    Issue-specific: Only the new canary job in .github/workflows/ci.yml — do not touch the test job (its id and matrix-less shape are load-bearing for the main ruleset, see the comment above it). The fixture installs the real previous minor ([email protected], real npm install) and sends a real MCP initialize; no mocks (I-6). AC-1 needs the canary job green on your own PR: push, then read gh pr checks and put the run URL and the AC-6 timing in the PR body. Only this issue edits the release SKILL.md mirrors this wave (the red-main pre-flight from #1093 is already there; add the next publish + --soaked gate without touching it); npm run lint:skill-sync 0 diverged, no SKILL.md contains the word relay.

  3. admarble commented on Sep 20, 2026

    @admarble
    ContributorAuthor

    Complexity: Standard (7 ACs, 6 directories)

    AC Quality Check

    Warning-only (lintAcceptanceCriteria):

    • AC-2/3/4/5/6: verification is declared with Verify:, not a trailing Evidence: clause, so extractAcceptanceCriteria infers the method (AC-3, AC-4, AC-5, AC-6 all resolve to manual; only AC-2 resolves to integration_test). The commands are unambiguous, so I'm treating the Verify: command as authoritative below. Optional cleanup: re-label as Evidence: so /testgen and /qa read them as declared.
    • AC-6: "under 6 minutes" has a threshold and a command, but the budget is one-sample. OQ-2 (PLAN §9) is the measurement; record the timing in the PR body.
    • AC-1: "passes on this PR" can only be verified after the PR is pushed (runner-context comment says so).

    Scope Assessment

    Non-Goals: present ("Not in scope": macOS/Windows runners; requiring the check and the next soak decision are #1110's).

    Metric Value Status
    Feature count 2 (canary fixture + job; release-skill next/--soaked) ✅
    AC items 7 ✅
    Directory spread 6 (.github/workflows, __tests__/canary, 3 skill dirs, src/lib/__tests__, root config) ⚠️

    Verdict: ✅ SCOPE_OK (spread is mostly the three mirrored skill copies)


    Acceptance Criteria

    AC-1: canary job exists in ci.yml, runs on every PR, green on this PR

    Verification: Manual Test (CI observation)
    Scenario: Given the PR is pushed → When CI runs → Then gh pr checks shows canary pass
    Assumptions: New job only; test job id and matrix-less shape untouched (ruleset-load-bearing, see comment above it in ci.yml).

    AC-2: gate — every customization survives sync and init --agent codex --yes

    Verification: Integration Test (-t "customizations survive"), mutation-verified
    Scenario: Given fixture project on previous-minor install with customized constitution, settings.local.json matcher group, hand-written AGENTS.md, tuned .sequant/settings.json, stale ^1.20.0 devDependency → When PR build runs sync then init --agent codex --yes → Then every customization is byte-preserved
    Assumptions: .claude/settings.json is sequant-owned (#1090 D-1) and is expected to be overwritten; the assertion targets settings.local.json, not it.
    Mutation: make fixture init call createDefaultSettings unconditionally (#1071 behavior, src/commands/init.ts:949) → test fails → restore.

    AC-3: dry-run decisions equal applied changes, file for file

    Verification: Integration Test (-t "dry-run equals apply")
    Scenario: Given the fixture → When sync --dry-run (exits non-zero when work is pending — the test must tolerate that) then sync → Then the file set printed by the dry-run's ownership decisions equals the set whose bytes changed (snapshot before/after)
    Assumptions: Dry-run output format (printOwnershipDecisions, src/commands/sync.ts) is parseable; if not, expose it through a small stable parser rather than scraping ad hoc.

    AC-4: MCP initialize from fixture cwd with stale local node_modules/sequant reports the PR's version

    Verification: Integration Test (-t "mcp handshake"), mutation-verified
    Scenario: Given the fixture with a stale local node_modules/sequant → When the plugin launcher (scripts/mcp-launch.mjs, spawned with cwd = fixture) starts the server and a JSON-RPC initialize is sent over stdio → Then serverInfo.version equals the PR's package.json version, not 1.20.x
    Assumptions: The shipped .mcp.json pins sequant@<released version>, which is unpublished for a PR. Pass the launcher a spec that is a npm pack tarball path of the PR tree (isSafeSpec allows [A-Za-z0-9@._/-], so a path without spaces passes). Real npx, no mocks (I-6).
    Mutation: point the launcher/command at the local node_modules/sequant bin (pre-#1085) → reports 1.20.x → fails → restore.

    AC-5: release skill publishes to next first, refuses latest without --soaked, in all 3 copies

    Verification: Unit Test (src/lib/__tests__/release-skill-soak.test.ts), scoped to the delimited region
    Scenario: Given the three release/SKILL.md copies → When the test extracts the Step 9 publish region → Then each copy has npm publish --tag next before any latest promotion (npm dist-tag add … latest), prints the soak checklist, and gates latest on --soaked
    Assumptions: Edits go beside, not inside, the #1093 red-main pre-flight. Per CLAUDE.md, scope assertions to the region and mutation-verify (delete the --soaked gate in one copy → that copy's case fails). Plain gate-test discipline; lint:skill-sync stays 0 diverged, no SKILL.md contains "relay" (I-3).

    AC-6: canary job < 6 min on ubuntu

    Verification: Manual Test — gh run view <id> --json jobs --jq '…'
    Scenario: Given the green PR run → Then completed_at − started_at < 360 s; recorded in PR body (closes OQ-2)

    AC-7: npm run build && npm test green

    Verification: Manual Test — run by the runner from a clean shell after the PR opens (PLAN I-1); the agent runs only the named test files.


    Implementation Plan

    Phase 1: Fixture first (no assertions yet)

    1. __tests__/canary/fixture/ — a builder (createDownstreamFixture()), not a checked-in tree: temp dir; npm install sequant@<previous minor> (computed from package.json: 2.16.0 → highest 2.15.x via npm view [email protected] version, not hardcoded); run its init; apply the five customizations; add stale local node_modules/sequant (the real installed one, or a stale stub for the MCP case).
    2. npm pack of the PR tree once per test file (beforeAll), reused for sync/init/update/MCP.

    Phase 2: Assertions (downstream.integration.test.ts)

    1. customizations survive (AC-2), dry-run equals apply (AC-3), plus the unlisted-but-in-the-issue asserts: no {{PLACEHOLDER}} under .claude/, doctor --skip-issue-check exits 0 afterwards (skip the closed-issue check — needs gh/network).
    2. mcp handshake (AC-4): spawn the launcher, write initialize to stdin, read one JSON-RPC line with a hard timeout, kill the process group (detached:true + group kill).

    Phase 3: CI + release skill

    1. ci.yml: new canary job (same pinned action SHAs as siblings; npm ci → npm run build → the canary command). Do not touch test.
    2. Release skill ×3 (templates/skills/release, skills/release, .claude/skills/release): Step 9 → npm publish --tag next; new "Promote" step + soak checklist (npx sequant@next sync --dry-run across the local repo set); --soaked flag in Usage. Keep the EOTP handoff and Post-Release Verification (dist-tags) consistent. release-skill-soak.test.ts + CHANGELOG.

    Dependencies: #1093 is closed/merged. Phases 1→2 sequential; Phase 3 items 5 and 6 are independent of each other.


    Design Review

    1. Where does this logic belong? Fixture + asserts in __tests__/canary/ (a black-box test of the built CLI, not src/); the release gate in the release skill (prose with no runtime twin), pinned by a skill-text test like release-checkout-lock-skill.test.ts.
    2. Simplest correct approach? Real npm install + npm pack + real stdio, per I-6. Rejected: mocking npm / an offline previous-minor tarball checked into the repo (that is exactly the "fixture mocks npm" failure mode the plan names).
    3. Existing pattern? *.integration.test.ts in the serialized integration vitest project, spawning the built CLI (sync-source-invocation.integration.test.ts, mcp-launch.integration.test.ts); skill-text gate tests as in release-checkout-lock-skill.test.ts.
    4. What would a senior reviewer challenge? (a) "Why does the required test job now depend on the npm registry?" — see OQ-1. (b) "AC-3 scrapes CLI output" — pin the format with the test itself. (c) "Version derivation" — hardcoding 2.15.1 rots at the next minor; derive it.

    Feature Quality Planning

    All standard checks pass except:

    • Network flakiness / required-check coupling (High): the file lands in vitest's integration project by glob, so plain npm test (the test job, which the main ruleset requires) would also run it and go red on an npm outage. See OQ-1.
    • Timeouts: integration project's 30 s testTimeout is too short for npm install + npx; needs a per-file/beforeAll timeout (e.g. 180 s).
    • Process cleanup: the MCP server must be group-killed on every path (finally), or the vitest worker hangs.
    • Hermetic git/identity: fixture commits must set git config user.* before committing (CI identity vs macOS GECOS lesson); env must scrub SEQUANT_* (bug(test): suite isn't hermetic against the SEQUANT_* env phases inject — exec sees red tests it didn't cause and opens no PR #1086).
    • Mutation records: AC-2, AC-4 (and AC-5) need SEQUANT_MUTATION markers whose failedTest starts with the test file path (I-4); commit before mutating.

    Derived ACs

    Source Derived AC Priority
    Issue Change §1 (asserts) AC-8: no {{PLACEHOLDER}} under .claude/ and doctor --skip-issue-check exits 0 after update — currently in the issue body but not in any numbered AC Medium
    Version rot AC-9: previous minor derived from package.json, not hardcoded Low

    (Both are folded into the Phase 2 plan; not proposed as blocking.)


    Open Questions

    1. How is the canary kept out of the required test job? — Recommendation: add a canary vitest project (include __tests__/canary/**, long timeouts), exclude it from unit/integration, change "test" to vitest run --project unit --project integration and add "test:canary": "vitest run --project canary". AC-2/3/4 npx vitest run <file> -t … still resolve (no --project filter). This touches vitest.config.ts and package.json, which are not in the issue's "May touch" list — needs owner OK. Impact if wrong: either the required test check depends on the registry, or a bare-path verify command finds no files.
    2. Previous minor when the current tree is an unreleased minor bump? — Recommendation: "highest published <major>.<minor-1>.x" via npm view; fall back to failing loudly if none. Impact: wrong pin tests a non-representative upgrade path.
    3. Does the .claude/settings.json overwrite need an explicit assertion? — Recommendation: yes, assert it is overwritten and listed in the dry-run (per the issue's Change §1 parenthetical), so the expected loss is pinned rather than implied.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: Skipping testgen deliberately despite integration-test ACs: the deliverable is the test file, so stubs would duplicate it (fixture-first ordering in the runner context already covers the intent). No UI, no security-sensitive surface. Quality loop off; AC-1/AC-6 need real CI runs, which the exec agent gets by pushing and reading gh pr checks. Runner-context rules apply: no full npm test in the worktree (run only the named files), no merge.


    Label Review

    Current: enhancement, cli
    Recommended: enhancement, cli (add planned)
    Reason: No complexity labels apply; 7 ACs = Standard.
    Quality Loop: Won't auto-enable (SCOPE_OK).

  4. added
    planned
    on Sep 20, 2026
  5. added a commit that references this issue on Sep 20, 2026
  6. admarble commented on Sep 20, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_MET_BUT_NOT_A_PLUS

    AC coverage: 0/2 met

    Gaps:

    • The rollback path in the release skill still publishes straight to latest, bypassing the next-first soak gate this PR introduces; the AC-5 gate test cannot catch it because it is scoped to the next-tag-publish region
    • /release --prerelease beta --soaked would promote a pre-release version to the latest dist-tag, contradicting Step 9
    • Derived AC-8's 'doctor exits 0' clause is inert on the CI runner, and the ambient allowlist is name-matched so a renamed doctor check turns the canary red while a real check sharing one of those names is silently excused
    • The sanctioned overwrite of .claude/settings.json is pinned only implicitly by the set equality in 'dry-run equals apply', never named
    • AC-6's 6-minute budget is an observation rather than an enforced CI gate, so a runtime regression would creep rather than trip
    • The canary job goes red at the next major version bump until previousMinorVersion() is extended
    • Stale guidance implying only pre-releases use --tag
    • F1 — the old straight-to-latest path survives in the same file (all 3 copies). release/SKILL.md:728, under "### After npm publish":

    Suggestions:

    • Add timeout-minutes: 6 to the canary job so AC-6 stays a gate rather than a one-sample reading.
    • The implicit ordering contract in the canary file ("dry-run equals apply must run before anything has synced") is currently held only by vitest's in-file declaration order. I confirmed each AC's -t command works standalone, so this is not a live defect — but a describe.sequential or an explicit guard would make it structural rather than incidental.
    • BOOKKEEPING is subtracted from changed but not from predicted; it passes today because the dry-run doesn't list those paths, which is a property of sync's output rather than of this test.
  7. added 2 commits that reference this issue on Sep 20, 2026
  8. added a commit that references this issue on Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clienhancementplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions