Rxova
Skip to content

WIRE_VERSION

const WIRE_VERSION: 1 = 1;

The wire protocol this build speaks. Stamped as v on everything posted, and required to match on everything received.

Every rolling deploy produces version skew: a tab opened this morning is still running last week’s bundle while the tab opened after lunch is running today’s, and both are on the same origin talking over the same bus. The contract that makes that safe has two halves.

Across versions, partition — loudly. A wire whose v is not this one is dropped rather than guessed at, because the only thing a build knows about another protocol version is that it does not know it. Dropping alone would be the silent-degradation failure this library exists to avoid, so a foreign version is also recorded on the page (getWireSkew) and warned about once in development. The two builds still each work, still each sync with their own generation, and the fact that they cannot see each other is observable rather than something to be discovered from a bug report.

Within a version, evolve additively. A new type on an existing scope may be added without bumping v, on one condition: every engine dispatches on the types it knows and ignores the rest. A build that has never heard of state/remove must treat it as nothing, not as a malformed something — which is why no dispatch here ends in a bare else. New fields on an existing type follow the same rule: readers must tolerate their absence, because half the tabs on the origin were built before the field existed.

Bump v only for a change that breaks those rules — a field whose meaning changes, a type that stops being sent, a value that stops being comparable. Bumping is not a failure; it is the honest signal, and it is cheap because the generations partition cleanly instead of corrupting each other.