Skip to content

test(cli): a smoke case checks what it broke - #771

Merged
blafourcade merged 1 commit into
nextfrom
test/a-smoke-case-checks-what-it-broke
Sep 4, 2026
Merged

blafourcade merged 1 commit into
nextfrom
test/a-smoke-case-checks-what-it-broke

Conversation

@blafourcade

Copy link
Copy Markdown
Contributor

What

Four cases in smoke-tools.sh damaged a file and then proved nothing about it.

They did not know which file they damaged. Four places picked one with find … | head -1. find answers in directory order — not sorted, not the same on two filesystems — so each run corrupted whichever file came back first:

cache_catalog() { find "$1/.aidd/cache/marketplaces" -path "*marketplace.json" … | head -1; }
tgt=$(find "$BASE/.claude"  -name "*.md" | head -1)
d=$(find   "$BASE/.cursor"  -name "*.md" 2>/dev/null | head -1)
i=$(find   "$BASE/.vscode"  -type f | head -1)

And the three restore cases never checked the repair:

if [[ -n "$tgt" ]]; then printf '\nDRIFT\n' >> "$tgt"; fi
run "restore --force" 0 "" "$BASE" -- restore --force

Exit 0 and nothing else. A restore --force that 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 ide case was worse still: its drift was a bare newline, which grep cannot see, so no check on that file was possible at all.

Change

first_file LC_ALL=C sort | head -1 — the same file on every machine and every run
SMOKE_DRIFT one named marker the three cases append, so a check has something to look for
repaired "<case>" "<file>" fails when the mark is still there after the restore, or when nothing was drifted to repair

Guards

The harness is not run by CI (pnpm smoke is manual), so the guards read its text — the way smoke-harness-isolation.unit.test.ts already guards the home sandbox.

Guard Mutation that killed it
no find … | head survives anywhere in the harness put one back — 1
every restore --force case is followed by a repaired check drop one of the three — 1
the drift carries a name a check can grep for rename the mark to X — 1

Each 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 -n and shellcheck -S error both clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp

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
@blafourcade
blafourcade requested a review from a team as a code owner September 4, 2026 23:06
@blafourcade
blafourcade merged commit ec49a4a into next Sep 4, 2026
17 checks passed
@blafourcade
blafourcade deleted the test/a-smoke-case-checks-what-it-broke branch September 6, 2026 06:22
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