Skip to content

docs(claude): add Promise.race handler-stacking rule#1241

Open
John-David Dalton (jdalton) wants to merge 1 commit intomainfrom
docs/claude-promise-race-rule
Open

docs(claude): add Promise.race handler-stacking rule#1241
John-David Dalton (jdalton) wants to merge 1 commit intomainfrom
docs/claude-promise-race-rule

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

@jdalton John-David Dalton (jdalton) commented Apr 19, 2026

Summary

  • Adds a concise rule under SHARED STANDARDS documenting the Promise.race / Promise.any handler-stacking anti-pattern described in nodejs/node#17469 and @watchable/unpromise.
  • Preventive, not reactive — no current socket-cli code exhibits the pattern. Prompted by fixes in sibling repos where the same pattern had crept in: socket-sdk-js#600 and socket-lib#184.

Test plan

  • Docs-only change — no test plan required.

Note

Low Risk
Docs-only change in CLAUDE.md; no runtime or behavioral impact beyond updated engineering guidance.

Overview
Adds a new SHARED STANDARDS guideline in CLAUDE.md warning against using Promise.race/Promise.any with long-lived promises inside loops due to accumulating .then handlers, and recommends safer concurrency-limiter signaling patterns (with references to nodejs/node#17469 and @watchable/unpromise).

Reviewed by Cursor Bugbot for commit c89ed2e. Configure here.

Documents the leak anti-pattern so future concurrency code in
socket-cli does not reintroduce it. See nodejs/node#17469.

Prompted by fixes in sibling repos (socket-sdk-js #600,
socket-lib #184) where the pattern had crept in.
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.

1 participant