You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c6e9c51
Browse filesBrowse the repository at this point in the historyBrowse files
fix: don't misreport relocated-binary upgrades; make identity memoization race-free (#1305)
Round-3 review findings. Both are regressions introduced by round 2's own fixes, and both
share a cause: the new mechanism was tested against the complaint that prompted it, not
against itself.
**Homebrew upgrades were reported as failures (CRITICAL).** Round 2 added a post-upgrade
check that re-executes `process.execPath` to confirm the upgrade landed. For a Homebrew
install that path resolves into a versioned Cellar directory, and `brew upgrade` cleans up
the old version on success by default since 4.0 — so the path the check re-executes has
commonly just been deleted. The spawn fails with ENOENT, which the check classified as
"the binary could not be started afterwards", turning a completely successful upgrade into
a confident false diagnostic: the exact failure class this change exists to remove.
Guarded on the path still existing rather than on `m === "brew"`. Any installer that
relocates instead of overwriting has the same shape, and a path that has vanished after the
manager reported success means the install moved — which is unverifiable, not failed. It is
logged and reported as a success with a note, since the manager's own exit status is the
only evidence available at that point.
**`identity()`'s memoization had a check-then-act race (MAJOR).** `if (cached) return
cached` followed by a `yield` on a subprocess spawn before the assignment: two concurrent
callers each compute a result and the slower overwrites the faster. The Hono routes serve
requests in parallel and both reach `method()`, so a degraded probe landing second would
pin `unknown` for the remaining life of the process. Replaced with `Effect.cached`, the
primitive already used for this in `core/src/image.ts` and `http-recorder`, which dedupes
the in-flight computation rather than only its result.
Also: the unsupported-method recovery message in `cli/cmd/upgrade.ts` omitted yarn, which
is in `UNSUPPORTED_UPGRADE_METHODS` and routes there — `uninstall.ts` already had its line.
Tests, all three the review asked for:
* the relocated-binary precondition the Homebrew fix turns on;
* concurrent `method()` calls sharing a single manager query and agreeing, which is what
distinguishes `Effect.cached` from the racy variable;
* per-manager recovery guidance parity between upgrade and uninstall, covering every
method that can route to those messages.
One consequence worth recording: the verification now correctly catches the documented
standalone limitation. Running from `~/.local/bin` while the install script writes
`$HOME/.altimate/bin` leaves `execPath` present but reporting the old version, so the
upgrade now fails loudly instead of silently reporting success. The limitation itself is
still outstanding.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
0 commit comments