fix(tests): pin non-failing hosts to checksum state; correct mic-check doc drift - #37
Merged
twistedmelonman merged 1 commit intoAug 25, 2026
Conversation
Fixes #35, fixes #36. #35: the "one of three ssh failures" test set no checksum env var, so the ssh stub answered asiago's and mimolette's shasum call with empty stdout. An empty remote_sha never equals local_sha, so provision_host fell through to the push path and re-pushed lock-guard to both hosts on every run. The test still passed because its assertions only checked log-line content, and both push and steady-state end in ssh_exit=0 -- so it silently exercised the push path while reading as a steady-state fan-out test. Pin both non-failing hosts with STUB_SSH_CHECKSUM_ALL_MATCH, matching the sibling "three clients all succeed" test, and assert no push (CMD=cat >) was attempted for any host. STUB_SSH_FAIL_HOST is evaluated before the checksum stubs in the ssh stub, so tilsit still fails as intended. Falsified: perturbing STUB_SSH_CHECKSUM_ALL_MATCH to a non-matching digest makes the new assertion fail. Before this change the same perturbation was undetectable. #36: the design doc described the mic-active signal as `ioreg -c IOAudioEngine -r -l` stubbed via LOCK_SYNC_IOREG, but the shipped check_mic_active uses `pmset -g assertions` matching coreaudiod.*preventuseridlesleep, stubbed via LOCK_SYNC_PMSET. The code is correct -- IOAudioEngine is Intel/kext-era and publishes no live instances on Apple Silicon, so the planned check would have failed open everywhere. The doc is a dated plan record, so rewriting its code blocks would falsify what was actually planned. Instead: add an "Implementation note" addendum below the header documenting the deviation and rationale, update the Status line, and mark the two prose references (the signal list and the Testability section) as superseded.
|
Doc-only update + test hardening. No production code changed. The test fix correctly pins the two non-failing clients to steady-state checksum match so the test isolates the one variable it's about (single-host SSH failure) and adds an assertion that no provisioning push occurred. The new assertion (grep -q 'CMD=.*cat >' returning non-zero) is the right way to assert absence of a push in this stub framework. No BLOCK criteria found. VERDICT: PASS |
twistedmelonman
deleted the
claude/fix-test-pinning-and-doc-drift-0a206b4b
branch
August 25, 2026 15:38
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.
Closes #35, closes #36.
#35 — mechanism confirmed, and falsified both ways
The issue's stated mechanism is exactly right.
provision_host(
bin/lock-fanout:117) comparesremote_shatolocal_sha; with no checksumenv var set, the stub returns empty stdout, which never matches, so it falls
through to the push.
Proved empirically before fixing, by dumping
SSH_LOG: asiago received afull
cat >~/.local/bin/.lock-guard.tmppush on every run of that test.Fix at
tests/lock-fanout.bats:154-156pins both non-failing hosts withSTUB_SSH_CHECKSUM_ALL_MATCH— the pattern already used by the sibling test atline 131 — plus a no-push assertion at line 180.
Falsification: perturbing the digest to
deadbeef...makes the newassertion fail at line 182. Before this change, that same perturbation was
completely undetectable. Ordering was checked too:
STUB_SSH_FAIL_HOSTisevaluated before the checksum stubs, so tilsit still fails as the test intends.
#36 — the code is correct; the doc was wrong
check_mic_active(bin/lock-guard:49-52) usespmset -g assertions | grep -qi 'coreaudiod.*preventuseridlesleep'.The doc's planned
ioreg/IOAudioEngineapproach would have been worse thanmerely different:
IOAudioEngineis Intel/kext-era and publishes no liveinstances on Apple Silicon, so that check would have silently failed open
on every current machine.
Since the doc is a dated plan record, rewriting its code blocks would
falsify what was actually planned at the time. Instead it gets an
"Implementation note" addendum below the header, an updated Status line, and
the two prose references marked superseded.
Verification
bats tests/+shellcheck -S info bin/*+npx markdownlint-cli '**/*.md'— 66 pass / 0 fail, shellcheck clean,markdownlint exit 0. Identical before and after.
non-blocking findings raised (a
shasumavailability guard on a test stub,and a doc/PR cross-reference); both are cosmetic and deliberately deferred
rather than expanding this diff.
https://claude.ai/code/session_014iwogYZxFU6NqXmiobcMMv