Skip to content

fix: a claim tests each port once, and skips the unlocked plan when it must write - #92

Merged
OhadC merged 1 commit into
mainfrom
claim-hang-double-port-tests
Nov 21, 2026
Merged

OhadC merged 1 commit into
mainfrom
claim-hang-double-port-tests

Conversation

@OhadC

@OhadC OhadC commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Part of #87. Part 1 (the hang on a connected client) is left out: it can't be reproduced.

Summary

 RangeRegistry.claim
-  plan without the lock
-  if plan changes nothing: return it
+  if not move and the folder has a readable range
+    plan without the lock
+    if plan changes nothing: return it
   under the lock
     plan again, write
 planClaim
-  testPort(port)          # keep and place each bind the same ports
+  testPortOnce(port)      # one result per port, per plan; inUse read from it

Evidence

  • Before: port tests recorded during a claim:
    • first claim: [21000, 21001, 21000, 21001]
    • move: [21000, 21001, 21000, 21001]
    • stored range that lost a port, one plan: [21010, 21011, 21010, 21011, 21000, 21001]
  • After: [21000, 21001], [21000, 21001], [21010, 21011, 21000, 21001]
  • The fix: claim that changes nothing reads the registry without locking or writing #81 tests for a claim that changes nothing are unedited and pass.
  • pnpm verify is green: 354 passed, 6 skipped.

Merge Danger

Door: two-way

Blast Radius: small

Only the internals of RangeRegistry.claim change; its API is the same. The only visible effect is a faster first claim or move.

@OhadC
OhadC merged commit 03c1e8e into main Nov 21, 2026
12 checks passed
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