Repository navigation
test(cli): a smoke case checks what it broke - #771
Merged
Merged
Conversation
Four cases in `smoke-tools.sh` damaged a file and proved nothing about it. They did not know which file they damaged. Four places picked one with `find … | head -1`, and `find` answers in directory order — not sorted, not the same on two filesystems — so each run corrupted whichever file came back first. And the three restore cases never checked the repair: each appended drift, ran `restore --force`, and asserted exit 0. A `restore --force` that exits 0 having restored nothing is precisely the failure #762 fixed inside the command, so the case meant to cover it would have passed throughout. The `ide` case was worse: its drift was a bare newline, which `grep` cannot see, so no check on that file was possible at all. `first_file` (`LC_ALL=C sort | head -1`) replaces every unsorted pick. One named marker, `SMOKE_DRIFT`, is what the three cases append, and `repaired` fails when the mark is still there after the restore, or when nothing was drifted to repair. The harness is not run by CI, so the three guards read its text, the way `smoke-harness-isolation.unit.test.ts` already guards the home sandbox. Each was written first and failed for the reason it names; `bash -n` and `shellcheck -S error` are both clean. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp
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.
What
Four cases in
smoke-tools.shdamaged a file and then proved nothing about it.They did not know which file they damaged. Four places picked one with
find … | head -1.findanswers in directory order — not sorted, not the same on two filesystems — so each run corrupted whichever file came back first:And the three restore cases never checked the repair:
Exit
0and nothing else. Arestore --forcethat exits 0 having restored nothing is precisely the failure #762 fixed inside the command — the smoke case meant to cover it would have passed throughout.The
idecase was worse still: its drift was a bare newline, whichgrepcannot see, so no check on that file was possible at all.Change
first_fileLC_ALL=C sort | head -1— the same file on every machine and every runSMOKE_DRIFTrepaired "<case>" "<file>"Guards
The harness is not run by CI (
pnpm smokeis manual), so the guards read its text — the waysmoke-harness-isolation.unit.test.tsalready guards the home sandbox.find … | headsurvives anywhere in the harnessrestore --forcecase is followed by arepairedcheckX— 1Each guard was written first and failed for the reason it names.
Gates: 3446 tests / 308 files,
tsc,biome ci(2 pre-existing warnings, 0 errors), knip, jscpd, bundle within budget, 369 repository script tests, 0 broken links,bash -nandshellcheck -S errorboth clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp