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 cc57ee1
Browse filesBrowse the repository at this point in the historyBrowse files
fix: verify only against exact targets; bound ownership to our own packages (#1305)
Round-4 review findings, plus two more found by applying the same adversarial pass to the
fixes themselves before pushing rather than after.
**`altimate upgrade latest` always reported a successful upgrade as failed (CRITICAL).**
`cli/cmd/upgrade.ts` forwards `args.target` verbatim, so a dist-tag (`latest`, `beta`) or a
range (`^0.12.0`) reaches `upgrade()` as a literal string. The manager resolves it correctly
and installs a concrete version — which the post-upgrade check then compared against the
unresolved literal. `normalize("0.12.0") !== normalize("latest")` is true for every input,
so there was no path on which a non-exact target could pass. Comparing a resolved version
against a specifier is not a check; it is a guaranteed mismatch. Verification now only
contradicts when the target is an exact version (`semver.valid`), and logs that it could not
verify otherwise.
**`ownerOf()` could attribute another package's dependency to our wrapper (MAJOR).** Being
somewhere under the manager's root is weaker than belonging to our package:
`<root>/some-other-cli/node_modules/@altimateai/altimate-code-<platform>/...` satisfied the
containment check and was claimed by whichever single wrapper happened to be installed. Only
two placements actually mean the platform package was installed for us — hoisted to the
manager's own top level, or held in its virtual store — so the first path segment relative to
the tree root now has to be `@altimateai` or a dot-prefixed store directory.
**A transient probe failure was cached for the life of the process (MAJOR).**
`computeIdentity` never fails in the Effect sense — `text()` turns a failed spawn into an
empty string — so `Effect.cached` happily memoised a degraded `unknown`, silently disabling
upgrade and blocking uninstall until restart. The identity now distinguishes "the manager
answered and we are not in its tree", which is durable, from "the manager did not answer",
which is not, and retries only the latter.
Found while reviewing those fixes, before pushing:
* A naive `if (unprobed) recompute` would have re-spawned the manager on every call for
anyone whose manager genuinely is not installed — on a path that runs at every startup
check. The retry is itself memoised, giving exactly one extra attempt shared by all
callers, with no check-then-act window.
* `uninstall` still carried a `?? "@altimateai/altimate-code"` default — the same silent
substitution that made an earlier revision delete a user's data and then remove a package
that was never installed. It is unreachable today, because a package-manager method is
only returned once ownership is confirmed, but the shape is the bug. A managed method
with no confirmed package now refuses and prints manual steps.
* Recovery guidance printed `@latest` regardless of what was asked for; it now echoes the
requested target.
Tests: non-exact targets (`latest`, `beta`, `^0.12.0`) are not reported as failures, while an
exact target that does not match afterwards still fails; a sibling package's transitive
platform dependency is not ours, and a hoisted one is.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
0 commit comments