Skip to content

Fix: reconcile live expedition state without rebuilding the Realm#68

Closed
ael-dev3 wants to merge 1 commit into
agent/stone-quarry-nodefrom
agent/four-worker-realm-system
Closed

Fix: reconcile live expedition state without rebuilding the Realm#68
ael-dev3 wants to merge 1 commit into
agent/stone-quarry-nodefrom
agent/four-worker-realm-system

Conversation

@ael-dev3

Copy link
Copy Markdown
Owner

What changed

This is PR A of the four-worker release train. It keeps live gathering updates inside one persistent Realm scene.

  • Split immutable Gold/Food/Wood/Stone site catalogs from occupation-bearing live rows in RealmMapScreen.
  • Add RealmSceneHandle.reconcileLiveGatheringState so resource layers update occupation rings, wagons, and telemetry in place.
  • Preserve static models, pick volumes, renderer, camera controller, pointer listeners, labels, and selection across public occupation updates.
  • Add guarded reconciliation that rejects malformed topology/dynamic snapshots and retains the last valid presentation.
  • Add development QA attestation for scene build sequence, canvas/scene identity, camera mode/pose/target/FOV/zoom, and selection.
  • Add a deterministic regression test and a dated worker-system plan.

Why

Before this change, the scene-construction effect depended on goldNodes, foodNodes, woodNodes, and stoneNodes. Those arrays intentionally changed when occupation phase, timestamps, or origin-castle state changed. A successful dispatch therefore disposed and rebuilt the entire WebGL scene, called setCameraMode('realm'), and could leave the player in the reported overview-like camera state until reload.

The scene-construction effect now depends only on stable site topology. Live occupation updates reconcile through the persistent scene handle and never call camera reset or renderer loading state.

Dependency / stack

This branch is intentionally stacked on the exact refreshed head of Stone Quarry PR #65:

Evidence

The new scene regression injects an outbound-to-gathering occupation update and asserts:

  • scene build sequence unchanged;
  • canvas identity unchanged;
  • scene identity unchanged;
  • camera mode, position, target, and zoom unchanged;
  • one ordinary render occurs;
  • accepted reconciliation telemetry increments.

Checks run:

  • tsc -b
  • vitest run: 181 files, 1,638 tests passed
  • spacetimedb/tsconfig.json TypeScript check
  • runtime asset verification (40 exact runtime assets)
  • Gold/Food/Wood/Stone/Tree/Supply Wagon verification
  • Vite production build
  • production-output exclusion audit
  • git diff --check

Scope boundary

This PR fixes scene stability and is not the generic four-worker authority migration. PR B will append the next schema generation after Stone v9, add exactly four server-owned workers per castle, generic dispatch/recall/claim, worker selection/roster UX, and the staged legacy cutover gate.

No SpacetimeDB schema, reducer, binding, production data, seed, deployment, or publish action is included here.

@ael-dev3

Copy link
Copy Markdown
Owner Author

Superseded by merged PR #72. The live-state reconciliation work was integrated there with an atomic all-layer preflight so a later projection failure cannot leave the Realm partially mutated.

@ael-dev3 ael-dev3 closed this Jul 19, 2026
@ael-dev3
ael-dev3 deleted the agent/four-worker-realm-system branch July 19, 2026 18:55
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