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:
@@ -36,7 +36,7 @@ bool valid_intent(const CellularLifeIntent& life) {
|
||||
const auto& step = life.intent;
|
||||
return life.life_id != 0 && step.movement.x >= -movement_limit &&
|
||||
step.movement.x <= movement_limit && step.movement.y >= -movement_limit &&
|
||||
step.movement.y <= movement_limit;
|
||||
step.movement.y <= movement_limit && !(step.engulf && step.intake_target);
|
||||
}
|
||||
bool valid_ticks(std::span<const CellularTickIntents> ticks) {
|
||||
std::set<std::uint64_t> identities;
|
||||
@@ -83,7 +83,7 @@ bool valid_action_input(const CellularActionRecord& action, std::uint64_t begin_
|
||||
const auto move_y = std::bit_cast<std::int16_t>(static_cast<std::uint16_t>(get(input, 10, 2)));
|
||||
return !all_zero(action.account) && action.action_id != 0 && tick > begin_tick &&
|
||||
tick <= end_tick && move_x >= -movement_limit && move_x <= movement_limit &&
|
||||
move_y >= -movement_limit && move_y <= movement_limit && input[12] <= 1 &&
|
||||
move_y >= -movement_limit && move_y <= movement_limit && input[12] <= 2 &&
|
||||
all_zero(input.subspan(13, 3)) && (input[12] == 1 || all_zero(input.subspan(16, 8)));
|
||||
}
|
||||
bool action_less(const CellularActionRecord& a, const CellularActionRecord& b) {
|
||||
@@ -137,7 +137,7 @@ void put_intent(std::vector<std::uint8_t>& out, const CellularLifeIntent& life)
|
||||
put(out, life.life_id, 8);
|
||||
put(out, static_cast<std::uint16_t>(life.intent.movement.x), 2);
|
||||
put(out, static_cast<std::uint16_t>(life.intent.movement.y), 2);
|
||||
out.push_back(life.intent.intake_target ? 1 : 0);
|
||||
out.push_back(life.intent.intake_target ? 1 : life.intent.engulf ? 2 : 0); // Target kind.
|
||||
put(out, 0, 3);
|
||||
put(out, life.intent.intake_target ? life.intent.intake_target->x_um : 0, 4);
|
||||
put(out, life.intent.intake_target ? life.intent.intake_target->y_um : 0, 4);
|
||||
@@ -287,7 +287,7 @@ decode_cellular_batch(std::span<const std::uint8_t> bytes) {
|
||||
step.lives.reserve(static_cast<std::size_t>(count));
|
||||
for (std::uint64_t i = 0; i < count; ++i) {
|
||||
const auto record = bytes.subspan(offset, cellular_batch_intent_bytes);
|
||||
if (record[12] > 1 || !all_zero(record.subspan(13, 3)))
|
||||
if (record[12] > 2 || !all_zero(record.subspan(13, 3)))
|
||||
return std::unexpected{CellularBatchError::format};
|
||||
CellularLifeIntent life;
|
||||
life.life_id = get(record, 0, 8);
|
||||
@@ -302,6 +302,7 @@ decode_cellular_batch(std::span<const std::uint8_t> bytes) {
|
||||
} else if (!all_zero(record.subspan(16, 8))) {
|
||||
return std::unexpected{CellularBatchError::format};
|
||||
}
|
||||
life.intent.engulf = record[12] == 2; // ADR-0124 target kind.
|
||||
if (!valid_intent(life) ||
|
||||
(!step.lives.empty() && step.lives.back().life_id >= life.life_id))
|
||||
return std::unexpected{CellularBatchError::format};
|
||||
@@ -492,14 +493,14 @@ match_cellular_actions_to_trace(const CellularLives& predecessor, const Cellular
|
||||
return std::unexpected{CellularActionBlockError::mismatch};
|
||||
const auto input = std::span<const std::uint8_t>{action.input};
|
||||
std::optional<biology::CellularPatchAddress> target;
|
||||
if (input[12] != 0)
|
||||
if (input[12] == 1)
|
||||
target = biology::CellularPatchAddress{static_cast<std::uint32_t>(get(input, 16, 4)),
|
||||
static_cast<std::uint32_t>(get(input, 20, 4))};
|
||||
if (intent->intent.movement.x !=
|
||||
std::bit_cast<std::int16_t>(static_cast<std::uint16_t>(get(input, 8, 2))) ||
|
||||
intent->intent.movement.y !=
|
||||
std::bit_cast<std::int16_t>(static_cast<std::uint16_t>(get(input, 10, 2))) ||
|
||||
intent->intent.intake_target != target)
|
||||
intent->intent.intake_target != target || intent->intent.engulf != (input[12] == 2))
|
||||
return std::unexpected{CellularActionBlockError::mismatch};
|
||||
}
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user