Skip to content

test(cli): add offline-graceful test for #358 stale-CLI nudge#362

Merged
BaseInfinity merged 1 commit into
mainfrom
feat/358-offline-test-coverage
May 26, 2026
Merged

test(cli): add offline-graceful test for #358 stale-CLI nudge#362
BaseInfinity merged 1 commit into
mainfrom
feat/358-offline-test-coverage

Conversation

@BaseInfinity
Copy link
Copy Markdown
Owner

Summary

Follow-up to #361 (already merged). Adds the explicit silent-when-offline test that the original #358 goal condition named but the first PR's Test C substituted with silent-when-cache-poisoned.

What this catches

Fault-injects a fake npm (PATH override → script that always exits 1) and asserts:

  1. init exits 0 (does not crash)
  2. No nudge fires (because we have no version to compare)
  3. Install still succeeds (SDLC Wizard installed successfully present)

Without this test, a future refactor that removes the try/catch around execSync('npm view ...') would crash init in any environment where npm is unavailable (sandboxed CI, Docker without npm, offline laptop, etc.) — and we'd only notice when a user reported it.

Closes

This completes the test coverage promised in #358's PR (#361). #358 itself is already closed by #361.

Test plan

The original #358 PR (#361) shipped with three tests (nudge-fires-when-stale,
silent-when-current, silent-when-cache-poisoned) but didn't explicitly cover
the silent-when-offline path. Fault-injects a fake `npm` that always exits 1
to catch regressions where someone removes the try/catch wrapping execSync.

Verified locally: test-cli.sh 92/92 (4 #358 tests, all green).
@BaseInfinity BaseInfinity merged commit 659e82d into main May 26, 2026
3 checks passed
@BaseInfinity BaseInfinity deleted the feat/358-offline-test-coverage branch May 26, 2026 00:09
BaseInfinity added a commit that referenced this pull request May 26, 2026
 (#363)

PR #361 shipped 3 #358 tests where Test C was silent-when-cache-poisoned
rather than the goal-named silent-when-offline. The /goal Haiku evaluator
counted tests by file presence and approved completion. Caught only at
post-merge self-review, fixed in PR #362 (added the real offline test via
fake-npm PATH override).

Promoted to SDLC.md ## Lessons Learned → ### Testing so future sessions
inherit the rule: when a /goal condition enumerates test cases by name,
self-review must verify each named test exists by reading assertions, not
by counting matching `test_` functions.

This is the per-test-fidelity layer beneath PR #355's HIGH-95%-confidence
and DLC-binding gates — those work at the macro level, but enumerated-
condition fidelity is the author's responsibility.

Verified locally: test-doc-consistency 40/40, test-postmortem-lessons 7/7,
test-memory-audit-protocol 12/12.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant