docs(claude): consolidate CLAUDE.md rules from stale branches#608
Merged
John-David Dalton (jdalton) merged 2 commits intomainfrom Apr 21, 2026
Merged
docs(claude): consolidate CLAUDE.md rules from stale branches#608John-David Dalton (jdalton) merged 2 commits intomainfrom
John-David Dalton (jdalton) merged 2 commits intomainfrom
Conversation
Fold the genuinely valuable guidance scattered across several now-stale
worktree branches (fix/promise-race-leak, chore/parallel-claude-rule,
docs/claude-fix-warnings-rule) into a single coherent pass on CLAUDE.md,
and pull in two rules the socket-repo-template gold standard already
carries but this repo was missing.
- Restructure the Promise.race guidance into a dedicated "### Promise.race
in loops" subsection with the template's Safe/Leaky/Fix triad — same
content, but the three-state framing is easier to apply at review time
than a single run-on bullet.
- Add null-prototype rule: `{ __proto__: null, ...rest }` is already the
idiom used throughout src/socket-sdk-class.ts and src/file-upload.ts
(config objects, internal state, return shapes); codify it so new
contributions follow suit and prototype pollution surface stays small.
- Add Linear-reference rule: keep code and PR history tool-agnostic.
Forward-looking — no violations currently in the repo.
Deliberately NOT pulled from template: the "NEVER use dynamic imports"
rule. SDK uses `await import('node:fs')` legitimately in two places
(socket-sdk-class.ts:1931, :3818) for lazy loading; a blanket ban would
be wrong here.
Replace the 6-line comment landed in #600 with the fuller narrative that was sitting uncommitted on the fix/promise-race-leak worktree — concrete walkthrough of the handler-stacking trap, what each piece of the single-waiter machinery is responsible for, and why the snapshot-and- clear dance in deliverStep/deliverError matters. No behavioral change; comments only. The mechanical fix already shipped in #600 (376a743); this captures the reasoning someone will want when they look at this code six months from now.
Bill Li (billxinli)
approved these changes
Apr 21, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Consolidates the genuinely valuable content scattered across four now-stale worktree branches into one coherent PR, and pulls two rules from the
socket-repo-templategold standard that this repo was missing.CLAUDE.md changes
{ __proto__: null, ...rest }). Already the idiom acrosssrc/socket-sdk-class.tsandsrc/file-upload.ts; codifying it keeps prototype-pollution surface small.Promise.racebullet split into a dedicated### Promise.race in loopssubsection with Safe / Leaky / Fix framing (matches template). Also explicitly coversPromise.anyand long-lived interrupt-signal arms.src/socket-sdk-class.ts changes
Expands the 6-line comment landed in #600 with the fuller narrative that was sitting uncommitted on the
fix/promise-race-leakworktree — concrete walkthrough of the handler-stacking trap, what each piece of the single-waiter machinery is responsible for, and why the snapshot-and-clear dance indeliverStep/deliverErrormatters. No behavioral change; comments only.Deliberately NOT pulled from template
NEVER use dynamic imports (\await import()`)— the SDK usesawait import('node:fs')legitimately atsrc/socket-sdk-class.ts:1931and:3818` for lazy loading. A blanket ban would be wrong here.Test plan
oxfmt --checkpasses for both files