-
Notifications
You must be signed in to change notification settings - Fork 5k
Remove dead code from resolver, install, event_loop, node_fs, fetch #36872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Jarred-Sumner
merged 3 commits into
main
from
claude/farm/f54c8967/dead-code-semver-valkey-resolver-strings
Aug 4, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Removing
ManagedTask::cancel()leaves the doc comment onrelease_queued_tasks_for_shutdownatsrc/jsc/event_loop.rs:735-742stale — it still namescancel()(and the already-goneSendQueue.close_next_tick/after_close_task) as the load-bearing rationale for thetask.tag != ManagedTaskguard at line 756. Per REVIEW.md "grep for every sibling site sharing the pattern", that comment should be updated (and the guard's remaining justification, if any, restated) in this PR. Not a runtime bug — behavior is unchanged.Extended reasoning...
What is stale
The PR deletes
ManagedTask::cancel()fromsrc/event_loop/ManagedTask.rsafter verifying zero call sites. That's correct — nothing invokes.cancel()on aManagedTask. But the doc comment onEventLoop::release_queued_tasks_for_shutdownatsrc/jsc/event_loop.rs:735-742still documentscancel()as the reasonManagedTaskentries are re-queued instead of freed at shutdown:With
cancel()deleted, this comment now describes a UAF hazard around a method that structurally cannot be called. Thetask.tag != ManagedTaskguard at line 756 is left with no live justification in prose.Why the PR's verification missed it
The PR description says every symbol was checked with
rg -w <symbol> src/ build/debug/codegen/ src/codegen/for zero hits outside its own definition. A prose reference inside a///doc comment doesn't show up as a caller torg -w cancel(there are dozens of unrelated.cancel()hits on other types), and the referencedSendQueue.close_next_tick/after_close_taskowners were already gone before this PR —rg 'close_next_tick|after_close_task' src/returns only this comment. So the comment was already partially stale; removingcancel()is what makes its central claim reference a nonexistent method.Step-by-step
ManagedTaskhas acancel()method that overwritesself.callbackwith a no-op. No code calls it.src/jsc/event_loop.rs:756special-casestask.tag != ManagedTaskso that__bun_release_task_at_shutdownnever consumes aManagedTask— they get re-queued and freed later indeinit()(line 783) via thecleanupfield.cancel()fromDropduringdestructOnExit, so freeing the box early would make thatcancel()a heap-UAF.cancel(). The named owners (SendQueue.close_next_tick,after_close_task) already exist nowhere insrc/.deinit()at :783 are still correct (behavior unchanged —ManagedTaskboxes are still freed viaheap::take+cleanupafterdestructOnExit), but the comment now points at a method that doesn't exist to explain why.Why this matters per REVIEW.md
REVIEW.md → Correctness → "Fix the whole class in the same PR … Grep for every sibling site sharing the pattern" and → One source of truth; update every consumer atomically both apply: a comment that names a symbol as its load-bearing rationale is a consumer of that symbol. REVIEW.md → Code style → "Delete dead code in the same PR that makes it dead" is what this PR is doing; the stale comment is a leftover of the same class.
REVIEW.md also says "Before deleting odd-looking code, git-blame why it was written — it is usually load-bearing." The next reader trying to understand why
ManagedTaskis special-cased at :756 will follow this comment to a method that no longer exists and owners that no longer exist, and can't tell whether the guard is still needed.Impact
None at runtime.
release_queued_tasks_for_shutdownanddeinit()behave identically before and after. This is purely a doc-comment/rationale drift.Fix
Update the doc comment at
src/jsc/event_loop.rs:735-742to either (a) delete thecancel()/SendQueueparagraph and restate the actual remaining reasonManagedTaskis deferred todeinit()(if one still exists — e.g.cleanupmay call into subsystems that aren't safe until afterdestructOnExit, or an owner still holds a raw back-pointer throughdestructOnExit), or (b) if no rationale remains, note that and consider dropping the special-case in a follow-up. Either way, the comment should stop namingcancel().