Repository navigation
Description
Context
Found during #1150 QA (PR #1163). PR #1163 fixed the destructive case: state-utils.test.ts rebuilt an empty state onto the checkout's real .sequant/state.json, so every npm test wiped it.
Three test files still write the checkout's real state:
src/mcp/server.test.ts__tests__/integration/mcp-e2e.integration.test.ts__tests__/integration/mcp-serve-async-refactor.integration.test.ts
Mechanism: the sequant_status tool (src/mcp/tools/status.ts:54) builds new StateManager() on the default path, which is process.cwd()/.sequant/state.json. It then calls reconcileState({ stateManager }), which contacts GitHub for every tracked issue. The tests call the tool from the repo root. As a result each run:
- rewrites the developer's real state file: issue titles are refreshed from GitHub and
lastSynced/lastUpdatedare bumped; - makes live GitHub calls from a unit test;
- asserts against whatever the checkout's state happens to contain. For example,
not_trackedfor issue 99999 holds only because no one tracks 99999.
How it was measured: copy a sentinel state.json into the checkout, run each file alone with npx vitest run <file>, then diff the file. Each of the three changed it. On 2026-09-25 the diff showed #1150's stored title replaced by its live GitHub title, plus new timestamps. Nothing was deleted.
Acceptance criteria
- AC-1: running any of the three test files leaves the working checkout's
.sequant/state.jsonbyte-identical — Evidence:npx vitest run src/lib/test-state-hermetic.test.ts(a new gate test) seeds a sentinel state file, runs the three files in a childvitestprocess with cwd = the checkout, and asserts its checksum is unchanged - AC-2:
sequant_statusin these tests reads a state file the test created, never the checkout's — Evidence:npx vitest run src/mcp/server.test.tswith a case that seeds issue 42 in a temp state and getsstatusback for it - AC-3: these tests make no GitHub call: reconcile is either pointed at a stub or the tracked set is empty — Evidence:
npx vitest run src/mcp/server.test.ts __tests__/integration/mcp-e2e.integration.test.ts __tests__/integration/mcp-serve-async-refactor.integration.test.tswithghremoved fromPATHfor the run, green - AC-4: the
sequant_statusproduction behavior is unchanged (default path, reconcile on), and a test-only override (astatePathoption or a cwd set per server instance) is the only way the tests redirect it — Evidence:npx vitest run src/mcp/tools/status.test.ts(or equivalent) asserting the defaultStateManagerpath when no override is given - AC-5:
npm run build && npm testgreen — Evidence: CItestjob
Non-Goals
- Changing what
sequant_statusorreconcileStatedo for real users. - A suite-wide hermeticity sweep of every test that touches
.sequant/. That is only worth doing if the AC-1 gate finds more offenders; if so, file them separately.
Related
#1150 / PR #1163 (the destructive case, fixed) · #1086 (env leaks into the suite, the same hermeticity class)
Activity
test(#1164): hermetic gate strips ANSI and disables color in the chil…
test(#1164): MCP sequant_status tests use a test-owned state file and…