Add M10.4c evo-server QUIC listener and headless session client
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m46s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
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 3m44s
Foundation / checks (client) (push) Canceled after 3m49s
Foundation / checks (network) (push) Canceled after 1m59s

evo-server gains an opt-in M10 listener (--m10-*, QUIC builds only): RegionSessions
with the PostgreSQL control and action ledgers on their own connection under the
host's lease, carried actions submitted to the host and its acknowledgements and
drops turned into outcomes. evo-session-probe is a dev-only headless client. Real
process tests cover intentions, durable action outcomes, SIGKILL before and after
an action's commit, duplicate retries and the probe. The simulated watermark now
reaches every session every tick, so clients always know the server tick.
ADR-0092.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-04 09:20:55 -04:00
co-authored by Claude Opus 5.5
parent 69f3ad7cf8
commit 0bf9901c7f
27 changed files with 1053 additions and 42 deletions
+3 -1
View File
@@ -40,7 +40,9 @@ class RegionSessionClient {
// Sends Close{client_closed} and closes the connection.
void close();
// Realtime intention for `tick` (server_tick + 1 ..= + 8); returns its sequence, or
// nothing unless established and sent. Datagrams may be lost: no receipt is not a refusal.
// nothing unless established and sent (also while the QUIC datagram extension is not yet
// negotiated, just after Welcome: retry). Datagrams may be lost: no receipt is not a
// refusal.
[[nodiscard]] std::optional<std::uint64_t>
send_intention(std::uint64_t tick, std::int16_t move_x, std::int16_t move_y);
// A discrete action with a caller-chosen id, unique for the account (stable across
+7 -3
View File
@@ -26,8 +26,10 @@ struct IntentLimits {
std::uint32_t max_actions_per_window{4}; // Every attempt counts.
std::size_t max_unresolved{256}; // Intentions plus actions per session.
std::size_t max_sessions{32};
std::size_t max_finals{2048}; // Recent final outcomes kept for duplicates and queries.
std::uint64_t watermark_every{20}; // Ticks between repeats of an unchanged watermark.
std::size_t max_finals{2048}; // Recent final outcomes kept for duplicates and queries.
// Ticks between watermarks to each session (1: every simulated tick). The watermark is
// also every client's clock for the server tick until snapshots carry it (10.5).
std::uint64_t watermark_every{1};
};
// The host's authority as admission must see it.
struct AdmissionFacts {
@@ -86,7 +88,9 @@ class IntentAdmission {
// is ready, and an action no longer in memory is looked up.
[[nodiscard]] ActionOutcome query(std::uint64_t session, const ActionQuery& m,
const AdmissionFacts& facts);
// Watermarks to send after the host simulated through facts.server_tick.
// Watermarks to send after the host simulated through facts.server_tick: to every
// session (sequence 0 before its first simulated intention) at least every
// `watermark_every` ticks, and whenever its sequence advances.
[[nodiscard]] std::vector<std::pair<std::uint64_t, SimulatedThrough>>
simulated(const AdmissionFacts& facts);
// Scheduled actions whose tick is <= `tick`: they ride that tick's batch from now on.
+31
View File
@@ -0,0 +1,31 @@
#pragma once
#include "evo/persistence/postgres.hpp"
#include <chrono>
#include <memory>
#include <utility>
// One lazily (re)connected PostgreSQL connection for single-owner callers such as the
// session ledgers (ADR-0091/0092). A caller that sees a store failure marks the slot broken;
// the next get() reconnects. Never retries a statement by itself.
namespace evo::server {
class PgSlot {
public:
PgSlot(persistence::PgOptions options, std::chrono::milliseconds connect_timeout)
: options_{std::move(options)}, timeout_{connect_timeout} {}
// Nullptr when no connection can be made now.
[[nodiscard]] persistence::Postgres* get() {
if (!db_)
if (auto made = persistence::Postgres::connect(options_, timeout_))
db_ = std::move(*made);
return db_.get();
}
void broken() noexcept {
db_.reset();
}
private:
persistence::PgOptions options_;
std::chrono::milliseconds timeout_;
std::unique_ptr<persistence::Postgres> db_;
};
} // namespace evo::server
@@ -1,27 +1,28 @@
#pragma once
#include "evo/network/intent_admission.hpp"
#include "evo/persistence/region_lease_store.hpp"
#include "evo/server/pg_slot.hpp"
#include <chrono>
#include <functional>
#include <optional>
#include <utility>
// M10.4b durable action records over the region's PostgreSQL lease (ADR-0092, schema v11).
// Linux only. Owned by the region host's thread, on the host's own connection. `lease`
// Linux only. Owned by the region host's thread, on its own connection slot. `lease`
// returns the host's current region lease, or nothing while it holds none; every lookup
// then reports `unavailable`, as does any store failure.
namespace evo::server {
class PostgresActionLedger final : public network::ActionLedger {
public:
using LeaseSource = std::function<std::optional<persistence::LeaseGrant>()>;
PostgresActionLedger(persistence::Postgres& db, persistence::RegionKey key, LeaseSource lease,
PostgresActionLedger(PgSlot& db, persistence::RegionKey key, LeaseSource lease,
std::chrono::milliseconds timeout = std::chrono::milliseconds{2000})
: db_{&db}, key_{key}, lease_{std::move(lease)}, timeout_{timeout} {}
[[nodiscard]] std::expected<std::optional<network::ActionOutcome>, network::ActionLedgerError>
find(const network::AccountId& account, std::uint64_t action_id) override;
private:
persistence::Postgres* db_;
PgSlot* db_;
persistence::RegionKey key_;
LeaseSource lease_;
std::chrono::milliseconds timeout_;
@@ -1,13 +1,14 @@
#pragma once
#include "evo/network/session_control.hpp"
#include "evo/persistence/account_control_store.hpp"
#include "evo/server/pg_slot.hpp"
#include <chrono>
#include <functional>
#include <optional>
#include <utility>
// M10.3c durable account control over the region's PostgreSQL lease (ADR-0091, schema v10).
// Linux only. Owned by the region host's thread, on the host's own connection. `lease`
// Linux only. Owned by the region host's thread, on its own connection slot. `lease`
// returns the host's current region lease, or nothing while it holds none (every call then
// reports `fenced`). Store failures that may have executed or are undecided report
// `unavailable`; the session layer then keeps or closes sessions by its own deadlines.
@@ -15,7 +16,7 @@ namespace evo::server {
class PostgresControlLedger final : public network::ControlLedger {
public:
using LeaseSource = std::function<std::optional<persistence::LeaseGrant>()>;
PostgresControlLedger(persistence::Postgres& db, persistence::RegionKey key, LeaseSource lease,
PostgresControlLedger(PgSlot& db, persistence::RegionKey key, LeaseSource lease,
std::chrono::milliseconds duration = std::chrono::milliseconds{20000},
std::chrono::milliseconds timeout = std::chrono::milliseconds{2000})
: db_{&db}, key_{key}, lease_{std::move(lease)}, duration_{duration}, timeout_{timeout} {}
@@ -26,7 +27,7 @@ class PostgresControlLedger final : public network::ControlLedger {
void release(const network::AccountId& account, std::uint64_t generation) override;
private:
persistence::Postgres* db_;
PgSlot* db_;
persistence::RegionKey key_;
LeaseSource lease_;
std::chrono::milliseconds duration_, timeout_;
+3
View File
@@ -128,6 +128,9 @@ template <typename State> class RegionHost {
[[nodiscard]] const HostStatus& status() const noexcept {
return status_;
}
// The current lease while this host may originate (for fenced calls made on its behalf,
// such as session control and action records); nothing otherwise.
[[nodiscard]] std::optional<persistence::LeaseGrant> authority() const;
// Read-only, for operational reporting (free space against the reserve).
[[nodiscard]] const persistence::FilesystemObjectStore& objects() const noexcept {
return *objects_;