Skip to content

fix(ext/node): support thenables in util.callbackify() - #37118

Open
briankeefe wants to merge 1 commit into
denoland:mainfrom
briankeefe:fix/callbackify-thenables-canary
Open

briankeefe wants to merge 1 commit into
denoland:mainfrom
briankeefe:fix/callbackify-thenables-canary

Conversation

@briankeefe

Copy link
Copy Markdown

Problem

util.callbackify() applies the intrinsic Promise.prototype.then to its return value, so ordinary thenables throw instead of delivering their result. This reproduces the thenable failure in parallel/test-util-callbackify.js in the current Node-compat results.

Change

Invoke the returned object's own then through FunctionPrototypeCall, preserving its receiver and the existing next-tick delivery and falsy-rejection handling. Add fulfillment/rejection regressions. No vendored fixtures, skips, or compatibility expectations change.

Verification

  • Built the edited Deno source with ./x build on Linux x86_64.
  • The two added regression bodies, copied unchanged into a standalone runner with the unit file's process initialization: released Deno 2.9.8 0 passed / 2 failed; source-built patched Deno 2 passed / 0 failed.
  • Additional real-runtime checks passed for native Promises, thenables, receivers, argument forwarding, next-tick delivery, falsy rejections, return value, and synchronous exceptions. Node v26.12.1 provides the behavior oracle.
  • Project JS lint, project formatter checks on both changed files, and unit-file type checking passed.

The Cargo test harnesses and full CI have not been run. The unchanged upstream compatibility fixture advances past the thenable cases but still fails a separate falsy-rejection stack-frame assertion, also reproducible on released Deno. It is not marked passing or skipped by this patch.

AI disclosure: The implementation and tests were authored using OMP with GPT-6.1 Sol and received a separate AI-assisted review. The runtime/test results above were actually executed; this draft does not claim human code review or full-suite success.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


OMP Canary (AI-assisted) seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
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.

2 participants