Repository navigation
fix(#883): spawn the CLI flag-surface tests in a manifest-less temp dir - #884
Merged
admarble merged 1 commit intoJul 30, 2026
Merged
Conversation
The four `expectFlagAccepted` tests assert on run.ts's not-initialized pre-flight guard as a proxy for "Commander parsed this flag". They spawned the CLI with `cwd: projectRoot` and the comment claimed the repo root "is not itself an initialized Sequant project" -- true only on a fresh checkout. The guard fires on `getManifest()` returning null, and MANIFEST_PATH is cwd-relative with no upward walk, so whether it fires depends entirely on the spawn cwd. `.sequant-manifest.json` is gitignored (.gitignore:35), so: CI (fresh checkout) -> no manifest -> guard fires -> 4 tests pass any locally init'd clone -> manifest -> guard silent -> 4 tests FAIL meaning `npm test` could not go green on a dev machine that had ever run `sequant init`, while CI stayed green. Same family as #842 and #880: a test coupled to ambient environment rather than to what it means to assert. Fixed by spawning in a directory the test creates itself, which is manifest-less by construction in both environments. Added a positive control asserting an unknown option IS rejected and never reaches the guard, so the proxy cannot pass vacuously (AC-3). Corrected the stale comment (AC-4). The temp-dir cleanup guards its own recursive delete against a path outside `tmpdir()`. That is not hypothetical: while mutation-testing this change I pointed `cwd` at `projectRoot` with the cleanup still in place and it deleted the worktree. The guard turns that class of edit into a loud failure. Verified in both environments: with a manifest copied into the worktree (reproducing an init'd clone) the suite is 17/17; the pre-fix code is 4/16 there.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four
run command flag surface (#705)tests failed on any locallysequant init'd clone while passing in CI.They assert on run.ts's not-initialized pre-flight guard as a proxy for "Commander parsed this flag", and spawned the CLI with
cwd: projectRoot. The comment claimed the repo root "is not itself an initialized Sequant project" — true only on a fresh checkout. The guard fires ongetManifest()returning null, andMANIFEST_PATHis cwd-relative with no upward walk, so whether it fires depends entirely on the spawn cwd..sequant-manifest.jsonis gitignored:init'd cloneSo
npm testcould not go green on a dev machine that had ever runsequant init. Same family as #842 and #880 — a test coupled to ambient environment rather than to what it means to assert.Fix
Spawn in a directory the test creates itself — manifest-less by construction in both environments. Added a positive control (AC-3) asserting an unknown option is rejected and never reaches the guard, so the proxy can't pass vacuously. Corrected the stale comment (AC-4).
The temp-dir cleanup guards its own recursive delete against any path outside
tmpdir(). Not hypothetical: while mutation-testing this, pointingcwdatprojectRootwith the cleanup in place deleted the worktree. The guard turns that class of edit into a loud failure.Verification
Run with a manifest copied in, reproducing an
init'd clone:projectRootKnown: pre-existing tautology-detector false positive
npm teston this branch also fails 3tautology-detector-clitests. Not caused by this change — the detector scans only files ingit diff main...HEAD, and this file scores 100% tautological atorigin/maintoo (16/16 there, 17/17 here). Its heuristic can't see assertions made on subprocess stdout/stderr, which is exactly how this integration file works by design. Any PR touching this file trips it. Tracked separately rather than silenced here.Closes #883
Generated with Claude Code