Format M11 cellular code with clang-format 19
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m52s
Foundation / checks (client) (push) Failing after 4m25s
Foundation / checks (network) (push) Failing after 3m2s
Foundation / checks (tsan) (push) Failing after 33s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 5m47s
Foundation / checks (postgres) (push) Canceled after 1m24s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m52s
Foundation / checks (client) (push) Failing after 4m25s
Foundation / checks (network) (push) Failing after 3m2s
Foundation / checks (tsan) (push) Failing after 33s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 5m47s
Foundation / checks (postgres) (push) Canceled after 1m24s
This commit is contained in:
@@ -20,8 +20,7 @@ prepare_cellular_session_tick(const CellularLives& state, std::uint64_t tick,
|
||||
std::ranges::sort(prepared.intents.lives, {}, &CellularLifeIntent::life_id);
|
||||
for (std::size_t i = 0; i < state.lives().size(); ++i)
|
||||
if (prepared.intents.lives[i].life_id != state.lives()[i].identity.life ||
|
||||
(i != 0 && prepared.intents.lives[i - 1].life_id ==
|
||||
prepared.intents.lives[i].life_id))
|
||||
(i != 0 && prepared.intents.lives[i - 1].life_id == prepared.intents.lives[i].life_id))
|
||||
return std::unexpected{CellularSessionBatchError::intents};
|
||||
|
||||
prepared.actions.reserve(actions.size());
|
||||
@@ -33,16 +32,16 @@ prepare_cellular_session_tick(const CellularLives& state, std::uint64_t tick,
|
||||
if (!input || input->tick != tick)
|
||||
return std::unexpected{CellularSessionBatchError::action};
|
||||
|
||||
const auto life = std::ranges::find(state.lives(), action.account.bytes,
|
||||
&CellularOwnedLife::account);
|
||||
const auto life =
|
||||
std::ranges::find(state.lives(), action.account.bytes, &CellularOwnedLife::account);
|
||||
if (life == state.lives().end())
|
||||
return std::unexpected{CellularSessionBatchError::life};
|
||||
if (input->has_intake_target) {
|
||||
const auto view = state.perceive(life->identity.life);
|
||||
const biology::CellularPatchAddress target{input->intake_x_um, input->intake_y_um};
|
||||
if (!view || std::ranges::find(*view, target,
|
||||
&biology::CellularPatchPerception::address) ==
|
||||
view->end())
|
||||
if (!view ||
|
||||
std::ranges::find(*view, target, &biology::CellularPatchPerception::address) ==
|
||||
view->end())
|
||||
return std::unexpected{CellularSessionBatchError::unperceived_target};
|
||||
}
|
||||
const auto owned_intent = std::ranges::lower_bound(
|
||||
@@ -67,12 +66,12 @@ prepare_cellular_session_tick(const CellularLives& state, std::uint64_t tick,
|
||||
record.input = *action.cellular_input;
|
||||
prepared.actions.push_back(record);
|
||||
}
|
||||
std::ranges::sort(prepared.actions, [](const CellularActionRecord& left,
|
||||
const CellularActionRecord& right) {
|
||||
if (left.account != right.account)
|
||||
return left.account < right.account;
|
||||
return left.action_id < right.action_id;
|
||||
});
|
||||
std::ranges::sort(prepared.actions,
|
||||
[](const CellularActionRecord& left, const CellularActionRecord& right) {
|
||||
if (left.account != right.account)
|
||||
return left.account < right.account;
|
||||
return left.action_id < right.action_id;
|
||||
});
|
||||
return prepared;
|
||||
}
|
||||
|
||||
@@ -93,7 +92,7 @@ CellularSessionBatchBuilder::create(const CellularLives& committed_state,
|
||||
CellularSessionBatchBuilder builder{std::move(*working)};
|
||||
builder.batch_.header = {committed_state.world(), committed_state.region(),
|
||||
committed_state.frame(), committed_head.commit,
|
||||
committed_head.digest, committed_state.tick(),
|
||||
committed_head.digest, committed_state.tick(),
|
||||
committed_state.tick()};
|
||||
return builder;
|
||||
}
|
||||
@@ -112,8 +111,7 @@ CellularSessionBatchBuilder::append(std::uint64_t tick,
|
||||
return std::unexpected{prepared.error()};
|
||||
for (const auto& action : prepared->actions)
|
||||
if (std::ranges::find_if(actions_, [&](const CellularActionRecord& previous) {
|
||||
return previous.account == action.account &&
|
||||
previous.action_id == action.action_id;
|
||||
return previous.account == action.account && previous.action_id == action.action_id;
|
||||
}) != actions_.end())
|
||||
return std::unexpected{CellularSessionBatchError::duplicate_action};
|
||||
if (births.size() > biology::max_cellular_tick_lives)
|
||||
@@ -133,21 +131,20 @@ CellularSessionBatchBuilder::append(std::uint64_t tick,
|
||||
return std::unexpected{CellularSessionBatchError::duplicate_birth};
|
||||
for (const auto& previous_tick : batch_.ticks)
|
||||
if (std::ranges::any_of(previous_tick.births, [&](const auto& previous) {
|
||||
return previous.account == birth.account ||
|
||||
previous.identity == birth.identity;
|
||||
return previous.account == birth.account || previous.identity == birth.identity;
|
||||
}))
|
||||
return std::unexpected{CellularSessionBatchError::duplicate_birth};
|
||||
}
|
||||
|
||||
auto next = CellularLives::restore(working_->snapshot(), working_->world(),
|
||||
working_->region(), working_->frame(), working_->tick());
|
||||
auto next = CellularLives::restore(working_->snapshot(), working_->world(), working_->region(),
|
||||
working_->frame(), working_->tick());
|
||||
if (!next || !(*next)->advance_tick(prepared->intents.lives))
|
||||
return std::unexpected{CellularSessionBatchError::biology};
|
||||
|
||||
for (const auto& birth : prepared->intents.births) {
|
||||
const LifeRequest request{birth.account, birth.request};
|
||||
const LifeAllocation allocation{birth.identity, birth.identity, birth.identity,
|
||||
birth.identity, {tick}};
|
||||
const LifeAllocation allocation{
|
||||
birth.identity, birth.identity, birth.identity, birth.identity, {tick}};
|
||||
auto created = (*next)->birth_candidate(request, allocation);
|
||||
if (!created)
|
||||
return std::unexpected{CellularSessionBatchError::invalid_birth};
|
||||
|
||||
@@ -36,8 +36,8 @@ PostgresActionLedger::find_record(const network::AccountId& account, std::uint64
|
||||
auto* db = db_->get();
|
||||
if (!db)
|
||||
return std::unexpected(network::ActionLedgerError::unavailable);
|
||||
const auto found = persistence::find_region_action_record(
|
||||
*db, key_, *lease, account.bytes, action_id, timeout_);
|
||||
const auto found = persistence::find_region_action_record(*db, key_, *lease, account.bytes,
|
||||
action_id, timeout_);
|
||||
if (!found.has_value()) {
|
||||
const auto kind = found.error().kind;
|
||||
if (kind == persistence::LeaseStoreError::store ||
|
||||
@@ -54,8 +54,7 @@ PostgresActionLedger::find_record(const network::AccountId& account, std::uint64
|
||||
std::nullopt};
|
||||
if (row.cellular_input) {
|
||||
const auto input = network::decode_cellular_action_input(*row.cellular_input);
|
||||
if (!input || input->tick != row.action.tick ||
|
||||
result != network::ActionResult::committed)
|
||||
if (!input || input->tick != row.action.tick || result != network::ActionResult::committed)
|
||||
return std::unexpected(network::ActionLedgerError::unavailable);
|
||||
std::array<std::uint8_t, network::cellular_action_input_bytes> canonical{};
|
||||
std::ranges::copy(*row.cellular_input, canonical.begin());
|
||||
@@ -66,8 +65,7 @@ PostgresActionLedger::find_record(const network::AccountId& account, std::uint64
|
||||
return std::optional<network::DurableActionRecord>{std::move(record)};
|
||||
}
|
||||
|
||||
std::expected<std::vector<std::optional<network::DurableActionRecord>>,
|
||||
network::ActionLedgerError>
|
||||
std::expected<std::vector<std::optional<network::DurableActionRecord>>, network::ActionLedgerError>
|
||||
PostgresActionLedger::find_all_records(std::span<const network::ActionKey> keys) {
|
||||
std::vector<std::optional<network::DurableActionRecord>> out(keys.size());
|
||||
if (keys.empty())
|
||||
@@ -97,10 +95,10 @@ PostgresActionLedger::find_all_records(std::span<const network::ActionKey> keys)
|
||||
continue;
|
||||
const auto& row = *(*found)[i];
|
||||
const auto result = static_cast<network::ActionResult>(row.result);
|
||||
network::DurableActionRecord record{
|
||||
network::ActionOutcome{keys[i].action_id, result, row.action.tick,
|
||||
row.action.commit_sequence},
|
||||
std::nullopt};
|
||||
network::DurableActionRecord record{network::ActionOutcome{keys[i].action_id, result,
|
||||
row.action.tick,
|
||||
row.action.commit_sequence},
|
||||
std::nullopt};
|
||||
if (row.cellular_input) {
|
||||
const auto input = network::decode_cellular_action_input(*row.cellular_input);
|
||||
if (!input || input->tick != row.action.tick ||
|
||||
|
||||
Reference in New Issue
Block a user