Skip to content

diagnostics_channel: return original thenable#62407

Open
Qard wants to merge 1 commit into
nodejs:mainfrom
Qard:trace-promise-return-original-thenable
Open

diagnostics_channel: return original thenable#62407
Qard wants to merge 1 commit into
nodejs:mainfrom
Qard:trace-promise-return-original-thenable

Conversation

@Qard

@Qard Qard commented Mar 23, 2026

Copy link
Copy Markdown
Member

This makes tracePromise return the original thenable to allow custom thenable types to retain their methods rather than producing the chained result type.

This branches the behaviour between native promises and thenables such that native promises retain the correct unhandledRejection behaviour while thenables produce the correct original return value and so retain methods present on that type.

I think that because native promises are consistently shaped it doesn't actually matter that it remains chained rather than branched.

cc @nodejs/diagnostics

@Qard Qard self-assigned this Mar 23, 2026
@Qard Qard added confirmed-bug Issues with confirmed bugs. diagnostics_channel Issues and PRs related to diagnostics channel labels Mar 23, 2026
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Mar 23, 2026
Comment thread lib/diagnostics_channel.js Outdated
@Qard Qard force-pushed the trace-promise-return-original-thenable branch from fc213c4 to 3eb07ea Compare March 23, 2026 14:41
@codecov

codecov Bot commented Mar 23, 2026

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 89.77%. Comparing base (efa05f2) to head (3522e89).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #62407   +/-   ##
=======================================
  Coverage   89.77%   89.77%           
=======================================
  Files         697      697           
  Lines      215773   215782    +9     
  Branches    41304    41300    -4     
=======================================
+ Hits       193704   193713    +9     
+ Misses      14162    14158    -4     
- Partials     7907     7911    +4     
Files with missing lines Coverage Ξ”
lib/diagnostics_channel.js 98.16% <100.00%> (+0.02%) ⬆️

... and 32 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.

Comment thread lib/diagnostics_channel.js Outdated

@Renegade334 Renegade334 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.

Does this change have a specific case in mind? The A+ standard mandates .then() to return another "promise" instance (either the same object or a new object at the implementation's discretion), so any custom features of a compliant thenable should also be present on the object returned by .then()?

Comment thread lib/diagnostics_channel.js Outdated
@Qard

Qard commented Mar 24, 2026

Copy link
Copy Markdown
Member Author

No, that is not the case. A thenable can return any variety of promise, not necessarily another of itself. It's most common that a thenable returns native promises from its then/catch, so you lose access to whatever methods it had when following the chain.

@Qard Qard requested review from Renegade334, bengl, jasnell, mcollina, mhofman and rochdev and removed request for mhofman and rochdev March 26, 2026 17:13
Comment thread lib/diagnostics_channel.js Outdated
@Qard Qard force-pushed the trace-promise-return-original-thenable branch from 3eb07ea to 3d95103 Compare March 26, 2026 18:23
Comment thread lib/diagnostics_channel.js Outdated
Comment thread lib/diagnostics_channel.js Outdated
@Qard Qard force-pushed the trace-promise-return-original-thenable branch from 3d95103 to c5fcc50 Compare March 26, 2026 21:27
@Qard Qard added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 26, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 26, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@Flarna Flarna added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 18, 2026
@github-actions github-actions Bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Jun 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor
Failed to start CI
- Validating Jenkins credentials
βœ”  Jenkins credentials valid
- Querying data for job/node-test-pull-request/72280/
[SyntaxError: Unexpected token '<', ..."    
  https://github.com/nodejs/node/actions/runs/27762715319

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@Qard Qard added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. labels Jun 19, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 19, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

This makes tracePromise return the original thenable to allow custom
thenable types to retain their methods rather than producing the
chained result type.

Signed-off-by: Stephen Belanger <admin@stephenbelanger.com>
@Qard Qard force-pushed the trace-promise-return-original-thenable branch from 1a3b143 to 09ee7c0 Compare June 19, 2026 17:04
@Qard Qard added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 19, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 19, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@Qard

Qard commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

Jenkins is passing. Github Actions seems to have an unrelated failure though.

@Qard Qard requested review from Flarna, Renegade334 and jasnell June 20, 2026 17:32
@Renegade334

Copy link
Copy Markdown
Member

Rebasing on a40bb49 would get GHA green, but rather than re-running everything, I suggest we just manually land this instead.

@Qard

Qard commented Jun 20, 2026

Copy link
Copy Markdown
Member Author

Does commit-queue actually consider GHA failures? I thought it only cared about Jenkins. My thinking was to just use that with that assumption.

@Renegade334

Copy link
Copy Markdown
Member

Does commit-queue actually consider GHA failures?

It would complain, aye.

   β„Ή  This PR was created on Mon, 23 Mar 2026 14:06:11 GMT
   βœ”  Approvals: 3
   ✘  1 GitHub CI job(s) failed:
   ✘    - aarch64-linux: with shared boringssl-0.20260526.0: FAILURE (https://github.com/nodejs/node/actions/runs/27838891443/job/82414639619)
   β„Ή  Last Full PR CI on 2026-06-20T12:05:56Z: https://ci.nodejs.org/job/node-test-pull-request/74305/
βœ”  Build data downloaded
   βœ”  Last Jenkins CI successful
--------------------------------------------------------------------------------
   βœ”  Aborted `git node land` session

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

Labels

confirmed-bug Issues with confirmed bugs. diagnostics_channel Issues and PRs related to diagnostics channel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants