test(cli): add offline-graceful test for #358 stale-CLI nudge#362
Merged
Conversation
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).
5 tasks
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.
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
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:initexits 0 (does not crash)SDLC Wizard installed successfullypresent)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
tests/test-cli.sh— 92/92 (4 [feature] init should detect when npx cache serves stale CLI version (no @latest pin) #358 tests, all green)validate