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

This commit is contained in:
dingo
2026-10-11 02:59:41 -04:00
parent b8a1288ee9
commit c81c1bfc56
25 changed files with 371 additions and 356 deletions
+4 -3
View File
@@ -60,9 +60,10 @@ class RegionSessionClient {
[[nodiscard]] bool send_action(std::uint64_t action_id, network::ActionKind kind,
std::uint64_t tick);
// Protocol v7/v8. Reuse the exact same fields and action id after reconnect.
[[nodiscard]] bool send_cellular_action(
std::uint64_t action_id, std::uint64_t tick, std::int16_t move_x, std::int16_t move_y,
std::optional<std::pair<std::uint32_t, std::uint32_t>> intake_target = {});
[[nodiscard]] bool
send_cellular_action(std::uint64_t action_id, std::uint64_t tick, std::int16_t move_x,
std::int16_t move_y,
std::optional<std::pair<std::uint32_t, std::uint32_t>> intake_target = {});
[[nodiscard]] bool query_action(std::uint64_t action_id);
// Primitive profile v5 only. The account and generation are always supplied by the
// authenticated session; callers choose only a stable request id.
+6 -6
View File
@@ -202,14 +202,14 @@ class IntentAdmission {
[[nodiscard]] Found lookup(const AccountId& account, std::uint64_t action_id) const;
// The in-memory checks of an action; `check` is set when only the ledger can still
// refuse it.
[[nodiscard]] ActionReceipt screen(
Session& s, const SessionAction& m, const AdmissionFacts& facts, bool& check,
std::optional<std::array<std::uint8_t, cellular_action_input_bytes>> cellular_input =
std::nullopt);
[[nodiscard]] ActionReceipt
screen(Session& s, const SessionAction& m, const AdmissionFacts& facts, bool& check,
std::optional<std::array<std::uint8_t, cellular_action_input_bytes>> cellular_input =
std::nullopt);
// Applies a durable answer to a receipt that passed `screen`.
void decide(const AccountId& account, ActionReceipt& r, const Found& found,
std::optional<std::array<std::uint8_t, cellular_action_input_bytes>> cellular_input =
std::nullopt);
std::optional<std::array<std::uint8_t, cellular_action_input_bytes>>
cellular_input = std::nullopt);
Session* find(std::uint64_t session);
const Session* find(std::uint64_t session) const;
void count_window(Session& s, std::uint64_t server_tick) const;
+6 -7
View File
@@ -204,11 +204,11 @@ provision_cellular_region(Postgres& owner, const FilesystemObjectStore& objects,
std::uint64_t frame, const server::CellularLives& opening, Uuid commit,
const Sha256Digest& build, std::chrono::milliseconds timeout);
[[nodiscard]] std::expected<PublishedCellularBatch, CellularPublicationFailure>
publish_cellular_batch(Postgres& db, const FilesystemObjectStore& objects,
const LeaseGrant& lease, const CommittedCheckpoint& predecessor,
const server::CellularBatch& batch, const server::CellularLives& candidate,
Uuid commit, const Sha256Digest& build,
std::chrono::milliseconds timeout, const PublishHooks& hooks = {},
publish_cellular_batch(Postgres& db, const FilesystemObjectStore& objects, const LeaseGrant& lease,
const CommittedCheckpoint& predecessor, const server::CellularBatch& batch,
const server::CellularLives& candidate, Uuid commit,
const Sha256Digest& build, std::chrono::milliseconds timeout,
const PublishHooks& hooks = {},
std::span<const server::CellularActionRecord> actions = {});
[[nodiscard]] std::expected<CommittedCheckpoint, CellularPublicationFailure>
retry_cellular_prepared(Postgres& db, const CellularPreparedCommit& prepared,
@@ -218,8 +218,7 @@ resolve_cellular_prepared(Postgres& db, const CellularPreparedCommit& prepared,
std::chrono::milliseconds timeout);
[[nodiscard]] std::expected<RecoveredCellularCheckpoint, RecoveryFailure>
recover_cellular_checkpoint(Postgres& db, const FilesystemObjectStore& objects, RegionKey key,
const LeaseGrant& lease,
std::span<const Sha256Digest> retained_builds,
const LeaseGrant& lease, std::span<const Sha256Digest> retained_builds,
std::chrono::milliseconds timeout);
// After an `unknown` publication: resolve exactly the prepared bytes. A committed
@@ -3,8 +3,8 @@
#include "evo/persistence/region_lease.hpp"
#include "evo/processes/environmental_community.hpp"
#include "evo/processes/lineage_region.hpp"
#include "evo/server/lifecycle/cellular_lives.hpp"
#include "evo/server/lifecycle/cellular_batch.hpp"
#include "evo/server/lifecycle/cellular_lives.hpp"
#include "evo/server/lifecycle/primitive_batch.hpp"
#include <cstddef>
#include <cstdint>
@@ -97,7 +97,7 @@ inline constexpr std::size_t max_lineage_payload_bytes = processes::max_lineage_
return profile == CheckpointProfile::environmental_v1 ? max_environmental_payload_bytes
: profile == CheckpointProfile::environmental_lineage_v1 ? max_lineage_payload_bytes
: profile == CheckpointProfile::primitive_lives_v1 ? server::max_primitive_lives_bytes
: profile == CheckpointProfile::cellular_lives_v1 ? server::max_cellular_lives_bytes
: profile == CheckpointProfile::cellular_lives_v1 ? server::max_cellular_lives_bytes
: 0;
}
inline constexpr std::uint64_t max_checkpoint_ticks = 64;
@@ -159,6 +159,5 @@ restore_lineage_payload(std::span<const std::uint8_t> payload, const CheckpointM
restore_primitive_payload(std::span<const std::uint8_t> payload,
const CheckpointManifest& manifest);
[[nodiscard]] std::expected<std::unique_ptr<server::CellularLives>, CheckpointError>
restore_cellular_payload(std::span<const std::uint8_t> payload,
const CheckpointManifest& manifest);
restore_cellular_payload(std::span<const std::uint8_t> payload, const CheckpointManifest& manifest);
} // namespace evo::persistence
+8 -14
View File
@@ -82,8 +82,7 @@ publish_region_checkpoint(Postgres& db, std::span<const std::uint8_t> manifest,
publish_cellular_checkpoint(Postgres& db, std::span<const std::uint8_t> manifest,
std::span<const std::uint8_t> decisions,
std::span<const std::uint8_t> actions,
std::span<const std::uint8_t> trace,
std::chrono::milliseconds timeout);
std::span<const std::uint8_t> trace, std::chrono::milliseconds timeout);
enum class Resolution : std::uint8_t {
committed, // Exact bytes are durable; receipt holds the head. Grants no authority.
@@ -107,13 +106,10 @@ resolve_region_commit(Postgres& db, RegionKey key, const Uuid& commit,
std::span<const std::uint8_t> actions, std::chrono::milliseconds timeout);
// Schema v20 resolution also compares the immutable profile-4 cellular action block.
[[nodiscard]] std::expected<ResolvedCommit, LeaseStoreFailure>
resolve_cellular_region_commit(Postgres& db, RegionKey key, const Uuid& commit,
std::span<const std::uint8_t> manifest,
std::span<const std::uint8_t> decisions,
std::span<const std::uint8_t> actions,
std::span<const std::uint8_t> trace,
std::chrono::milliseconds timeout);
[[nodiscard]] std::expected<ResolvedCommit, LeaseStoreFailure> resolve_cellular_region_commit(
Postgres& db, RegionKey key, const Uuid& commit, std::span<const std::uint8_t> manifest,
std::span<const std::uint8_t> decisions, std::span<const std::uint8_t> actions,
std::span<const std::uint8_t> trace, std::chrono::milliseconds timeout);
// Load the immutable action block for a committed profile-4 link under the current lease.
// Empty means this commit has no cellular publication row; a missing row for a progressing
@@ -146,9 +142,8 @@ struct CommittedActionRecord {
friend bool operator==(const CommittedActionRecord&, const CommittedActionRecord&) = default;
};
[[nodiscard]] std::expected<std::optional<CommittedActionRecord>, LeaseStoreFailure>
find_region_action_record(Postgres& db, RegionKey key, const LeaseGrant& lease,
const Uuid& account, std::uint64_t action_id,
std::chrono::milliseconds timeout);
find_region_action_record(Postgres& db, RegionKey key, const LeaseGrant& lease, const Uuid& account,
std::uint64_t action_id, std::chrono::milliseconds timeout);
// The same for several (account, action) pairs in one statement, answered in order
// (M10.9d, ADR-0097). Empty asks nothing.
struct ActionRef {
@@ -160,8 +155,7 @@ find_region_actions(Postgres& db, RegionKey key, const LeaseGrant& lease,
std::span<const ActionRef> actions, std::chrono::milliseconds timeout);
[[nodiscard]] std::expected<std::vector<std::optional<CommittedActionRecord>>, LeaseStoreFailure>
find_region_action_records(Postgres& db, RegionKey key, const LeaseGrant& lease,
std::span<const ActionRef> actions,
std::chrono::milliseconds timeout);
std::span<const ActionRef> actions, std::chrono::milliseconds timeout);
struct CommittedDecision {
std::uint64_t commit_sequence{};
+20 -12
View File
@@ -1,8 +1,8 @@
#pragma once
#include "evo/network/session_protocol.hpp"
#include "evo/persistence/checkpoint_store.hpp"
#include "evo/persistence/life_reservation_store.hpp"
#include "evo/network/session_protocol.hpp"
#include "evo/server/lifecycle/cellular_batch.hpp"
#include "evo/server/ops.hpp"
@@ -25,7 +25,12 @@ struct CellularHostConfig {
persistence::Sha256Digest build{};
std::vector<persistence::Sha256Digest> retained_builds;
};
enum class CellularHostError : std::uint8_t { configuration, not_ready, invalid_batch, publication };
enum class CellularHostError : std::uint8_t {
configuration,
not_ready,
invalid_batch,
publication
};
struct FinalCellularAction {
CellularActionRecord action;
std::uint64_t commit_sequence{};
@@ -36,8 +41,7 @@ struct FinalCellularAction {
// the host replays it from its recovered state and advances only on a confirmed head.
class CellularRegionHost {
public:
[[nodiscard]] static std::expected<std::unique_ptr<CellularRegionHost>,
CellularHostError>
[[nodiscard]] static std::expected<std::unique_ptr<CellularRegionHost>, CellularHostError>
create(CellularHostConfig config, CellularConnect connect,
std::unique_ptr<persistence::FilesystemObjectStore> objects);
CellularRegionHost(const CellularRegionHost&) = delete;
@@ -47,8 +51,7 @@ class CellularRegionHost {
// Acquires/renews authority, recovers fully, or resolves the exact pending commit.
const HostStatus& step();
[[nodiscard]] std::expected<persistence::PublishedCellularBatch, CellularHostError>
publish(const CellularBatch& batch,
std::span<const CellularActionRecord> actions = {});
publish(const CellularBatch& batch, std::span<const CellularActionRecord> actions = {});
// v5 requests allocate durably, then wait for the scheduler to include the exact
// reservation in a profile-4 batch. Repeating the request is idempotent.
[[nodiscard]] network::PrimitiveLifeOutcome
@@ -63,9 +66,14 @@ class CellularRegionHost {
[[nodiscard]] std::vector<FinalCellularAction> take_finalized_actions();
void drain();
[[nodiscard]] std::optional<persistence::LeaseGrant> authority() const;
[[nodiscard]] const HostStatus& status() const noexcept { return status_; }
[[nodiscard]] const CellularLives* state() const noexcept { return state_.get(); }
[[nodiscard]] const std::optional<persistence::CommittedCheckpoint>& committed() const noexcept {
[[nodiscard]] const HostStatus& status() const noexcept {
return status_;
}
[[nodiscard]] const CellularLives* state() const noexcept {
return state_.get();
}
[[nodiscard]] const std::optional<persistence::CommittedCheckpoint>&
committed() const noexcept {
return committed_;
}
@@ -80,9 +88,9 @@ class CellularRegionHost {
void refresh();
void finalize_births(std::span<const CellularTickIntents::Birth> births);
void queue_birth(const CellularTickIntents::Birth& birth);
[[nodiscard]] network::PrimitiveLifeOutcome query_birth(
const persistence::Uuid& account, std::uint64_t generation, std::uint64_t request,
bool enqueue);
[[nodiscard]] network::PrimitiveLifeOutcome query_birth(const persistence::Uuid& account,
std::uint64_t generation,
std::uint64_t request, bool enqueue);
CellularHostConfig config_;
CellularConnect connect_;
@@ -1,8 +1,8 @@
#pragma once
#include "evo/network/intent_admission.hpp"
#include "evo/server/lifecycle/cellular_batch.hpp"
#include "evo/persistence/region_lease.hpp"
#include "evo/server/lifecycle/cellular_batch.hpp"
#include <cstdint>
#include <expected>
@@ -51,11 +51,15 @@ class CellularSessionBatchBuilder {
append(std::uint64_t tick, std::span<const CellularLifeIntent> baseline,
std::span<const network::CarriedAction> actions,
std::span<const CellularTickIntents::Birth> births = {});
[[nodiscard]] const CellularBatch& batch() const noexcept { return batch_; }
[[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_; }
[[nodiscard]] const CellularLives& candidate() const noexcept {
return *working_;
}
private:
explicit CellularSessionBatchBuilder(std::unique_ptr<CellularLives> working)
@@ -50,10 +50,11 @@ inline constexpr std::size_t cellular_batch_tick_header_bytes = 8;
inline constexpr std::size_t cellular_batch_intent_bytes = 24;
inline constexpr std::size_t cellular_batch_birth_bytes = 40;
inline constexpr std::size_t max_cellular_batch_ticks = 64;
inline constexpr std::size_t max_cellular_batch_bytes = cellular_batch_header_bytes +
inline constexpr std::size_t max_cellular_batch_bytes =
cellular_batch_header_bytes +
max_cellular_batch_ticks * (cellular_batch_tick_header_bytes +
biology::max_cellular_tick_lives *
(cellular_batch_intent_bytes + cellular_batch_birth_bytes));
biology::max_cellular_tick_lives *
(cellular_batch_intent_bytes + cellular_batch_birth_bytes));
enum class CellularBatchError : std::uint8_t { format, version, scope, state };
inline constexpr std::size_t cellular_action_record_bytes = 48;
inline constexpr std::size_t max_cellular_action_records = 1'024;