Commit b9434ee
fix(repl): surface CDP protocol errors and fix race in wait_for_response (#33190)
## Summary
- The REPL's `wait_for_response` silently swallowed CDP error responses
(responses with an `"error"` field instead of `"result"`), converting
them to `null`. This made the `npm_packages` test failure on Windows
ARM64 impossible to diagnose — the actual V8 error was lost and replaced
by a confusing serde message (`invalid type: null, expected struct
EvaluateResponse`).
- Log CDP protocol errors via `eprintln!` so they appear in test stderr
output on the next CI failure
- Fix TOCTOU race: hold the lock across both the "check if ready" and
"register WaitingFor" steps in `wait_for_response` to prevent a response
from being overwritten between the two operations
- Apply the same fixes to the duplicated code in `hmr.rs`
## Motivation
The `integration::repl::npm_packages` test has become nearly constantly
failing on Windows ARM64 CI
([example](https://github.com/denoland/deno/actions/runs/24003416554/job/70004374515)).
The error output is:
```
"undefined\nerror: invalid type: null, expected struct EvaluateResponse\n" does not contain any of ["hello"]
```
This means V8's `Runtime.evaluate` returned a CDP protocol error, but
the actual error message was discarded. With this change, the next CI
failure will print the real V8 error to stderr, allowing us to identify
and fix the root cause.
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 11db67a commit b9434ee
File tree
3 files changed
+70
-32
lines changed- cli/tools
- repl
- run
- tests/integration
3 files changed
+70
-32
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
269 | 277 | | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
278 | 292 | | |
279 | 293 | | |
280 | 294 | | |
| |||
410 | 424 | | |
411 | 425 | | |
412 | 426 | | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
413 | 438 | | |
414 | 439 | | |
415 | 440 | | |
| |||
889 | 914 | | |
890 | 915 | | |
891 | 916 | | |
892 | | - | |
| 917 | + | |
893 | 918 | | |
894 | 919 | | |
895 | 920 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
308 | 316 | | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
318 | 331 | | |
319 | 332 | | |
320 | 333 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
922 | 922 | | |
923 | 923 | | |
924 | 924 | | |
| 925 | + | |
925 | 926 | | |
926 | | - | |
927 | 927 | | |
928 | 928 | | |
929 | 929 | | |
| |||
938 | 938 | | |
939 | 939 | | |
940 | 940 | | |
| 941 | + | |
941 | 942 | | |
942 | | - | |
943 | 943 | | |
944 | 944 | | |
945 | 945 | | |
| |||
0 commit comments