[DO NOT MERGE] feat(sdk): hydration FSM — deterministic late-join and reconnect convergence - #1520
Draft
cyaiox wants to merge 1 commit into
Draft
[DO NOT MERGE] feat(sdk): hydration FSM — deterministic late-join and reconnect convergence#1520cyaiox wants to merge 1 commit into
cyaiox wants to merge 1 commit into
Conversation
…ergence
Phase 1 of the authoritative-server network refactor. Fixes the core
divergence class ('some players see it, some don't'):
- network/hydration.ts: pure state machine (DISCONNECTED → CONNECTED →
REQUESTING_STATE → SYNCED) replacing the loose booleans in
message-bus-sync; a stray RES_CRDT_STATE from a non-server peer is
unrepresentable as an FSM event (unique-symbol constructor), so the
retry-halt bug is structurally impossible
- REQ_CRDT_STATE responder is server-gated: clients no longer hand out
their partial world view to late joiners
- re-hydration reconciliation: a full state dump now removes local
NetworkEntity-tagged entities it omits (ghost cleanup after
reconnect); multi-chunk dumps accumulate before reconciling; tag is
dropped before removal so cleanup never broadcasts deletions
- SERVER_ANNOUNCE (additive CommsMessage 10): the server names its run
generation on ready and per state request; clients seeing a new
generation re-hydrate, so a server restart converges automatically
- comms arriving before the isServer role resolves is buffered and
replayed in order (capped, loud on overflow) instead of being
misrouted down the client path
- isStateSyncronized() is now true on a ready server
- RealmInfo observed on the injected engine, not the global singleton
Red defect tests #1, #2, #6, #7, #9, #14 flip to passing; #3, #4, #8,
#10, #11, #12, #13 verified still red. Two QUIRK pins migrated from the
characterization suite to the red suite per the TDD discipline. New
specs: hydration-fsm (25 unit tests, no engine), late-join-hydration,
reconnect-convergence — all ending in the cross-engine convergence
oracle.
Claude-Session: https://claude.ai/code/session_01Kzo6zwrn1CA79S4RN1dgsU
Deploying js-sdk-toolchain with
|
| Latest commit: |
f3e9e79
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://cbf46408.js-sdk-toolchain.pages.dev |
| Branch Preview URL: | https://stack-03-hydration-fsm.js-sdk-toolchain.pages.dev |
This was referenced Aug 5, 2026
Contributor
Test this pull request
|
cyaiox
marked this pull request as draft
August 5, 2026 14:24
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.
Phase 1 of the authoritative-server network refactor. Fixes the core
divergence class ('some players see it, some don't'):
REQUESTING_STATE → SYNCED) replacing the loose booleans in
message-bus-sync; a stray RES_CRDT_STATE from a non-server peer is
unrepresentable as an FSM event (unique-symbol constructor), so the
retry-halt bug is structurally impossible
their partial world view to late joiners
NetworkEntity-tagged entities it omits (ghost cleanup after
reconnect); multi-chunk dumps accumulate before reconciling; tag is
dropped before removal so cleanup never broadcasts deletions
generation on ready and per state request; clients seeing a new
generation re-hydrate, so a server restart converges automatically
replayed in order (capped, loud on overflow) instead of being
misrouted down the client path
Red defect tests #1, #2, #6, #7, #9, #14 flip to passing; #3, #4, #8,
#10, #11, #12, #13 verified still red. Two QUIRK pins migrated from the
characterization suite to the red suite per the TDD discipline. New
specs: hydration-fsm (25 unit tests, no engine), late-join-hydration,
reconnect-convergence — all ending in the cross-engine convergence
oracle.
Claude-Session: https://claude.ai/code/session_01Kzo6zwrn1CA79S4RN1dgsU
🤖 Generated with Claude Code
https://claude.ai/code/session_01Kzo6zwrn1CA79S4RN1dgsU
📚 Stack (splits #1505 — merge top-down within each stack)
Network layer (each PR is one self-contained, independently-green commit):
sdk-commands (independent of the stack above):
After a parent squash-merges, the child needs
git rebase --onto origin/auth-server <old-parent> <child>— ping the session and it gets restacked.