Repository navigation
Commit 6ee55b6
fix: detect the unscoped npm wrapper; redact the success path too (#1305)
Addresses the three review comments from @sahrizvi, which I had missed — I had only been
reading the automated reviews.
**CRITICAL — the primary documented install path was reported as `unknown`.**
`publish.ts` ships an unscoped `altimate-code` package alongside the scoped one, and that
unscoped package is what `README.md:30` and `docs/docs/getting-started.md:27` tell users to
install. `PKG_SEGMENT_RE` required an `@altimateai` segment, so it did not match.
It is worse than a missing alternative spelling, because of which file actually executes:
`postinstall.mjs` hard-links the resolved platform binary to `<wrapper>/bin/.altimate-code`,
and both shims run that cached file BEFORE walking to the nested platform package. A
hardlink has no symlink for realpath to follow, so from the first upgrade onward execPath is
the wrapper's own path with the platform suffix gone entirely — `.../node_modules/
altimate-code/bin/.altimate-code`. Detection returned `unknown`, update checks stopped
offering upgrades, and `altimate upgrade` failed with "Unknown installation method" — the
exact opaque failure this branch exists to remove.
The scope prefix is now optional and fixtures cover the shapes that actually run: unscoped
and scoped cached hardlinks, the unscoped nested platform package, and an unscoped wrapper
under a pnpm global root.
**MAJOR — the success path logged raw subprocess output.** The previous commit redacted the
failure branch but left `Effect.logInfo("upgraded", { stdout, stderr })` untouched. Both fan
out to stderr under OPENCODE_PRINT_LOGS=1 and to an OTLP collector when one is configured.
"The existing pattern already does this" is not a reason for either path to keep doing it,
so the success path is redacted too.
**MAJOR — upgrades could report success without changing the running binary.** The trailing
`text([process.execPath, "--version"])` discarded its output, so an upgrade that wrote to a
different prefix than the running executable passed silently. The result is now compared
against the target and a mismatch is logged with the execPath and a hint. It does not fail
the operation: the package manager genuinely succeeded, and branch/dev builds legitimately
report a different version string.
Not done from that comment: passing an explicit `--prefix` to the install command. The
ownership check added earlier already prevents mutating a foreign tree — it refuses rather
than writing to the wrong prefix — and pinning `--prefix` changes install semantics enough
to want its own change.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>1 parent f228cb2 commit 6ee55b6
2 files changed
Lines changed: 75 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
76 | 83 | | |
77 | | - | |
| 84 | + | |
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
| |||
844 | 851 | | |
845 | 852 | | |
846 | 853 | | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
847 | 858 | | |
848 | 859 | | |
849 | 860 | | |
850 | | - | |
851 | | - | |
| 861 | + | |
| 862 | + | |
852 | 863 | | |
| 864 | + | |
853 | 865 | | |
854 | 866 | | |
855 | 867 | | |
| |||
862 | 874 | | |
863 | 875 | | |
864 | 876 | | |
865 | | - | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
866 | 894 | | |
867 | 895 | | |
868 | 896 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
83 | 118 | | |
84 | 119 | | |
85 | 120 | | |
| |||
0 commit comments