test(mosaic): isolate background update notice from CLI smoke stderr assertions #1190

Open
opened 2026-08-13 01:13:00 +00:00 by be-coder-06 · 0 comments
Collaborator

Defect

packages/mosaic/src/cli-smoke.spec.ts asserts that stderr is empty for the production CLI's bare --source, --decisions, and --observations blocked-JSON cases. The production CLI also starts a background update check that writes an update notice to the same stderr stream, so these tests depend on shared cached/update state they do not own.

Reproduction

At stack branch fix/1182-fail-closed-launch based on origin/next 216cd72226cd9ee17eea461cfe7cd0e010a22f02, after a full repository build:

pnpm --filter @mosaicstack/mosaic exec vitest run src/cli-smoke.spec.ts --reporter=verbose

Reproduced 3/3 production CLI cases failing at src/cli-smoke.spec.ts:72:

AssertionError: expected update-notice stderr to be ''
Update available: 0.0.48 → 0.0.49
Tests  3 failed | 19 passed (22)

The JSON behavior and exit status remain correct; only the unowned stderr assertion fails.

Required outcome

Make production CLI smoke tests deterministic without suppressing a real update-check failure globally. Bound or inject the update-check/notification dependency for these cases, or assert only the stderr contract each command owns. Add a negative control proving an unrelated background notice cannot make blocked JSON coverage red or disappear.

Scope

Separate from #1182. Do not fold this into fail-closed runtime/storage/launcher work.

## Defect `packages/mosaic/src/cli-smoke.spec.ts` asserts that stderr is empty for the production CLI's bare `--source`, `--decisions`, and `--observations` blocked-JSON cases. The production CLI also starts a background update check that writes an update notice to the same stderr stream, so these tests depend on shared cached/update state they do not own. ## Reproduction At stack branch `fix/1182-fail-closed-launch` based on `origin/next` `216cd72226cd9ee17eea461cfe7cd0e010a22f02`, after a full repository build: ```bash pnpm --filter @mosaicstack/mosaic exec vitest run src/cli-smoke.spec.ts --reporter=verbose ``` Reproduced 3/3 production CLI cases failing at `src/cli-smoke.spec.ts:72`: ```text AssertionError: expected update-notice stderr to be '' Update available: 0.0.48 → 0.0.49 Tests 3 failed | 19 passed (22) ``` The JSON behavior and exit status remain correct; only the unowned stderr assertion fails. ## Required outcome Make production CLI smoke tests deterministic without suppressing a real update-check failure globally. Bound or inject the update-check/notification dependency for these cases, or assert only the stderr contract each command owns. Add a negative control proving an unrelated background notice cannot make blocked JSON coverage red or disappear. ## Scope Separate from #1182. Do not fold this into fail-closed runtime/storage/launcher work.
be-coder-06 added the bug label 2026-08-13 01:13:00 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#1190