Files
pulse/frontend-modern
rcourtman 413ca4e7b5 fix(websocket): apply resource deltas to the raw server baseline
The rc.9 delta stream (962d29780) diffs resources against the server's
per-client snapshot, but the client applied those patches to its
canonically merged store. On estates where the canonical coalesce folds
agent and runtime-platform hosts into one resource the two domains
disagree: a merge patch for a coalesced-away ID materialised as a
typeless stub resource, and a server-side removal of the merged
carrier's ID deleted both facets with nothing ever re-adding the
survivor. Resources then vanished progressively — platform tabs
included, since navigation visibility derives from state.resources.
Reported on the #1601 rc.9 retest for both admin and read-only users;
the 403s in that report are an unrelated non-admin update poll.

Keep a pristine copy of the server's resource array, apply deltas to
that raw baseline (the exact objects the server diffed against), then
derive the canonical view through the same merge the full-snapshot path
already uses. Delta application now converges to the same state a full
snapshot would produce, by construction. The raw baseline stays
isolated from the store: entries are structuredClone'd before the
canonical merge because the merge output shares nested references and
reconcile mutates adopted objects in place. A delta arriving before any
full snapshot (for example after an oversized initial payload was
dropped) now requests a full snapshot instead of patching nothing.

The flipped status assertion in websocket-unified.test.ts is
deliberate: the old delta path deleted keys that the canonical merge
preserves, so it disagreed with the full-snapshot path; the assertion
now pins delta/full parity.

Refs #1601

Contract-Neutral: client-side websocket delta application fix; wire protocol and payload shapes unchanged
2026-08-07 17:23:26 +01:00
..
2026-08-07 10:03:16 +01:00