Files
msd-core/tests
Michel Moreira 2388e6ab34 fix(#4342): run the bug-167 routing test in a fixture project, not the developer's (#4387)
The test called runGsdTools with its default cwd — the test process's own
working directory — and an inherited HOME, so the child read the checkout's
real .planning/ and the developer's real ~/.gsd/defaults.json. testEnvBase()
blanks the config-LOCATION env keys but sandboxes neither cwd nor HOME.

On a checkout that has workstreams with no active pointer, `init.progress`
exits non-zero and the FIRST assertion fails, so the routing comparison the
test exists for was never evaluated:

  init.progress failed: Error: init.progress requires a workstream in
  workstream mode — no active workstream is set ... Available workstreams: alpha

Reproduced byte-for-byte by adding .planning/workstreams/alpha/ to the
checkout: red on next, green here.

The invariant under test — `query <cmd>` and `<cmd>` returning identical
payloads — is independent of project state, so a plain createTempProject()
fixture is enough, with HOME/USERPROFILE pointed at it (the idiom runGsdTools's
own doc comment prescribes).

Two assertions pin the sandbox deterministically rather than conditionally:
the fixture HAS a .planning/ and the repo checkout does not, so dropping the
cwd override fails on every lane — CI included, where the ambient state that
exposed the bug is absent.

Co-authored-by: Tom Boucher <trekkie@nomorestars.com>
2026-09-07 10:34:37 -04:00
..