fix(buffer): distinguish Uint8Array in Buffer.isBuffer - #9205
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthrough
ChangesBuffer identity predicate
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Buffer.isBuffer now distinguishes constructor-created Uint8Array values from Node Buffers without changing broader APIs that accept either representation. No actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant main_ts
participant BufferIsBuffer
participant nm_dispatch_buffer
participant js_buffer_is_node_buffer
main_ts->>BufferIsBuffer: call Buffer.isBuffer directly or through predicate
BufferIsBuffer->>nm_dispatch_buffer: dispatch Buffer.isBuffer
nm_dispatch_buffer->>js_buffer_is_node_buffer: pass NaN-boxed value as I64
js_buffer_is_node_buffer-->>nm_dispatch_buffer: return I32 identity result
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description explains the behavior change, implementation intent, linked issue, and test commands. It does not reproduce the template's separate Changes, Related issue, Test plan, and Checklist sections, but it contains the required information and is mostly complete. Full details: Linked Issues checkExplanation The PR satisfies issue Full details: Docstring CoverageExplanation Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 6 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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. Comment |
|
Merged. This closes #9179, which I filed while auditing #9176, and it takes the approach the issue argued for rather than the tempting shortcut. The tempting version is to narrow Nice that the discriminator reuses Validation: the exact reproducer from #9179 now prints Heads-up on a collision: #9213 ("fix(runtime): distinguish Buffer from Uint8Array", closing #9173) is yours too and overlaps this heavily — same |
Summary
Fixes #9179
Testing
Summary by CodeRabbit
Bug Fixes
Buffer.isBuffer()now correctly returnsfalsefor plainUint8Arrayinstances and objects, matching Node.js behavior.Uint8Arrayvalues where applicable.Tests
Buffer.isBuffer().