Commit 89e84c5
committed
fix(browser): address post-impl code review findings
Fixes 4 issues identified in the 2026-04-07 post-implementation code
review. See .tlc/tracks/adopt-lightpanda/reviews/ for the full report.
C-1 (critical, blocker) — src/browser/resolver.js:409
resolveProbeOnly crashed with 'Cannot read properties of null' when
stepLocalProbe returned null for a downloadable entry (lightpanda)
with no local install. Triggered on clean systems with
BROWSER_CHANNEL=lightpanda via the back-compat shim path.
Fix: null-guard + return {} (matches pre-subsystem behavior — no
local install, caller falls through to bundled chromium).
Regression test added in resolver.chain.test.js covering both
'lightpanda' and 'panda' (alias).
I-1 (important) — src/browser/downloader.js:239
Empty-body error path called ws.close() (graceful flush) instead of
ws.destroy() (immediate), and was missing fsp.unlink(partialPath)
for the orphan cleanup that the pipeline-failure path at 306 already
does. Made the two error paths consistent.
I-2 (important) — src/server.js:107 + new ContextPool.replaceBrowser()
Direct mutation of pool._browser during lightpanda restart was
reaching into private state and had an undocumented race window
against in-flight _allocate() calls.
Added ContextPool.replaceBrowser(browser) with explicit race
contract in the JSDoc: in-flight calls holding the old reference
will error, _allocate's catch block releases the slot, client gets
a retryable error. This is the correct outcome — the old browser is
dead; no safe way to recover in-flight calls.
server.js now calls pool.replaceBrowser() instead of mutating the
private field directly.
I-3 (important) — src/browser/providers/github.js:108
Asset name matching used .includes(expected) which would
false-positive on variants like 'lightpanda-aarch64-macos-debug'
if present before the main asset in upload order.
Fix: prefer exact match, fall back to extension-suffix match
(expected + '.') for future archived formats (.tar.gz, .zip).
Maintains compatibility with current bare-binary releases.
Tests: 943 passing (+1 regression test), 0 failures.
Track: adopt-lightpanda
Review: .tlc/tracks/adopt-lightpanda/reviews/2026-04-07-post-impl-code-review.md1 parent e9976ea commit 89e84c5
6 files changed
Lines changed: 61 additions & 5 deletions
File tree
- src
- browser
- providers
- server
- test/unit/browser
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
241 | 247 | | |
242 | 248 | | |
243 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
109 | 119 | | |
110 | 120 | | |
111 | 121 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
410 | 415 | | |
411 | 416 | | |
412 | 417 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
106 | | - | |
107 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
128 | 148 | | |
129 | 149 | | |
130 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
144 | 157 | | |
145 | 158 | | |
146 | 159 | | |
| |||
0 commit comments