gobridge

0016 — Configuration content identity: compare the normal form, not the bytes

Status: accepted Date: 2026-09-21 Deciders: GoBridge core Relates to: 0012 (no-op reloads stay accepted), 0013 (the rollout candidate and committed-artifact digests are taken over the same form)

Context

Before the bridge replaces its runtime with a new configuration it checks whether the new configuration is the same as the running one, and skips the replacement when it is. Every accepted change replaces the whole runtime, so every session disconnects and connects again. The check therefore decides whether an update costs an outage.

That check compared the exact bytes of the document. Three places made the decision — the Supervisor’s no-op check, the configuration manager’s desired-versus-running fingerprint and the AWS runtime’s skip check — each with its own projection of the document, and each counted the following as a change:

Tools that generate configuration rarely write the same bytes twice, and a shared configuration has several writers. Each of these harmless writes reconnected every session of every owner.

The same projection is also the identity a coordinated cluster rollout agrees on: the proposer records a digest of the candidate, every member recomputes it over the document its own source delivered, and the durable committed-config artifact carries the digest of what the cohort committed. That identity had to stay deterministic across members.

Decision

One normal form, defined once, in ports. ports.ContentNormalForm returns a copy of a BridgeConfig in the shape every content-identity check compares. It is a pure transformation of the blueprint, with no JSON or YAML involved, so it can live in the inner ring next to the type it normalises. It never modifies its input and never rewrites a plugin’s decoded options.

The normal form:

Every content identity is taken over it. bridge.configContentEqual, the rollout candidate and committed-artifact digest (bridge.ConfigArtifactDigest), the configuration manager’s fingerprint and the AWS runtime’s skip check (which now calls bridge.ConfigArtifactDigest) all project the normal form. They can no longer disagree about what counts as a change. Their JSON encoders stay where they were, because the inner ring deliberately carries no JSON dependency, but the second rule they apply to the decoded tree is shared as well: ports.WithoutEmptyCollections makes an absent collection and an empty one the same value in an object field (a document read back from a store turns a nil slice into an empty one), in the bridge’s projection and in the manager’s fingerprint alike, for the blueprint and for every plugin’s options. Inside a list it does not: an element’s position and kind are content and the wire format keeps an empty object, an empty list and null apart, so they stay three different elements. A keyword field that happens to look like a duration, such as ack_after, is compared as written. Both projections decode numbers with json.Decoder.UseNumber, so an integer above 2^53 is never rounded through float64 and two distinct values never share an identity. One boundary of the collapse rule is accepted: a decoded tree cannot tell an object that came from a struct field from a data map a plugin passes through verbatim (an AMQP argument table), so an entry in such a map whose value is an empty table or an explicit null compares like an absent entry. The fold cannot be narrowed: a nil slice or map field marshals as null and reads back from a document as an empty collection, and the rollout quorum depends on the in-memory document and the read-back document projecting alike. No shipped transport gives such an entry a meaning of its own; a precise, type-aware rule would need a reflective copy of every plugin’s options and is not worth that for a case nothing uses.

bridge.DeploymentBaselineContentDigest is now the same value as bridge.ConfigArtifactDigest. The name is kept because the AWS deployment stamps it (dynamodb_ha_baseline_config_digest).

One check is deliberately not a content check. The gobridge command’s reload pipeline recognises the file watcher’s re-emit of the very document an admin apply just wrote, so that document is not applied twice; it compares the document, not the content. Anything else, including an equivalent document at another version, is forwarded, and the Supervisor’s no-op path decides and adopts it. A content comparison there would acknowledge such a document to the manager without the Supervisor ever seeing it.

A no-op reload adopts the document. When the new configuration has the running configuration’s normal form, the runtime is kept and every session stays connected, but the new document becomes the applied configuration: the Supervisor’s Config() and the AWS runtime’s applied configuration report the version number that now describes the running content, in step with the configuration manager’s running version. The post-swap convergence watcher reads that version when it writes a diagnostic, so a warning or degraded reason raised after an adoption names the adopted document too.

Digests recorded before the normal form are still readable. A rollout row and a committed-config artifact written by an earlier release carry a digest of the raw document. When the bridge reads such a record it accepts either the normal-form digest or the digest of the raw document, so an upgraded member neither refuses to start on its committed configuration nor reports a false rollout divergence. Three details make that hold after the upgrade, not only at the moment of it:

The raw-document digest is never written again; the first commit on the new release replaces the record. The reader that reproduces it is a fossil: it recomputes the old projection byte for byte, including the way it rounded integers above 2^53 through float64, and it must never be corrected, or a valid old record would stop matching. The fallback can be removed once no cohort can still hold a record written before the normal form.

The committed artifact’s version is still checked, separately. The digest leaves the version out, so on its own it no longer proves that a decoded artifact carries the version its record names. The writer therefore stamps the bytes with the rollout row’s version before encoding them: members whose sources delivered equivalent documents at different versions join one rollout, and whichever of them writes the artifact, the record and its bytes agree. A decoded document whose version differs from the record’s ConfigVersion is consequently corrupt and is rejected, in boot resolution and in reconciliation alike. That keeps the corruption check the byte digest used to give, without putting the version back into the identity.

Consequences

Alternatives considered