Repository navigation
Commit e3bca63
committed
The browserPath machine-config key is read, and kept on save
What changed: lib/machine.mjs carries browserPath in DEFAULTS ('') and in shape(),
so loadConfig returns it and saveConfig writes it back; a value that is not a
string falls back to ''. lib/browser-transport.mjs: scrape and status take
config = null and, when the caller passes none, read the machine's with
loadConfig(env). An explicit config, or an explicit browserPath option, still wins.
Why: ADR-0088 orders the browser lookup as browserPath in the machine config, then
RESEARCH_KIT_BROWSER, then the usual paths, and the transport's own errors tell the
operator to "set browserPath in the machine config". But shape() never copied the
key, so loadConfig dropped it: research.mjs's auto-detect never saw it, and the
collector's runScrape(url), called with no options, searched with an empty config.
saveConfig rewrites the file from the shaped settings, so any save
(install-hooks --role among them) erased a browserPath set by hand. The key was
already promised, so this is a bug fix, not a new key under the feature freeze
(ADR-0117). Alternative set aside: threading the config through every
runScrape caller (collect.mjs, research-run.mjs, decompose.mjs). That is three
call sites to keep in step, against one default where the adapter is, the pattern
transport.mjs already uses (config ?? loadConfig(env)). No ADR: one obvious remedy.
What it touched (the two map rows were re-applied over main's rewrite of them in
the rebase): research-kit/lib/machine.mjs, research-kit/lib/browser-transport.mjs
(imports loadConfig from machine.mjs; machine.mjs imports only core.mjs, so there
is no cycle); research-kit/test/machine.test.mjs and
research-kit/test/browser-transport.test.mjs (one test each);
docs/ARCHITECTURE.md (the machine.mjs and browser-transport.mjs rows); README.md
(the machine-config table gains its browserPath row); CHANGELOG.md (Unreleased);
research-kit/README.md (test count 1782 -> 1784).
What you verified:
- verified: both new tests failed before the fix (selftest.mjs machine
browser-transport, cwd /home/user/rk-fix: 55 passed, 2 failed; loadConfig gave
undefined, and the scrape ran /opt/pw-browsers/chromium instead of the
configured binary) and pass after it (57 passed).
- verified: full suite after rebasing both commits onto d6035da, cwd
/home/user/rk-fix, Node v22.22.0 on Linux: 1782 passed, 2 failed, 1784 in all,
the count now in the README. The two failures are
the runtime G7 windows-1252 tests that fail identically on unmodified main: this
host's TextDecoder('windows-1252') decodes 0x80 as U+0080.
- expected: existing browser tests pass browserPath or config explicitly, so the
new loadConfig default is not reached in them; the full run above agrees.
- untested: Windows and the Node 24/26 CI legs.
What you got wrong and fixed: nothing to report.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011D7RsVpgAUVb6VqZpjoV711 parent ea4f9c8 commit e3bca63
8 files changed
Lines changed: 50 additions & 7 deletions
File tree
- docs
- research-kit
- lib
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
8 | 13 | | |
9 | 14 | | |
10 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
606 | 606 | | |
607 | 607 | | |
608 | 608 | | |
| 609 | + | |
609 | 610 | | |
610 | 611 | | |
611 | 612 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
561 | 561 | | |
562 | 562 | | |
563 | 563 | | |
564 | | - | |
| 564 | + | |
565 | 565 | | |
566 | 566 | | |
567 | 567 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
255 | | - | |
| 256 | + | |
256 | 257 | | |
257 | 258 | | |
258 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
259 | 262 | | |
260 | 263 | | |
261 | 264 | | |
| |||
402 | 405 | | |
403 | 406 | | |
404 | 407 | | |
405 | | - | |
406 | | - | |
| 408 | + | |
| 409 | + | |
407 | 410 | | |
408 | 411 | | |
409 | 412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
168 | 169 | | |
169 | 170 | | |
170 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
171 | 176 | | |
172 | 177 | | |
173 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
228 | 246 | | |
229 | 247 | | |
230 | 248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
150 | 161 | | |
151 | 162 | | |
152 | 163 | | |
| |||
0 commit comments