M11-PT-001: read v10 perceptions from servers built before the bud cost
Foundation / checks (ecs) (push) Successful in 2m16s
Foundation / checks (deploy) (push) Successful in 4m4s
Foundation / checks (tsan) (push) Successful in 11m42s
Foundation / checks (network) (push) Successful in 19m59s
Foundation / checks (client) (push) Successful in 21m12s
Foundation / checks (checks) (push) Successful in 46m11s
Foundation / checks (postgres) (push) Successful in 46m18s
Foundation / postgres-tools (push) Successful in 28s
Foundation / server-image (push) Successful in 3m12s
Foundation / image (push) Successful in 3m28s

The bud cost (d98d71e) grew the v10 cellular perception prefix from 82 to 122 bytes
without a version bump. A rebuilt client connected to the live DEV region (server
3e5b8cef, older) refused every perception as wrong_length, closed the session as a
protocol error and reconnected; each reconnect's birth request answered existing_life
and no view ever arrived ("Existing cell is already bound to this account").

The decoder now also accepts the earlier v10 layout, with no bud cost. The two lengths
never coincide (40 bytes is not a whole 48-byte patch). The client already hides a zero
bud cost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-16 09:11:41 -04:00
co-authored by Claude Opus 5.5
parent 28629e1001
commit a820ff0984
4 changed files with 58 additions and 9 deletions
+17 -8
View File
@@ -704,13 +704,20 @@ std::expected<SessionMessage, SessionCodecError> decode_session(std::span<const
if (wire_version != session_protocol_v8 && wire_version != session_protocol_v9 &&
wire_version != session_protocol_v10)
return std::unexpected(SessionCodecError::unsupported_version);
const auto prefix =
wire_version == session_protocol_v10 ? cellular_perception_v10_prefix_bytes
: wire_version == session_protocol_v9 ? cellular_perception_v9_prefix_bytes
: cellular_perception_prefix_bytes;
if (payload.size() < prefix)
if (payload.size() < cellular_perception_prefix_bytes)
return std::unexpected(SessionCodecError::wrong_length);
const auto count = static_cast<std::size_t>(get(payload, 16, 2));
// A v10 server built before the bud cost (ADR-0129 amendment) sends the v9-sized
// prefix; the lengths never coincide (40 bytes is not a whole patch), so a rebuilt
// client still reads its views, with no bud cost (M11-PT-001).
const bool without_bud_cost = wire_version == session_protocol_v10 &&
payload.size() == cellular_perception_v9_prefix_bytes +
count * cellular_perceived_patch_bytes;
const auto prefix = wire_version == session_protocol_v10 && !without_bud_cost
? cellular_perception_v10_prefix_bytes
: wire_version == session_protocol_v9 || without_bud_cost
? cellular_perception_v9_prefix_bytes
: cellular_perception_prefix_bytes;
if (count > max_cellular_perceived_patches ||
payload.size() != prefix + count * cellular_perceived_patch_bytes)
return std::unexpected(SessionCodecError::wrong_length);
@@ -739,9 +746,11 @@ std::expected<SessionMessage, SessionCodecError> decode_session(std::span<const
if (wire_version == session_protocol_v10) {
d.engulf = static_cast<CellularEngulfResult>(payload[77]);
d.bud = static_cast<CellularBudOutcome>(payload[78]);
d.bud_cost_energy_pj = get(payload, 82, 8);
for (std::size_t channel = 0; channel < d.bud_cost_matter_fg.size(); ++channel)
d.bud_cost_matter_fg[channel] = get(payload, 90 + channel * 8, 8);
if (!without_bud_cost) {
d.bud_cost_energy_pj = get(payload, 82, 8);
for (std::size_t channel = 0; channel < d.bud_cost_matter_fg.size(); ++channel)
d.bud_cost_matter_fg[channel] = get(payload, 90 + channel * 8, 8);
}
}
d.movement = static_cast<CellularMovementResult>(payload[74]);
d.intake = static_cast<CellularIntakeResult>(payload[75]);