Commit 8e11c7f
fix: remove
The upgrade() function is the most critical code path — if it breaks,
users get permanently locked on old versions with no way to self-heal.
Changes:
- Replace `import semver` with zero-dependency `compareVersions()` and
`isValidVersion()` — 25 lines of inline code vs 14KB external package
- Replace silent `.catch(() => {})` in worker.ts with error logging
- Export both helpers for testing
Tests (73 total):
- `compareVersions`: 24 tests covering ordering, v-prefix, prerelease,
missing parts, unparseable versions, real-world altimate-code versions
- `isValidVersion`: 7 tests for valid/invalid/partial versions
- Decision logic: 30 tests mirroring upgrade() control flow
- Module health: 4 smoke tests verifying import works and semver is gone
- Parity: 11 tests comparing our implementation against semver library
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>semver dependency from upgrade path to prevent user lock-in (#421)1 parent 528af75 commit 8e11c7f
File tree
3 files changed
+278
-39
lines changed- packages/opencode
- src/cli
- cmd/tui
- test/cli
3 files changed
+278
-39
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
290 | 294 | | |
291 | 295 | | |
292 | 296 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
11 | 59 | | |
12 | 60 | | |
13 | 61 | | |
| |||
21 | 69 | | |
22 | 70 | | |
23 | 71 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
27 | 75 | | |
28 | 76 | | |
29 | 77 | | |
| |||
0 commit comments