Skip to content

test: unflake debugger and REPL tests#64718

Open
mcollina wants to merge 2 commits into
nodejs:mainfrom
mcollina:fix-macos-test-flakes
Open

test: unflake debugger and REPL tests#64718
mcollina wants to merge 2 commits into
nodejs:mainfrom
mcollina:fix-macos-test-flakes

Conversation

@mcollina

@mcollina mcollina commented Jul 24, 2026

Copy link
Copy Markdown
Member

Refs: https://github.com/nodejs/node/actions/runs/30080039199/job/89439279468?pr=64339

The macOS job exposed two independent races:

  • The debugger could start its REPL before a delayed Debugger.paused
    notification rendered the initial break. The job had already printed the
    debug> prompt when test-debugger-extract-function-name timed out waiting
    for the break message. Create the initial-break deferred before resuming the
    target, await the completed render, and settle the deferred if the client
    closes without pausing.
  • test-repl-user-error-handler could receive an inspector
    Promise was collected evaluation error before the user error it intended to
    assert. Give this focused handleError test a synchronous VM evaluator,
    submit the throwing and follow-up expressions separately, and await clean
    REPL teardown.

The debugger mock test now delays both the pause notification and its render,
which reproduces the prompt-ordering race deterministically without the fix.
The REPL failure reproduced locally on macOS after rebuilding current main.

mcollina added 2 commits July 24, 2026 16:59
Create the initial-break deferred before resuming the target. A delayed
Debugger.paused notification can no longer arrive after the REPL prompt.

Resolve the deferred on client close when no pause occurs.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
Use a synchronous VM evaluator so the test exercises handleError
without depending on inspector promise retention.

Feed the throwing input separately and wait for REPL exit to avoid
overlapping evaluation and teardown.

Signed-off-by: Matteo Collina <hello@matteocollina.com>
@nodejs-github-bot nodejs-github-bot added debugger Issues and PRs related to the debugger subsystem. needs-ci PRs that need a full CI run. labels Jul 24, 2026

@avivkeller avivkeller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but note that the flake won't be entirely resolved until https://chromium-review.googlesource.com/c/v8/v8/+/8123081 lands1

Footnotes

  1. Running async, as you've done, makes this far more unlikely, but there's still a (albeit <0.1% chance, per my testing) chance of it catching itself, if GC occurs at a poor time

@avivkeller avivkeller added the repl Issues and PRs related to the REPL subsystem. label Jul 24, 2026
@mcollina mcollina added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 24, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 24, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.12%. Comparing base (c558c8e) to head (58ed4da).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64718      +/-   ##
==========================================
- Coverage   90.15%   90.12%   -0.03%     
==========================================
  Files         741      743       +2     
  Lines      242251   242313      +62     
  Branches    45624    45634      +10     
==========================================
+ Hits       218391   218395       +4     
- Misses      15351    15424      +73     
+ Partials     8509     8494      -15     
Files with missing lines Coverage Δ
lib/internal/debugger/inspect_repl.js 92.07% <100.00%> (+0.76%) ⬆️

... and 58 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debugger Issues and PRs related to the debugger subsystem. needs-ci PRs that need a full CI run. repl Issues and PRs related to the REPL subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants