Skip to content

fix(test): cli.integration flag-surface tests assert on the not-initialized guard, so they fail on any locally init'd clone #883

Closed

Description

@admarble

Found while verifying main after merging #871 (PR #876). Not caused by that change — reproduced at the pre-merge commit (see below).

src/commands/cli.integration.test.ts > run command flag surface (#705) has 4 tests that fail on any local clone that has been sequant init'd, and pass in CI:

  • -q parses without error (hidden quality-loop alias) (AC-1)
  • -Q parses without error (AC-1)
  • --no-tui parses without error (AC-4)
  • --experimental-tui still parses as a hidden no-op alias (AC-5)
AssertionError: expected 'SEQUANT WORKFLOW\n  Stack  ge…' to match /Sequant is not initialized/

Cause

expectFlagAccepted spawns the CLI with cwd: projectRoot and asserts on the not-initialized pre-flight guard's output. Its comment states the premise:

These tests run in the repo root, which is not itself an initialized Sequant project, so every run trips the not-initialized pre-flight guard in run.ts.

That premise holds only on a fresh checkout. The guard is if (!manifest) (src/commands/run.ts:57), keyed on .sequant-manifest.json — which is gitignored (.gitignore:35). So:

Environment .sequant-manifest.json Guard fires? Result
CI (fresh checkout) absent yes 4 tests pass
Any locally init'd clone present no 4 tests fail

The dev repo this was found on has carried a manifest since 2026-03-24, so npm test cannot go green locally there.

The tests are using "the guard fired" as a proxy for "Commander accepted the flag". The proxy is what is environment-coupled — the flags themselves parse fine either way.

Reproduction (isolates it from #871)

git worktree add --detach /tmp/pre 48767845   # the commit before #876 merged
cd /tmp/pre && npx vitest run src/commands/cli.integration.test.ts
#   → 16 passed          (no manifest in a fresh worktree)

cp /path/to/repo/.sequant-manifest.json /tmp/pre/
npx vitest run src/commands/cli.integration.test.ts
#   → 4 failed | 12 passed

Same commit, same code — only the ambient manifest differs. That also explains why a fresh worktree looks green: it is missing the file, not passing on merit.

Same family as #842 and #880: a test coupled to ambient environment rather than to what it means to assert.

Acceptance Criteria

  • AC-1: The four expectFlagAccepted tests pass whether or not .sequant-manifest.json exists in the repo root.
  • AC-2: The "flag was accepted by Commander" assertion no longer depends on the not-initialized guard firing — e.g. spawn in a manifest-less temp cwd, or assert on the absence of Commander's error: unknown option on stderr rather than on the guard's stdout.
  • AC-3: A genuine Commander usage error (run 1 --nope --dry-run) still fails the test, so the new assertion cannot pass vacuously.
  • AC-4: The stale comment claiming the repo root "is not itself an initialized Sequant project" is corrected, since that is what made the coupling invisible.

Activity

  1. added
    bug
    on Jul 30, 2026
  2. added a commit that references this issue on Jul 30, 2026
  3. added a commit that references this issue on Sep 9, 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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions