martha#342: a broken folder met by two installs keeps the good copy #349

Manually merged
terra merged 3 commits from saturnus/342-broken-folder-race into main 2026-12-01 10:04:04 +00:00
Member

Purpose (bug): when two installs of Martha's own Claude Code meet a broken folder that is already there, the second never removes the good copy the first placed.

Refs #342 (Jupiter's note 2 in the #329 review)

  • clearTheBrokenFolder moves the broken folder aside into an .installing- folder and never removes it in place. If another install placed its copy there in the meantime, that copy is put back. ENOENT on the move counts as already cleared.
  • A test seam, meanwhile, acts inside the race window.
  • Tests:
    • the double loss: the first install's copy survives;
    • a folder another install has already cleared;
    • Jupiter's note 1, the second loss, which ends in a plain line.
  • Mutants: removing in place, no put-back, dropping the second-loss line, and rethrowing ENOENT. Each one is caught.
  • Proof: tsc and lint are clean. The whole npm test ran in its own namespace: installer 169/169, src 5915 pass, 0 fail. One earlier run had an approve pty timeout in prove_a_clean_install, which this change does not reach; the rerun was green. check:private on the range found nothing.
Purpose (bug): when two installs of Martha's own Claude Code meet a broken folder that is already there, the second never removes the good copy the first placed. Refs #342 (Jupiter's note 2 in the #329 review) - `clearTheBrokenFolder` moves the broken folder aside into an `.installing-` folder and never removes it in place. If another install placed its copy there in the meantime, that copy is put back. ENOENT on the move counts as already cleared. - A test seam, `meanwhile`, acts inside the race window. - Tests: - the double loss: the first install's copy survives; - a folder another install has already cleared; - Jupiter's note 1, the second loss, which ends in a plain line. - Mutants: removing in place, no put-back, dropping the second-loss line, and rethrowing ENOENT. Each one is caught. - Proof: tsc and lint are clean. The whole `npm test` ran in its own namespace: installer 169/169, src 5915 pass, 0 fail. One earlier run had an `approve` pty timeout in prove_a_clean_install, which this change does not reach; the rerun was green. check:private on the range found nothing.
Two installs that both lost their swap to a broken folder: the first cleared it
and placed its checked copy, and the second then removed that copy. The second
now moves the folder aside and puts it back when it holds the binary. Tests:
the double loss with the first install run whole in the second's window, a
folder already cleared by another install, and the second-loss line (Jupiter's
#329 note 1). 4 mutants, all caught.
terra manually merged commit 8d0d79c951 into main 2026-12-01 10:04:04 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
martha-ai/martha!349
No description provided.