mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-14 00:00:30 +00:00
f3d3434652
First increment of the resource-payload-static-metadata gap: the connected-infrastructure reporting projection was re-shipped whole (~55-60KB at 50-node scale) on every realtime broadcast even though measurement showed the only field that ever changes tick-to-tick is lastSeen, and the client deep-reconciled all 69 rich items per tick — the dominant reactive cost inside every websocket message after the resource merge itself. The projection now rides the same per-client keyed delta engine as resources. buildClientStateSnapshot keys it by id beside the resource map, and buildClientStateDelta emits connectedInfrastructureDelta with id-keyed JSON merge patches, removed ids, and order through one shared keyed-array builder. Measured on the mock estate the per-tick payload drops from ~55-60KB to 0.7-4KB of timestamp patches. Entries that cannot key by id fall the whole field back to plain whole-payload diffing, and keyed/unkeyed baseline transitions re-ship the full array once, so the keyed path can never corrupt the projection. The client mirrors the resource baseline pattern: full payloads establish an isolated raw baseline, deltas apply as merge patches through the now-generic keyed apply helper, and the store sync hands reconcile reference-stable objects for untouched items so a tick reconciles only what changed instead of deep-walking the projection. Deltas without a baseline are ignored and heal on the next full payload; the operator-input deferral gate carries the pending changed ids across a gesture and flushes them in the same coalesced batch. The remaining gap scope (snapshot-side static metadata such as canonicalIdentity alias history, ~609KB per snapshot) stays open under resource-payload-static-metadata.