Skip to content

test(gap): #9552 fixture that fails unfixed; changelog fragment for #9565 - #9571

Closed
proggeramlug wants to merge 1 commit into
mainfrom
fix/9552-gap-test-discriminates
Closed

test(gap): #9552 fixture that fails unfixed; changelog fragment for #9565#9571
proggeramlug wants to merge 1 commit into
mainfrom
fix/9552-gap-test-discriminates

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Follow-through for #9552 / #9565, which landed via merge train #9569 before this branch's last two commits.

Why

The gap test the train carried (test_gap_9552_cross_thread_promise_survives_gc.ts, first draft) passes 6/6 on the unfixed runtime: await fetch() in a plain async function keeps the promise reachable from the awaiting frame, and gc() alone does not run the malloc sweep that freed the promise in the report. A gate that cannot fail is not a gate.

What this lands

  • The fixture validated on both arms: three consumer shapes (.then, async arrow, async class method) each start a fetch against a local server that answers late, from a frame that has returned before any collection; Symbol() churn trips the malloc-count sweep (GC_NEXT_MALLOC_TRIGGER = 100k), RegExp headers reuse freed 80-byte slots (the promise's size class). Unfixed: hangs 4/4 — an env-gated trace shows two of the three promises FREED by malloc sweeps at state=0, then STALE js_promise_resolve on a slot now holding another object. Fixed: ok,ok,ok 6 5/5, byte-identical to node (gc is conditional).
  • changelog.d/9565-cross-thread-promise-pin.md: the fragment for the fix itself; the train did not carry one.

https://claude.ai/code/session_01Bok4V8wzgNGmBeE4GPf7Up

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability for cross-thread promises during memory cleanup, preventing potential crashes while asynchronous operations are still in progress.
    • Promise lifetimes are now managed until operations settle, including native and asynchronous workflows.
  • Tests

    • Expanded regression coverage across multiple promise usage patterns.
    • Added stress testing with delayed responses and repeated memory-allocation activity.

…9565

The #9552 fix landed via merge train #9569 with the first draft of its gap
test. That draft — `await fetch()` in a plain async function plus `gc()` —
passed 6/6 on the UNFIXED runtime: the collection it forces does not free
the in-flight promise, so the gate could not fail. This is the fixture
validated on both arms: three consumer shapes (`.then`, async arrow, async
class method) start a request from a frame that has returned, `Symbol()`
churn trips the malloc-count sweep, `RegExp` headers reuse freed 80-byte
slots. Unfixed it hangs 4/4 (two of the three promises freed by malloc
sweeps, then a stale resolve on a reused slot); fixed it prints node's
`ok,ok,ok 6` 5/5.

Also lands the changelog fragment for #9565, which the train did not carry.

Claude-Session: https://claude.ai/code/session_01Bok4V8wzgNGmBeE4GPf7Up
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 85577470-d51d-48a4-b64b-368f64e7d75d

📥 Commits

Reviewing files that changed from the base of the PR and between ef956db and 85b905f.

📒 Files selected for processing (2)
  • changelog.d/9565-cross-thread-promise-pin.md
  • test-files/test_gap_9552_cross_thread_promise_survives_gc.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The changelog documents cross-thread promise pinning and provenance checks. The regression test keeps three fetch-based promise consumers in flight while allocation churn triggers garbage collection.

Changes

Cross-thread promise GC handling

Layer / File(s) Summary
Promise GC regression test and fix record
test-files/test_gap_9552_cross_thread_promise_survives_gc.ts, changelog.d/9565-cross-thread-promise-pin.md
The test covers no-await, async arrow, and async class method consumers during Symbol and RegExp churn. The changelog records promise pinning, pin release, provenance checks, lint coverage, and validation results.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 85b90

This change strengthens regression coverage and documents an existing runtime fix without altering production behavior. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies both primary changes: the regression fixture for #9552 and the changelog fragment for #9565.
Description check ✅ Passed The description clearly explains the purpose, implementation, related issues, and validation results. It omits the template headings and explicit checklist commands, but it provides the required infor…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the purpose, implementation, related issues, and validation results. It omits the template headings and explicit checklist commands, but it provides the required information in equivalent sections and is mostly complete.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/9552-gap-test-discriminates

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed via merge train #9573 (rebase-merge, authorship preserved).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant