Skip to content

fix(hosts): unsubscribe connection topics and keep the old socket until commit - #103

Merged
wstein merged 1 commit into
mainfrom
fix/88-pubsub-close-order
Oct 16, 2026
Merged

wstein merged 1 commit into
mainfrom
fix/88-pubsub-close-order

Conversation

@wstein

@wstein wstein commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Implements #88: connection topics and close order.

  • The old connection closes as :replaced only after the replacement transaction commits; a failed replacement keeps the existing socket open and admitted.
  • close_result unsubscribes the host topic, so each host keeps at most one subscription across reconnects.
  • A replaced connection no longer writes its own host_connection_unknown audit (the slot already names the new connection). Auditing liveness transitions, including replacement, is defined in fix(hosts): audit only liveness transitions, not every heartbeat #101 (H57:a).

Both new tests fail without the fix. Review: CLEAR (Opus 5.5) on 3eff33f. make check on this head is pending. Stacked on #100 (#87).

🤖 Generated with Claude Code

@wstein
wstein force-pushed the fix/88-pubsub-close-order branch from 3eff33f to ea86f0f Compare October 16, 2026 10:35
@wstein

wstein commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

Review CLEAR on 3eff33f (Opus 5.5). Restacked onto #100 4129072; range-diff identical. make check on this head: pending.

@wstein
wstein force-pushed the fix/88-pubsub-close-order branch from ea86f0f to 4c2daf7 Compare October 16, 2026 10:42
@wstein

wstein commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

Rebased onto main 54a002f after #95 merged; git range-diff shows every patch identical (for #83 only one context line in docs/index.md differs), so the review carries to 4c2daf7. make check on this head: pending.

@wstein
wstein marked this pull request as ready for review October 16, 2026 10:55
@wstein

wstein commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

Ready per owner: review CLEAR on this head; local make check replaced by one final check on main after the stack merges (owner rule).

@wstein

wstein commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

Restacked onto pilot 866e46c; git range-diff identical, review carries to this head.

@wstein
wstein force-pushed the fix/88-pubsub-close-order branch from ee9b025 to bf0aa0c Compare October 16, 2026 11:33
@wstein

wstein commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

Restacked onto main e82167b after #96/#91 merged; range-diff identical, review carries to bf0aa0c.

@wstein
wstein added this pull request to stack #108 October 16, 2026 12:04
Base automatically changed from fix/87-heartbeat-codes-audits to main October 16, 2026 12:04
…commit

Each reconnect added a duplicate PubSub Registry entry, so identity_changed
triggered N sweeps and grew over uptime. The old socket was also closed as
replaced before the replacement slot transaction committed, so a failed
replacement dropped the healthy socket and admitted none.

Unsubscribe when a connection closes, and close the predecessor only after
the replacement commits. Tests cover repeated reconnects and a failed
replacement; both fail without the fix.

Refs: #88

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@wstein
wstein force-pushed the fix/88-pubsub-close-order branch from bf0aa0c to e5c5e66 Compare October 16, 2026 12:04
@wstein
wstein merged commit e19ccf8 into main Oct 16, 2026
2 checks passed
@wstein
wstein deleted the fix/88-pubsub-close-order branch October 16, 2026 12:04
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