Carry the engulf intent on v10 sessions and the batch trace
Foundation / checks (ecs) (push) Successful in 2m28s
Foundation / checks (deploy) (push) Successful in 4m6s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 6m47s
Foundation / checks (checks) (push) Canceled after 6m58s
Foundation / checks (client) (push) Canceled after 6m59s
Foundation / checks (tsan) (push) Canceled after 4m28s
Foundation / checks (network) (push) Canceled after 6m58s
Foundation / checks (ecs) (push) Successful in 2m28s
Foundation / checks (deploy) (push) Successful in 4m6s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 6m47s
Foundation / checks (checks) (push) Canceled after 6m58s
Foundation / checks (client) (push) Canceled after 6m59s
Foundation / checks (tsan) (push) Canceled after 4m28s
Foundation / checks (network) (push) Canceled after 6m58s
ADR-0124: byte 12 of the canonical cellular input, the CellularAction wire message and the batch trace record becomes a target kind (0 none, 1 patch, 2 engulf with zero coordinates). Kind 2 exists only on v10, which no server admitted before; cellular servers now admit v10 with v9 behaviour plus engulf, and still refuse a v10 mutation choice until 11.4c. Admission, the session-batch adapter, trace codec, matcher and action-block validator carry the kind. The client session library accepts v10 and an engulf flag, and its send no longer reports a message its version cannot encode as sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -161,6 +161,11 @@ std::vector<std::uint8_t> encode_session(const SessionMessage& message, std::uin
|
||||
return {};
|
||||
if (version != session_protocol_v10 && std::holds_alternative<CellularMutationAction>(message))
|
||||
return {};
|
||||
if (const auto* action = std::get_if<CellularAction>(&message);
|
||||
action && action->engulf &&
|
||||
(version != session_protocol_v10 || action->has_intake_target || action->intake_x_um ||
|
||||
action->intake_y_um))
|
||||
return {};
|
||||
if (version != session_protocol_v8 && version != session_protocol_v9 &&
|
||||
version != session_protocol_v10 && std::holds_alternative<CellularPerception>(message))
|
||||
return {};
|
||||
@@ -241,7 +246,7 @@ std::vector<std::uint8_t> encode_session(const SessionMessage& message, std::uin
|
||||
put(out, v, 8);
|
||||
put(out, static_cast<std::uint16_t>(m.move_x), 2);
|
||||
put(out, static_cast<std::uint16_t>(m.move_y), 2);
|
||||
out.push_back(m.has_intake_target ? 1 : 0);
|
||||
out.push_back(m.has_intake_target ? 1 : m.engulf ? 2 : 0); // Target kind.
|
||||
put(out, 0, 3);
|
||||
put(out, m.intake_x_um, 4);
|
||||
put(out, m.intake_y_um, 4);
|
||||
@@ -518,9 +523,12 @@ std::expected<SessionMessage, SessionCodecError> decode_session(std::span<const
|
||||
m.tick = get(payload, 24, 8);
|
||||
m.move_x = static_cast<std::int16_t>(static_cast<std::uint16_t>(get(payload, 32, 2)));
|
||||
m.move_y = static_cast<std::int16_t>(static_cast<std::uint16_t>(get(payload, 34, 2)));
|
||||
if (payload[36] > 1 || payload[37] != 0 || payload[38] != 0 || payload[39] != 0)
|
||||
// Target kind: 0 none, 1 patch intake, 2 engulf (v10 only, ADR-0124).
|
||||
if (payload[36] > (wire_version == session_protocol_v10 ? 2 : 1) || payload[37] != 0 ||
|
||||
payload[38] != 0 || payload[39] != 0)
|
||||
return std::unexpected(SessionCodecError::invalid_value);
|
||||
m.has_intake_target = payload[36] != 0;
|
||||
m.has_intake_target = payload[36] == 1;
|
||||
m.engulf = payload[36] == 2;
|
||||
m.intake_x_um = static_cast<std::uint32_t>(get(payload, 40, 4));
|
||||
m.intake_y_um = static_cast<std::uint32_t>(get(payload, 44, 4));
|
||||
if (!m.session || !m.epoch || !m.action_id || !m.tick ||
|
||||
@@ -781,7 +789,7 @@ encode_cellular_action_input(const CellularActionInput& input) {
|
||||
put(bytes, input.tick, 8);
|
||||
put(bytes, static_cast<std::uint16_t>(input.move_x), 2);
|
||||
put(bytes, static_cast<std::uint16_t>(input.move_y), 2);
|
||||
bytes.push_back(input.has_intake_target ? 1 : 0);
|
||||
bytes.push_back(input.has_intake_target ? 1 : input.engulf ? 2 : 0); // Target kind.
|
||||
put(bytes, 0, 3);
|
||||
put(bytes, input.intake_x_um, 4);
|
||||
put(bytes, input.intake_y_um, 4);
|
||||
@@ -794,13 +802,14 @@ std::expected<CellularActionInput, SessionCodecError>
|
||||
decode_cellular_action_input(std::span<const std::uint8_t> bytes) {
|
||||
if (bytes.size() != cellular_action_input_bytes)
|
||||
return std::unexpected(SessionCodecError::wrong_length);
|
||||
if (bytes[12] > 1 || bytes[13] != 0 || bytes[14] != 0 || bytes[15] != 0)
|
||||
if (bytes[12] > 2 || bytes[13] != 0 || bytes[14] != 0 || bytes[15] != 0)
|
||||
return std::unexpected(SessionCodecError::invalid_value);
|
||||
CellularActionInput input;
|
||||
input.tick = get(bytes, 0, 8);
|
||||
input.move_x = static_cast<std::int16_t>(static_cast<std::uint16_t>(get(bytes, 8, 2)));
|
||||
input.move_y = static_cast<std::int16_t>(static_cast<std::uint16_t>(get(bytes, 10, 2)));
|
||||
input.has_intake_target = bytes[12] != 0;
|
||||
input.has_intake_target = bytes[12] == 1;
|
||||
input.engulf = bytes[12] == 2;
|
||||
input.intake_x_um = static_cast<std::uint32_t>(get(bytes, 16, 4));
|
||||
input.intake_y_um = static_cast<std::uint32_t>(get(bytes, 20, 4));
|
||||
if (input.tick == 0 ||
|
||||
|
||||
Reference in New Issue
Block a user