fix(diagnostics_channel): make channel.hasSubscribers a getter property#6601
fix(diagnostics_channel): make channel.hasSubscribers a getter property#6601jasnell merged 3 commits intocloudflare:mainfrom
Conversation
Node.js' `Channel.hasSubscribers` and `TracingChannel.hasSubscribers` as being boolean getter properties, not functions. https://nodejs.org/dist/latest-v20.x/docs/api/diagnostics_channel.html#channelhassubscribers This is a breaking change to fix this incompatibility with Node.
guybedford
left a comment
There was a problem hiding this comment.
Thanks for posting the fix.
That makes sense. I'll add a compat flag and report back. Thanks! |
|
Added the compat flag and opened a docs PR. Set a placeholder compat date of 2026-05-01, but that might be too early so feel free to suggest a date you think is more reasonable. (The add-compat-flag SKILL was extremely useful!) |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6601 +/- ##
==========================================
- Coverage 70.85% 66.57% -4.29%
==========================================
Files 438 405 -33
Lines 123644 117527 -6117
Branches 19455 19381 -74
==========================================
- Hits 87608 78239 -9369
- Misses 24509 27716 +3207
- Partials 11527 11572 +45 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Manual run of the internal build job is clear. Doc PR opened. Merging. |
Node.js'
Channel.hasSubscribersandTracingChannel.hasSubscribersas being boolean getter properties, not functions. In workerd, they are currently implemented as functions which means that if anyone tries to do something likehttps://nodejs.org/dist/latest-v20.x/docs/api/diagnostics_channel.html#channelhassubscribers
This should make workerd's behavior match Node.js for diagnostics_channel. I've added a couple tests here but I'm open to suggestions for ways to improve this if needed.
Here is a worker demonstrating the issue: https://diagnostics-channel-hassubscribers-bug.pranoydll.workers.dev/