Build bounded cellular session batches
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (postgres) (push) Failing after 53s
Foundation / checks (tsan) (push) Failing after 31s
Foundation / checks (network) (push) Failing after 3m1s
Foundation / checks (client) (push) Failing after 4m25s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (checks) (push) Failing after 40s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (postgres) (push) Failing after 53s
Foundation / checks (tsan) (push) Failing after 31s
Foundation / checks (network) (push) Failing after 3m1s
Foundation / checks (client) (push) Failing after 4m25s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
This commit is contained in:
@@ -271,6 +271,13 @@ scoped change before starting the next segment.
|
||||
unowned actions. Other life inputs remain scheduler-owned. The application
|
||||
scheduler, profile-4 genesis tooling, process kill tests and CI execution
|
||||
remain open.
|
||||
- 11.3d-7d: `CellularSessionBatchBuilder` now copies the verified committed
|
||||
cellular state, binds the replay trace to its exact predecessor commit and
|
||||
digest, and accumulates up to the existing bounded batch limits. Each appended
|
||||
tick is validated by the same `CellularLives` rules; tests compare the built
|
||||
candidate with independent trace replay and cover cross-tick action-ID reuse.
|
||||
The service loop, profile-4 genesis tooling, process kill tests and CI
|
||||
execution remain open.
|
||||
|
||||
## Exit boundary
|
||||
|
||||
|
||||
@@ -6331,3 +6331,17 @@ GCC 13.2 C++23 strict-warning syntax checks pass for the adapter and new test in
|
||||
debug and `NDEBUG`; `git diff --check` passes. The executable test, full QUIC
|
||||
preset and CI have not run. The local QUIC preset remains blocked by cached MSVC
|
||||
C++23 feature detection, as recorded above.
|
||||
|
||||
## 2026-10-10 — M11.3d-7d bounded cellular publication batches (CI pending)
|
||||
|
||||
Extended the action-to-life adapter with a batch builder. It clones only the
|
||||
committed cellular checkpoint, binds the first trace header to the exact head
|
||||
commit/digest, accumulates up to 64 ticks and 1,024 unique account/action
|
||||
records, and advances a private working copy through `CellularLives`. Focused
|
||||
coverage compares the built candidate against independent trace replay and
|
||||
refuses stale input and action-ID reuse across ticks.
|
||||
|
||||
GCC 13.2 strict-warning syntax checks pass for the updated adapter and test in
|
||||
debug and `NDEBUG`; `git diff --check` passes. Runtime test execution, the QUIC
|
||||
preset and CI remain pending; the local cached-MSVC CMake limitation is
|
||||
unchanged.
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
#include "evo/network/intent_admission.hpp"
|
||||
#include "evo/server/lifecycle/cellular_batch.hpp"
|
||||
#include "evo/persistence/region_lease.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace evo::server {
|
||||
@@ -14,7 +17,11 @@ enum class CellularSessionBatchError : std::uint8_t {
|
||||
intents,
|
||||
action,
|
||||
life,
|
||||
duplicate_action
|
||||
duplicate_action,
|
||||
head,
|
||||
batch_full,
|
||||
action_limit,
|
||||
biology
|
||||
};
|
||||
|
||||
struct CellularSessionTick {
|
||||
@@ -29,4 +36,28 @@ struct CellularSessionTick {
|
||||
prepare_cellular_session_tick(const CellularLives& state, std::uint64_t tick,
|
||||
std::span<const CellularLifeIntent> baseline,
|
||||
std::span<const network::CarriedAction> actions);
|
||||
|
||||
// Builds one bounded publication from the last durable head. Its working copy is private;
|
||||
// only the host may publish, and callers must discard it after uncertainty until the host
|
||||
// resolves that exact prepared batch.
|
||||
class CellularSessionBatchBuilder {
|
||||
public:
|
||||
[[nodiscard]] static std::expected<CellularSessionBatchBuilder, CellularSessionBatchError>
|
||||
create(const CellularLives& committed_state, const persistence::RegionHead& committed_head);
|
||||
[[nodiscard]] std::expected<void, CellularSessionBatchError>
|
||||
append(std::uint64_t tick, std::span<const CellularLifeIntent> baseline,
|
||||
std::span<const network::CarriedAction> actions);
|
||||
[[nodiscard]] const CellularBatch& batch() const noexcept { return batch_; }
|
||||
[[nodiscard]] std::span<const CellularActionRecord> actions() const noexcept {
|
||||
return actions_;
|
||||
}
|
||||
[[nodiscard]] const CellularLives& candidate() const noexcept { return *working_; }
|
||||
|
||||
private:
|
||||
explicit CellularSessionBatchBuilder(std::unique_ptr<CellularLives> working)
|
||||
: working_{std::move(working)} {}
|
||||
std::unique_ptr<CellularLives> working_;
|
||||
CellularBatch batch_;
|
||||
std::vector<CellularActionRecord> actions_;
|
||||
};
|
||||
} // namespace evo::server
|
||||
|
||||
@@ -67,4 +67,51 @@ prepare_cellular_session_tick(const CellularLives& state, std::uint64_t tick,
|
||||
});
|
||||
return prepared;
|
||||
}
|
||||
|
||||
std::expected<CellularSessionBatchBuilder, CellularSessionBatchError>
|
||||
CellularSessionBatchBuilder::create(const CellularLives& committed_state,
|
||||
const persistence::RegionHead& committed_head) {
|
||||
if (committed_head.frame != committed_state.frame() ||
|
||||
committed_head.end_tick != committed_state.tick() ||
|
||||
std::ranges::all_of(committed_head.commit, [](std::uint8_t byte) { return byte == 0; }) ||
|
||||
std::ranges::all_of(committed_head.digest, [](std::uint8_t byte) { return byte == 0; }))
|
||||
return std::unexpected{CellularSessionBatchError::head};
|
||||
auto working = CellularLives::restore(committed_state.snapshot(), committed_state.world(),
|
||||
committed_state.region(), committed_state.frame(),
|
||||
committed_state.tick());
|
||||
if (!working)
|
||||
return std::unexpected{CellularSessionBatchError::biology};
|
||||
|
||||
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_state.tick()};
|
||||
return builder;
|
||||
}
|
||||
|
||||
std::expected<void, CellularSessionBatchError>
|
||||
CellularSessionBatchBuilder::append(std::uint64_t tick,
|
||||
std::span<const CellularLifeIntent> baseline,
|
||||
std::span<const network::CarriedAction> actions) {
|
||||
if (batch_.ticks.size() >= max_cellular_batch_ticks)
|
||||
return std::unexpected{CellularSessionBatchError::batch_full};
|
||||
if (actions_.size() + actions.size() > max_cellular_action_records)
|
||||
return std::unexpected{CellularSessionBatchError::action_limit};
|
||||
auto prepared = prepare_cellular_session_tick(*working_, tick, baseline, actions);
|
||||
if (!prepared)
|
||||
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;
|
||||
}) != actions_.end())
|
||||
return std::unexpected{CellularSessionBatchError::duplicate_action};
|
||||
if (!working_->advance_tick(prepared->intents.lives))
|
||||
return std::unexpected{CellularSessionBatchError::biology};
|
||||
batch_.ticks.push_back(std::move(prepared->intents));
|
||||
batch_.header.end_tick = tick;
|
||||
actions_.insert(actions_.end(), prepared->actions.begin(), prepared->actions.end());
|
||||
return {};
|
||||
}
|
||||
} // namespace evo::server
|
||||
|
||||
@@ -72,6 +72,37 @@ void actions_bind_to_owned_life_and_preserve_other_inputs() {
|
||||
batch.ticks.push_back(prepared->intents);
|
||||
CHECK(match_cellular_actions_to_trace(**state, batch, prepared->actions));
|
||||
|
||||
persistence::RegionHead head{};
|
||||
head.frame = (*state)->frame();
|
||||
head.sequence = 4;
|
||||
head.end_tick = (*state)->tick();
|
||||
head.commit.fill(1);
|
||||
head.digest.fill(2);
|
||||
auto builder = CellularSessionBatchBuilder::create(**state, head);
|
||||
CHECK(builder);
|
||||
CHECK(builder->append(2, baseline, actions));
|
||||
std::vector<CellularLifeIntent> next_baseline;
|
||||
for (const auto& life : builder->candidate().lives())
|
||||
next_baseline.push_back({life.identity.life, {}});
|
||||
CHECK(builder->append(3, next_baseline, {}));
|
||||
CHECK(builder->batch().header.begin_tick == 1 && builder->batch().header.end_tick == 3 &&
|
||||
builder->batch().ticks.size() == 2);
|
||||
CHECK(builder->actions().size() == 1 && builder->actions()[0] == prepared->actions[0]);
|
||||
const auto replayed = replay_cellular_batch(**state, builder->batch());
|
||||
CHECK(replayed && (*replayed)->snapshot() == builder->candidate().snapshot());
|
||||
const auto repeated_input = network::encode_cellular_action_input({3, 0, 0, false, 0, 0});
|
||||
const network::CarriedAction repeated{network::AccountId{controlled.account}, 77, 3,
|
||||
network::ActionKind::cellular, repeated_input};
|
||||
const std::array repeated_actions{repeated};
|
||||
CHECK(builder->append(3, next_baseline, repeated_actions).error() ==
|
||||
CellularSessionBatchError::duplicate_action);
|
||||
CHECK(builder->append(5, next_baseline, {}).error() == CellularSessionBatchError::tick);
|
||||
|
||||
auto wrong_head = head;
|
||||
++wrong_head.end_tick;
|
||||
CHECK(CellularSessionBatchBuilder::create(**state, wrong_head).error() ==
|
||||
CellularSessionBatchError::head);
|
||||
|
||||
auto altered = baseline;
|
||||
altered[1].intent.movement.x = 10;
|
||||
const auto preserved = prepare_cellular_session_tick(**state, 2, altered, actions);
|
||||
|
||||
Reference in New Issue
Block a user