Switch the engineering client to M10 sessions (M10.5c)
Foundation / checks (checks) (push) Successful in 32m47s
Foundation / checks (client) (push) Failing after 10m1s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m53s
Foundation / checks (network) (push) Successful in 11m18s
Foundation / checks (postgres) (push) Successful in 40m20s
Foundation / checks (tsan) (push) Successful in 7m46s
Foundation / postgres-tools (push) Skipped
Foundation / image (push) Skipped
Foundation / server-image (push) Skipped

evo-client's remote mode now runs over RegionSessionClient (QUIC, session
v2): snapshot-fed environment and organism views, the camera following the
server's view until the user moves it and then driving the interest, intention
records with a simulated state, and reconnects with the next grant of a bundle.
The launcher reads 160-byte M10 grants and defaults to the dev route.

- quic::resolve_ipv4 shared by the client and evo-session-probe
- evo-session-probe grants: owner-only bundles of 1-64 grants
- evo-server --m10-max-grant-lifetime (dev only, 60..3600 s)
- presets client-network/client-package build QUIC; msquic links the CRT
  fully static; msquic.dll and msquic/OpenSSL licences in the Windows package
- client-remote-session test against a loopback region
- ADR-0093/0091/0086 amendments, M10_CLIENT_SESSIONS guide, validation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-06 11:57:07 -04:00
co-authored by Claude Opus 5.5
parent 33e91458e7
commit 1819ebc0ab
35 changed files with 1119 additions and 270 deletions
+6 -5
View File
@@ -140,9 +140,13 @@ if(EVO_BUILD_QUIC)
endif()
include(cmake/Quic.cmake)
# M10.2b transport: bounded channels and exact CA pinning over msquic.
add_library(evo_network_quic STATIC src/network/transport/quic_endpoint.cpp)
add_library(evo_network_quic STATIC src/network/transport/quic_endpoint.cpp
src/network/transport/host_lookup.cpp)
target_include_directories(evo_network_quic PUBLIC "${PROJECT_SOURCE_DIR}/include")
target_link_libraries(evo_network_quic PUBLIC evo_msquic PRIVATE mbedtls)
if(WIN32)
target_link_libraries(evo_network_quic PRIVATE ws2_32) # Host name lookup.
endif()
evo_owned_target(evo_network_quic)
# M10.3b session login over QUIC (ADR-0091): region side and client side.
add_library(evo_session_server STATIC src/server/session/region_sessions.cpp)
@@ -154,9 +158,6 @@ if(EVO_BUILD_QUIC)
# M10.4c headless session client (development and test only; ADR-0092).
add_executable(evo-session-probe apps/evo-session-probe/main.cpp)
target_link_libraries(evo-session-probe PRIVATE evo_session_client evo_network_tls)
if(WIN32)
target_link_libraries(evo-session-probe PRIVATE ws2_32) # Host name lookup.
endif()
evo_owned_target(evo-session-probe)
evo_msquic_runtime(evo-session-probe)
if(BUILD_TESTING)
@@ -183,7 +184,7 @@ if(EVO_BUILD_QUIC)
evo_owned_target(evo-quic-session-tests)
evo_msquic_runtime(evo-quic-session-tests)
add_test(NAME quic-sessions COMMAND evo-quic-session-tests)
set_tests_properties(quic-sessions PROPERTIES TIMEOUT 120 LABELS "quic")
set_tests_properties(quic-sessions PROPERTIES TIMEOUT 120 LABELS "quic;quic-session")
add_executable(evo-quic-smoke-tests tests/quic_smoke.cpp)
target_link_libraries(evo-quic-smoke-tests PRIVATE evo_msquic evo_network_tls)
evo_owned_target(evo-quic-smoke-tests)
+5 -5
View File
@@ -11,7 +11,7 @@
{"name": "client", "inherits": "release", "cacheVariables": {"EVO_BUILD_CLIENT": "ON"}},
{"name": "client-probe", "inherits": "release", "cacheVariables": {"EVO_BUILD_CLIENT_PROBE": "ON"}},
{"name": "network", "inherits": "release", "cacheVariables": {"EVO_BUILD_NETWORK": "ON"}},
{"name": "client-network", "inherits": "release", "cacheVariables": {"EVO_BUILD_CLIENT": "ON", "EVO_BUILD_NETWORK": "ON"}},
{"name": "client-network", "inherits": "release", "cacheVariables": {"EVO_BUILD_CLIENT": "ON", "EVO_BUILD_NETWORK": "ON", "EVO_BUILD_QUIC": "ON"}},
{"name": "quic", "inherits": "network", "cacheVariables": {"EVO_BUILD_QUIC": "ON"}},
{"name": "client-package", "inherits": "client-network", "cacheVariables": {"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded", "EVO_REPRODUCIBLE": "ON"}}
],
@@ -25,8 +25,8 @@
{"name": "client-probe", "configurePreset": "client-probe", "targets": ["evo-client-probe"]},
{"name": "network", "configurePreset": "network", "targets": ["evo-client-state-tests", "evo-network-tests", "evo-dev-session"]},
{"name": "quic", "configurePreset": "quic", "targets": ["evo-quic-smoke-tests", "evo-quic-transport-tests", "evo-quic-session-tests", "evo-quic-hol-measure", "evo-session-probe", "evo-network-tests"]},
{"name": "client-network", "configurePreset": "client-network", "targets": ["evo-client-state-tests", "evo-client", "evo-client-lifecycle-tests", "evo-client-environment-tests", "evo-client-organism-tests", "evo-client-ui-model-tests", "evo-client-panel-tests", "evo-client-bindings-tests", "evo-network-tests", "evo-dev-session"]},
{"name": "client-package", "configurePreset": "client-package", "targets": ["evo-client-state-tests", "evo-client", "evo-client-lifecycle-tests", "evo-client-environment-tests", "evo-client-organism-tests", "evo-client-ui-model-tests", "evo-client-panel-tests", "evo-client-bindings-tests", "evo-network-tests", "evo-dev-session"]}
{"name": "client-network", "configurePreset": "client-network", "targets": ["evo-client-state-tests", "evo-client", "evo-client-lifecycle-tests", "evo-client-environment-tests", "evo-client-organism-tests", "evo-client-ui-model-tests", "evo-client-panel-tests", "evo-client-bindings-tests", "evo-network-tests", "evo-dev-session", "evo-quic-session-tests", "evo-client-remote-tests", "evo-session-probe"]},
{"name": "client-package", "configurePreset": "client-package", "targets": ["evo-client-state-tests", "evo-client", "evo-client-lifecycle-tests", "evo-client-environment-tests", "evo-client-organism-tests", "evo-client-ui-model-tests", "evo-client-panel-tests", "evo-client-bindings-tests", "evo-network-tests", "evo-dev-session", "evo-quic-session-tests", "evo-client-remote-tests"]}
],
"testPresets": [
{"name": "debug", "configurePreset": "debug", "output": {"outputOnFailure": true}},
@@ -38,7 +38,7 @@
{"name": "client-probe", "configurePreset": "client-probe", "filter": {"include": {"label": "client"}}, "output": {"outputOnFailure": true}},
{"name": "network", "configurePreset": "network", "filter": {"include": {"label": "network"}}, "output": {"outputOnFailure": true}},
{"name": "quic", "configurePreset": "quic", "filter": {"include": {"label": "quic|network"}}, "output": {"outputOnFailure": true}},
{"name": "client-network", "configurePreset": "client-network", "filter": {"include": {"label": "client|network"}}, "output": {"outputOnFailure": true}},
{"name": "client-package", "configurePreset": "client-package", "filter": {"include": {"label": "client|network"}}, "output": {"outputOnFailure": true}}
{"name": "client-network", "configurePreset": "client-network", "filter": {"include": {"label": "client|network|quic-session"}}, "output": {"outputOnFailure": true}},
{"name": "client-package", "configurePreset": "client-package", "filter": {"include": {"label": "client|network|quic-session"}}, "output": {"outputOnFailure": true}}
]
}
+4 -2
View File
@@ -190,8 +190,10 @@ ctest --preset network
```
See [DEV_SESSION_PROTOCOL](docs/networking/DEV_SESSION_PROTOCOL.md) and ADR-0082.
M9.7 connects `evo-client` (preset `client-network`) to a dev region running
`evo-server --session-listen ...`; see [DEV_SESSION_OPERATIONS](docs/networking/DEV_SESSION_OPERATIONS.md).
`evo-client` (preset `client-network`, which includes QUIC) connects to a dev region over
M10 sessions; see [M10_CLIENT_SESSIONS](docs/networking/M10_CLIENT_SESSIONS.md). The M9.7
path ([DEV_SESSION_OPERATIONS](docs/networking/DEV_SESSION_OPERATIONS.md)) is no longer used
by the client.
Windows: `tools/windows-check.ps1 -Preset network -Action check`.
+9
View File
@@ -456,6 +456,15 @@ int main(int argc, char** argv) try {
if (!intention)
return 1;
host.step(now, *intention, ui); // Only while connecting or connected.
// M10.5c: the camera follows the server's view until the user moves it; from then
// on its centre is the session's interest (the server clamps and filters it).
if (auto* remote = host.session(); remote && mode() == Mode::remote) {
if (const auto centre = remote->take_recentre())
if (auto moved = evo::client::Camera::create(camera->viewport(), *centre,
camera->units_per_mm()))
*camera = *moved;
remote->focus(camera->centre());
}
// The fixture authority advances at its own cadence. Presentations refresh
// every N authority ticks; in between the advanced watermark shows as stale.
if (mode() == Mode::fixture && count % frames_per_authority_tick == 0) {
+13 -1
View File
@@ -53,6 +53,8 @@ const char* outcome_name(client::OutcomeState s) {
return "not committed";
case client::OutcomeState::unknown:
return "UNKNOWN (connection lost)";
case client::OutcomeState::simulated:
return "simulated (not durable)";
}
return "?";
}
@@ -343,8 +345,16 @@ void session(const PanelView& v) {
row("Connection", s.phase);
row("Session / epoch", std::to_string(s.session) + " / " + std::to_string(s.epoch));
row("Server tick", std::to_string(s.server_tick));
row("Durable watermark", std::to_string(s.commit_watermark));
row("Simulated through", std::to_string(s.simulated_tick));
row("Grants left", std::to_string(s.grants_left));
row("Snapshot", s.snapshot_tick == 0 ? std::string{"none yet"}
: "tick " + std::to_string(s.snapshot_tick) + ", " +
std::to_string(s.cells) + " cells, " +
std::to_string(s.organisms) + " organisms");
if (s.focused)
row("Interest", std::to_string(s.focus_x) + ", " + std::to_string(s.focus_y) + ", z " +
std::to_string(s.focus_z) + " (radius 7)");
row("Snapshot bytes", std::to_string(s.snapshot_bytes));
ImGui::EndTable();
}
disabled_wrapped("Intentions (newest first; this is the record, toasts expire):");
@@ -364,6 +374,8 @@ void session(const PanelView& v) {
static_cast<unsigned long long>(it->commit_sequence));
else if (it->state == client::OutcomeState::rejected)
ImGui::Text("status %u", static_cast<unsigned>(it->detail));
else if (it->tick != 0)
ImGui::Text("tick %llu", static_cast<unsigned long long>(it->tick));
}
ImGui::EndTable();
}
+325 -128
View File
@@ -1,8 +1,16 @@
#pragma once
// M9.7/M9.8c remote dev session for the engineering client (ADR-0083). Without
// EVO_CLIENT_NETWORK (a build without EVO_BUILD_NETWORK) remote mode is unavailable.
// The client only presents copies and sends bounded intentions; it never predicts.
// Grant bytes stay inside the session client: never printed, shown or persisted.
// M10.5c remote dev session for the engineering client (ADR-0093, over ADR-0091/0092
// sessions). Without EVO_CLIENT_NETWORK (a build without EVO_BUILD_QUIC) remote mode is
// unavailable. The client only presents copies of replicated snapshots and sends bounded
// intentions; it never predicts. Grant bytes stay inside the session: each is handed to
// one connection and wiped here; never printed, shown or persisted.
//
// One connection per grant (ADR-0089): a lost or closed session reconnects with the next
// grant of the bundle after a growing pause (2 s .. 30 s, reset by a Welcome), which keeps
// a reconnect loop inside the region's per-account attempt limit. Views come from the
// newest applied snapshot. The camera follows the server's default view until the user
// moves it; from then on it drives the interest (radius 7), at most every 250 ms.
#include "evo/client/camera.hpp"
#include "evo/client/environment_view.hpp"
#include "evo/client/input.hpp"
#include "evo/client/launcher.hpp"
@@ -17,172 +25,357 @@
#include <string>
#ifdef EVO_CLIENT_NETWORK
#include "evo/network/session_client.hpp"
#include "evo/client/region_session.hpp"
#include "evo/network/quic_transport.hpp"
#include "evo/world/coordinates.hpp"
#include <algorithm>
#include <cmath>
#include <deque>
#include <type_traits>
#include <utility>
#include <vector>
#endif
namespace evo::client_app {
struct RemoteStatus {
std::string phase; // connecting / connected / reconnecting / out of grants
std::uint64_t session{}, epoch{}, server_tick{}, commit_watermark{};
std::uint64_t session{}, epoch{}, server_tick{}, simulated_tick{};
std::size_t grants_left{};
bool welcomed{};
// Newest applied snapshot and the interest last asked for (ADR-0093).
std::uint64_t snapshot_tick{}, snapshot_bytes{};
std::size_t cells{}, organisms{};
std::int64_t focus_x{}, focus_y{}, focus_z{};
bool focused{};
};
#ifdef EVO_CLIENT_NETWORK
inline constexpr bool remote_available = true;
static_assert(std::is_same_v<client::GrantRecord, network::DevGrant>,
static_assert(std::is_same_v<client::GrantRecord, network::WireGrant>,
"the launcher's grant record is the session's grant");
class RemoteSession {
public:
static constexpr std::uint16_t interest_radius = 7;
static constexpr std::uint64_t intention_lead = 2; // Ticks ahead of the server tick.
// Looks the endpoint up once (blocking); nothing connects until the first step().
static std::optional<RemoteSession> open(const client::ConnectMaterial& m) {
network::SessionClientConfig config;
config.host = m.endpoint.host;
config.port = m.endpoint.port;
config.trust = {m.authority_pem, m.server_name};
config.grants = m.grants;
auto made = network::SessionClient::create(std::move(config));
if (!made)
const auto address = network::quic::resolve_ipv4(m.endpoint.host);
if (!address || m.grants.empty())
return std::nullopt;
RemoteSession session;
session.client_ = std::move(*made);
session.transport_.server_address = *address;
session.transport_.port = m.endpoint.port;
session.transport_.server_name = m.server_name;
session.transport_.authority_pem = m.authority_pem;
session.transport_.authority_pem_file = m.authority_path;
session.grants_ = m.grants;
return session;
}
RemoteSession(RemoteSession&&) noexcept = default;
RemoteSession& operator=(RemoteSession&&) noexcept = default;
RemoteSession(const RemoteSession&) = delete;
RemoteSession& operator=(const RemoteSession&) = delete;
~RemoteSession() {
if (client_)
client_->close(); // Close{client_closed}; unresolved intentions stay unknown.
for (auto& g : grants_)
g.fill(0);
}
[[nodiscard]] const client::EnvironmentLayer& environment() const noexcept {
return client_->environment();
return environment_;
}
[[nodiscard]] const client::OrganismLayer& organisms() const noexcept {
return client_->organisms();
return organisms_;
}
[[nodiscard]] const client::OutcomeLog& outcomes() const noexcept {
return log_;
}
[[nodiscard]] RemoteStatus status() const {
using network::SessionPhase;
RemoteStatus s;
const auto phase = client_->phase();
s.phase = phase == SessionPhase::established ? "connected"
: phase == SessionPhase::exhausted ? "out of grants"
: welcomed_ ? "reconnecting"
: "connecting";
if (const auto w = client_->welcome()) {
s.session = w->session;
s.epoch = w->epoch;
}
if (const auto v = client_->latest_view()) {
s.server_tick = v->server_tick;
s.commit_watermark = v->commit_watermark;
}
s.grants_left = client_->grants_left();
const bool live = client_ && client_->state() == client::RegionSessionState::established;
s.phase = live ? "connected"
: exhausted_ ? "out of grants"
: welcomed_ ? "reconnecting"
: "connecting";
s.session = session_;
s.epoch = epoch_;
s.server_tick = server_tick_;
s.simulated_tick = simulated_tick_;
s.grants_left = grants_.size() - next_;
s.welcomed = welcomed_;
s.snapshot_tick = seen_snapshot_;
s.snapshot_bytes = snapshot_bytes_ + (client_ ? client_->snapshot_bytes() : 0);
if (const auto* e = environment_.current())
s.cells = e->cells().size();
if (const auto* o = organisms_.current())
s.organisms = o->cells().size();
if (sent_interest_) {
s.focused = true;
s.focus_x = sent_interest_->x;
s.focus_y = sent_interest_->y;
s.focus_z = sent_interest_->z;
}
return s;
}
// Where the camera should be while it follows the server's view: the middle of the
// newest snapshot's square, offered whenever it changes (the first snapshots may still
// be filling in, nearest cells first).
[[nodiscard]] std::optional<client::WorldPoint> take_recentre() {
return std::exchange(recentre_, std::nullopt);
}
// Called every frame with the camera centre. While following, a centre other than the
// one offered means the user moved the camera: from then on the camera's voxel is the
// interest of the next sends.
void focus(client::WorldPoint centre) {
if (!std::isfinite(centre.x_mm) || !std::isfinite(centre.y_mm))
return;
if (following_) {
if (!offered_ || (centre.x_mm == offered_->x_mm && centre.y_mm == offered_->y_mm))
return; // Nothing shown yet, or still where the view put it.
following_ = false;
recentre_.reset();
}
constexpr auto pitch = static_cast<double>(world::cell_pitch_mm);
constexpr double limit = 9.0e15; // Well inside int64 and the camera's own range.
const double x = std::floor(centre.x_mm / pitch), y = std::floor(centre.y_mm / pitch);
if (std::abs(x) > limit || std::abs(y) > limit)
return;
wanted_ = network::SessionInterest{static_cast<std::int64_t>(x),
static_cast<std::int64_t>(y), slice_z_, interest_radius};
}
// Services the connection; sends the intention when its vector changed, at most once
// per received server tick (the server also rate-limits). Session events update the
// outcome log (the durable record), short notifications and the launcher.
// per server tick. Session events update the outcome log (the record), short
// notifications and the launcher.
void step(std::chrono::steady_clock::time_point now, const client::Intention& intention,
client::UiState& ui, client::Launcher& launcher) {
client_->poll(now);
const auto view = client_->latest_view();
const bool changed = intention.move_x != sent_x_ || intention.move_y != sent_y_;
if (view && changed && (!sent_tick_ || view->server_tick > *sent_tick_) &&
client_->send(intention)) {
sent_x_ = intention.move_x;
sent_y_ = intention.move_y;
sent_tick_ = view->server_tick;
log_.record({intention.sequence, client::OutcomeState::sent});
if (!client_ && !start(now, launcher))
return;
auto& c = *client_;
c.poll(now);
if (c.state() == client::RegionSessionState::closed) {
end(now, ui, launcher);
return;
}
for (const auto& e : client_->take_events())
report(e, ui, launcher);
// Refused TCP or failed TLS produce no event; each still counts toward the
// launcher's bounded "server unreachable" before a first Welcome.
for (; unreachable_ < client_->unreachable_attempts(); ++unreachable_)
launcher.observe(client::ConnectSignal::lost);
}
private:
static void notify(client::UiState& ui, const char* text, client::NoticeLevel level) {
static_cast<void>(ui.notify(text, level).has_value()); // Bounded; overflow evicts.
}
void report(const network::ClientEvent& e, client::UiState& ui, client::Launcher& launcher) {
using Kind = network::ClientEvent::Kind;
using network::CloseReason;
switch (e.kind) {
case Kind::welcome:
welcomed_ = true;
sent_tick_.reset(); // New session: resend the current intention.
sent_x_ = sent_y_ = 0;
launcher.observe(client::ConnectSignal::welcome);
notify(ui, "Connected to the dev region (fresh baseline).", client::NoticeLevel::info);
std::printf("session welcome session=%llu epoch=%llu tick=%llu commit=%llu\n",
static_cast<unsigned long long>(e.welcome.session),
static_cast<unsigned long long>(e.welcome.epoch),
static_cast<unsigned long long>(e.welcome.server_tick),
static_cast<unsigned long long>(e.welcome.commit_watermark));
break;
case Kind::closed: {
const bool retry =
e.reason == CloseReason::server_shutdown || e.reason == CloseReason::capacity;
const bool lost = e.reason == CloseReason::timeout ||
e.reason == CloseReason::stale_epoch ||
e.reason == CloseReason::rate_limited;
launcher.observe(retry ? client::ConnectSignal::not_ready
: lost ? client::ConnectSignal::lost
: client::ConnectSignal::refused);
notify(ui, retry ? "Server not ready; retrying." : "Session closed by the server.",
retry ? client::NoticeLevel::info : client::NoticeLevel::warning);
std::printf("session closed reason=%u\n", static_cast<unsigned>(e.reason));
break;
}
case Kind::lost:
launcher.observe(client::ConnectSignal::lost);
notify(ui, "Connection lost; views are stale.", client::NoticeLevel::warning);
std::puts("session lost (reconnecting with a fresh grant)");
break;
case Kind::result:
log_.record({e.sequence,
e.result.status == network::IntentStatus::admitted
? client::OutcomeState::admitted
: client::OutcomeState::rejected,
static_cast<std::uint8_t>(e.result.status)});
std::printf("intent %llu status=%u\n", static_cast<unsigned long long>(e.sequence),
static_cast<unsigned>(e.result.status));
break;
case Kind::outcome:
log_.record({e.sequence,
e.outcome.finality == network::IntentFinality::committed_no_effect
? client::OutcomeState::durable
: client::OutcomeState::not_committed,
0, e.outcome.tick, e.outcome.commit_sequence});
std::printf("intent %llu final=%u tick=%llu commit=%llu\n",
static_cast<unsigned long long>(e.sequence),
static_cast<unsigned>(e.outcome.finality),
static_cast<unsigned long long>(e.outcome.tick),
static_cast<unsigned long long>(e.outcome.commit_sequence));
break;
case Kind::unknown:
log_.record({e.sequence, client::OutcomeState::unknown});
std::printf("intent %llu outcome unknown (connection lost)\n",
static_cast<unsigned long long>(e.sequence));
break;
case Kind::backpressure:
notify(ui, "Session event backlog; reconnecting after draining.",
client::NoticeLevel::warning);
std::puts("session event backlog: disconnected; draining before reconnect");
break;
case Kind::exhausted:
launcher.observe(client::ConnectSignal::exhausted);
std::puts("session grants exhausted; issue a new bundle to reconnect");
break;
if (c.state() != client::RegionSessionState::established)
return;
if (!established_)
welcome(ui, launcher);
server_tick_ = c.server_tick();
send(intention);
receipts();
snapshot();
if (wanted_ && (!sent_interest_ || *wanted_ != *sent_interest_) &&
now - interest_at_ >= std::chrono::milliseconds{250} && c.set_interest(*wanted_)) {
sent_interest_ = wanted_;
interest_at_ = now;
}
std::fflush(stdout);
}
std::unique_ptr<network::SessionClient> client_;
private:
using Clock = std::chrono::steady_clock;
// Session sequences restart with each session; the log numbers intentions itself.
struct Pending {
std::uint64_t sequence{}, entry{}, tick{};
bool admitted{};
};
static constexpr std::size_t max_pending = client::OutcomeLog::capacity;
RemoteSession() = default;
static void notify(client::UiState& ui, const char* text, client::NoticeLevel level) {
static_cast<void>(ui.notify(text, level).has_value()); // Bounded; overflow evicts.
}
// Opens the next connection with the next grant; false while pausing or out of grants.
bool start(Clock::time_point now, client::Launcher& launcher) {
if (now < retry_at_)
return false;
if (next_ >= grants_.size()) {
if (!exhausted_) {
exhausted_ = true;
launcher.observe(client::ConnectSignal::exhausted);
std::puts("session grants exhausted; issue a new bundle to reconnect");
}
return false;
}
client::RegionSessionClientConfig config;
config.transport = transport_;
config.grant = grants_[next_];
grants_[next_].fill(0);
++next_;
auto made = client::RegionSessionClient::connect(std::move(config), now);
if (!made) {
launcher.observe(client::ConnectSignal::lost);
pause(now);
return false;
}
client_ = std::move(*made);
established_ = false;
return true;
}
void pause(Clock::time_point now) {
retry_at_ = now + backoff_;
backoff_ = std::min(backoff_ * 2, std::chrono::seconds{30});
}
void welcome(client::UiState& ui, client::Launcher& launcher) {
const auto& w = *client_->welcome();
established_ = true;
welcomed_ = true;
backoff_ = std::chrono::seconds{2};
if (w.epoch != epoch_) { // Another authority lineage: start the views afresh.
environment_.reset();
organisms_.reset();
seen_snapshot_ = 0;
}
session_ = w.session;
epoch_ = w.epoch;
sent_tick_.reset(); // New session: resend the current intention.
sent_x_ = sent_y_ = 0;
sent_interest_.reset(); // The server starts from its default interest.
launcher.observe(client::ConnectSignal::welcome);
notify(ui, "Connected to the dev region (fresh baseline).", client::NoticeLevel::info);
std::printf("session welcome session=%llu epoch=%llu tick=%llu\n",
static_cast<unsigned long long>(w.session),
static_cast<unsigned long long>(w.epoch),
static_cast<unsigned long long>(w.server_tick));
}
void send(const client::Intention& intention) {
const bool changed = intention.move_x != sent_x_ || intention.move_y != sent_y_;
if (!changed || server_tick_ == 0 || (sent_tick_ && server_tick_ <= *sent_tick_))
return;
const auto tick = server_tick_ + intention_lead;
// Refused until the datagram extension is negotiated: retried next frame.
const auto sequence = client_->send_intention(tick, intention.move_x, intention.move_y);
if (!sequence)
return;
sent_x_ = intention.move_x;
sent_y_ = intention.move_y;
sent_tick_ = server_tick_;
const auto entry = next_entry_++;
log_.record({entry, client::OutcomeState::sent, 0, tick});
if (pending_.size() == max_pending)
pending_.pop_front(); // Its log entry was evicted with it.
pending_.push_back({*sequence, entry, tick, false});
}
void receipts() {
for (const auto& r : client_->take_intention_receipts()) {
const auto it = std::find_if(pending_.begin(), pending_.end(), [&](const Pending& p) {
return p.sequence == r.sequence;
});
if (it == pending_.end())
continue; // Evicted from the bounded record already.
std::printf("intent %llu status=%u\n", static_cast<unsigned long long>(it->entry),
static_cast<unsigned>(r.status));
if (r.status == network::AdmitStatus::admitted) {
log_.record({it->entry, client::OutcomeState::admitted, 0, it->tick});
it->admitted = true;
} else {
log_.record({it->entry, client::OutcomeState::rejected,
static_cast<std::uint8_t>(r.status), it->tick});
pending_.erase(it);
}
}
const auto s = client_->simulated();
if (!s)
return;
simulated_tick_ = s->tick;
// Cumulative: every admitted intention up to the sequence, at or before the tick.
std::erase_if(pending_, [&](const Pending& p) {
if (!p.admitted || p.sequence > s->sequence || p.tick > s->tick)
return false;
log_.record({p.entry, client::OutcomeState::simulated, 0, p.tick});
return true;
});
}
void snapshot() {
const auto* v = client_->view();
if (v == nullptr || v->tick == seen_snapshot_)
return;
seen_snapshot_ = v->tick;
slice_z_ = v->slice_z;
if (auto e = client_->environment()) {
if (!environment_.accept(*e)) { // E.g. regressed after a restore: start afresh.
environment_.reset();
static_cast<void>(environment_.accept(std::move(*e)).has_value());
}
}
if (auto o = client_->organisms()) {
if (!organisms_.accept(*o)) {
organisms_.reset();
static_cast<void>(organisms_.accept(std::move(*o)).has_value());
}
}
if (!following_ || v->environment.empty())
return;
const auto [lx, hx] =
std::minmax_element(v->environment.begin(), v->environment.end(),
[](const auto& a, const auto& b) { return a.voxel.x < b.voxel.x; });
const auto [ly, hy] =
std::minmax_element(v->environment.begin(), v->environment.end(),
[](const auto& a, const auto& b) { return a.voxel.y < b.voxel.y; });
constexpr auto pitch = static_cast<double>(world::cell_pitch_mm);
const client::WorldPoint middle{
(static_cast<double>(lx->voxel.x) + static_cast<double>(hx->voxel.x) + 1) * pitch / 2,
(static_cast<double>(ly->voxel.y) + static_cast<double>(hy->voxel.y) + 1) * pitch / 2};
if (!offered_ || middle.x_mm != offered_->x_mm || middle.y_mm != offered_->y_mm)
recentre_ = offered_ = middle;
}
// The connection ended: decide what the launcher hears and pause before the next grant.
void end(Clock::time_point now, client::UiState& ui, client::Launcher& launcher) {
using network::SessionCloseReason;
const auto reason = client_->close_reason().value_or(SessionCloseReason::connection_lost);
const bool was_established = established_;
snapshot_bytes_ += client_->snapshot_bytes();
for (const auto& p : pending_)
log_.record({p.entry, client::OutcomeState::unknown, 0, p.tick});
pending_.clear();
environment_.mark_stale();
organisms_.mark_stale();
client_.reset();
established_ = false;
const bool not_ready =
reason == SessionCloseReason::shutdown || reason == SessionCloseReason::capacity;
const bool lost = reason == SessionCloseReason::connection_lost ||
reason == SessionCloseReason::timeout ||
reason == SessionCloseReason::rate_limited ||
reason == SessionCloseReason::stale_epoch ||
(was_established && reason == SessionCloseReason::expired);
if (reason == SessionCloseReason::superseded) {
// Another client holds this account's newer grant: never fight it.
launcher.fail(client::LaunchError::grant_refused);
notify(ui, "Another client opened a session with this account.",
client::NoticeLevel::warning);
} else {
launcher.observe(not_ready ? client::ConnectSignal::not_ready
: lost ? client::ConnectSignal::lost
: client::ConnectSignal::refused);
notify(ui,
not_ready ? "Server not ready; retrying."
: was_established ? "Session ended; reconnecting with the next grant."
: "Connection attempt failed.",
not_ready ? client::NoticeLevel::info : client::NoticeLevel::warning);
}
std::printf("session closed reason=%u\n", static_cast<unsigned>(reason));
pause(now);
}
network::quic::ClientConfig transport_;
std::vector<network::WireGrant> grants_;
std::size_t next_{};
std::unique_ptr<client::RegionSessionClient> client_;
client::EnvironmentLayer environment_;
client::OrganismLayer organisms_;
client::OutcomeLog log_;
std::deque<Pending> pending_;
std::uint64_t next_entry_{1};
Clock::time_point retry_at_{}, interest_at_{};
std::chrono::seconds backoff_{2};
std::uint64_t session_{}, epoch_{}, server_tick_{}, simulated_tick_{}, seen_snapshot_{},
snapshot_bytes_{};
std::optional<std::uint64_t> sent_tick_;
std::uint64_t unreachable_{};
std::optional<network::SessionInterest> wanted_, sent_interest_;
std::optional<client::WorldPoint> recentre_, offered_;
std::int64_t slice_z_{};
std::int16_t sent_x_{}, sent_y_{};
bool welcomed_{};
bool established_{}, welcomed_{}, exhausted_{};
bool following_{true}; // The camera follows the server's (default) view.
};
#else
inline constexpr bool remote_available = false;
@@ -203,6 +396,10 @@ class RemoteSession {
[[nodiscard]] RemoteStatus status() const {
return {"unavailable in this build"};
}
[[nodiscard]] std::optional<client::WorldPoint> take_recentre() {
return std::nullopt;
}
void focus(client::WorldPoint) {}
void step(std::chrono::steady_clock::time_point, const client::Intention&, client::UiState&,
client::Launcher&) {}
+9 -1
View File
@@ -38,9 +38,11 @@
namespace evo::server_app {
struct M10Options {
std::string listen, certificate, key, issuer, environment, session_window;
// M10.5c: dev only, 60..3600 s; 0 keeps the default (300 s, ADR-0091).
std::uint64_t max_grant_lifetime{};
[[nodiscard]] bool any() const noexcept {
return !listen.empty() || !certificate.empty() || !key.empty() || !issuer.empty() ||
!environment.empty() || !session_window.empty();
!environment.empty() || !session_window.empty() || max_grant_lifetime != 0;
}
[[nodiscard]] bool complete() const noexcept {
return !listen.empty() && !certificate.empty() && !key.empty() && !issuer.empty() &&
@@ -86,6 +88,12 @@ template <typename Host> class M10Bridge {
: o.environment == "stage"
? network::DeploymentEnvironment::stage
: network::DeploymentEnvironment::world0;
if (o.max_grant_lifetime != 0) {
// Longer grants let a tester's bundle outlive a coffee break; never outside dev.
if (config.control.environment != network::DeploymentEnvironment::dev)
return fail("error m10-grant-lifetime");
config.control.max_grant_lifetime = o.max_grant_lifetime;
}
config.control.world = {key.world, frame};
config.control.region = key.region;
config.control.epoch = 1; // Follows the host's epoch from the first poll.
+4 -1
View File
@@ -229,6 +229,8 @@ std::optional<Options> parse(int argc, char** argv) {
o.m10.environment = value;
else if (flag == "--session-window")
o.m10.session_window = value;
else if (flag == "--m10-max-grant-lifetime" && n && *n >= 60 && *n <= 3600)
o.m10.max_grant_lifetime = *n;
else if (flag == "--crash-at") {
const auto colon = value.find(':');
const auto ordinal =
@@ -593,7 +595,8 @@ int main(int argc, char** argv) {
"--session-cert F --session-key F --session-grant-key F "
"--session-grant-ledger F --session-environment dev]] [--m10-listen "
"ADDRESS:PORT --m10-cert F --m10-key F --m10-issuer F "
"--m10-environment dev|stage|world0 --session-window ACTIVATION:UTC_EXPIRY]\n",
"--m10-environment dev|stage|world0 --session-window ACTIVATION:UTC_EXPIRY "
"[--m10-max-grant-lifetime 60..3600]]\n",
stderr);
return 2;
}
+104 -60
View File
@@ -3,6 +3,14 @@
// evo-session-probe keys --out DIR
// Writes a fresh dev issuer key pair: DIR/issuer.key (32-byte P-256 scalar, owner-only)
// and DIR/issuer.pub (65-byte public key for evo-server --m10-issuer).
// evo-session-probe grants --issuer-key FILE --world N --frame N --region N
// --account HEX32 --out FILE [--serial N] [--count 1..64] [--lifetime 60..3600]
// M10.5c (ADR-0093): writes COUNT 160-byte grants for one account (the engineering
// client's grant bundle), serials SERIAL..SERIAL+COUNT-1, all issued now. Without
// --serial the first is 64 x the issue time in seconds, so a later bundle for the same
// account supersedes an earlier one without bookkeeping. The file is created new and
// owner-only (a credential: never commit or share it); the issuer key stays here.
// The region refuses grants longer than its --m10-max-grant-lifetime (default 300).
// evo-session-probe run --connect HOST:PORT --server-name NAME --ca FILE --issuer-key FILE
// --world N --frame N --region N --account HEX32 --serial N [--lifetime S]
// [--intents N] [--actions N --action-base ID] [--query ID]... [--timeout-ms N]
@@ -21,22 +29,6 @@
// action is final and every query answered, 1 on timeout, 3 when the server closes.
// The issuer key is a development credential: the probe refuses any environment but dev.
#include "evo/client/region_session.hpp"
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <winsock2.h>
// After <winsock2.h>.
#include <ws2tcpip.h>
#else
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#endif
#include "evo/network/session_grant.hpp"
#include <algorithm>
#include <array>
@@ -91,28 +83,6 @@ std::optional<AccountId> account_of(std::string_view hex) {
return id.valid() ? std::optional{id} : std::nullopt;
}
// The QUIC endpoint takes a numeric address (the server name is verified separately):
// look a host name up once, IPv4, and print what DNS answered.
std::optional<std::string> resolve(const std::string& host) {
#ifdef _WIN32
WSADATA data{};
if (WSAStartup(MAKEWORD(2, 2), &data) != 0)
return std::nullopt;
#endif
addrinfo hints{};
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_DGRAM;
addrinfo* found = nullptr;
if (getaddrinfo(host.c_str(), nullptr, &hints, &found) != 0 || found == nullptr)
return std::nullopt;
char text[INET_ADDRSTRLEN] = {};
const auto* address = reinterpret_cast<const sockaddr_in*>(found->ai_addr);
const bool ok = inet_ntop(AF_INET, &address->sin_addr, text, sizeof text) != nullptr;
freeaddrinfo(found);
if (!ok)
return std::nullopt;
return std::string{text};
}
const char* cause_name(std::optional<quic::CloseCause> c) {
if (!c)
return "none";
@@ -134,6 +104,33 @@ const char* cause_name(std::optional<quic::CloseCause> c) {
}
}
std::uint64_t now_seconds() {
return static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
.count());
}
std::optional<GrantSigningKey> issuer(const std::string& path) {
const auto scalar = read(path);
auto key = GrantSigningKey::import(
DeploymentEnvironment::dev, 1,
std::span{reinterpret_cast<const std::uint8_t*>(scalar.data()), scalar.size()});
if (!key)
return std::nullopt;
return std::move(*key);
}
std::optional<SessionGrant> sign(const GrantSigningKey& key, GrantClaims claims) {
std::array<std::uint8_t, 8> id{};
if (!random_bytes(id))
return std::nullopt;
for (std::size_t i = 0; i < id.size(); ++i)
claims.grant_id |= static_cast<std::uint64_t>(id.at(i)) << (8U * i);
claims.grant_id = std::max<std::uint64_t>(claims.grant_id, 1);
const auto grant = key.sign(claims);
if (!grant)
return std::nullopt;
return *grant;
}
int keys(const std::filesystem::path& out) {
std::filesystem::create_directories(out);
for (int attempt = 0; attempt < 8; ++attempt) {
@@ -182,42 +179,74 @@ std::optional<SessionInterest> interest_of(std::string_view v) {
return SessionInterest{parts[0], parts[1], parts[2], static_cast<std::uint16_t>(parts[3])};
}
int run(const RunOptions& o) {
const auto scalar = read(o.issuer_key);
const auto key = GrantSigningKey::import(
DeploymentEnvironment::dev, 1,
std::span{reinterpret_cast<const std::uint8_t*>(scalar.data()), scalar.size()});
if (!key) {
// Exclusive create, owner-only on POSIX: a bundle is a credential.
bool write_new(const std::filesystem::path& path, std::span<const std::uint8_t> bytes) {
if (std::filesystem::exists(path))
return false;
if (!write(path, bytes))
return false;
std::filesystem::permissions(
path, std::filesystem::perms::owner_read | std::filesystem::perms::owner_write,
std::filesystem::perm_options::replace);
return true;
}
int grants(const RunOptions& o, const std::string& out, std::uint64_t count) {
const auto key = issuer(o.issuer_key);
if (!key || !o.account) {
std::puts("error issuer-key");
return 2;
}
GrantClaims claims;
std::array<std::uint8_t, 8> id{};
if (!random_bytes(id)) {
std::puts("error random");
claims.account = *o.account;
claims.world = {o.world, o.frame};
claims.region = o.region;
claims.issued_at = now_seconds();
claims.expires_at = claims.issued_at + o.lifetime;
const auto first = o.serial != 0 ? o.serial : claims.issued_at * 64;
std::vector<std::uint8_t> bundle;
for (std::uint64_t i = 0; i < count; ++i) {
claims.serial = first + i;
const auto grant = sign(*key, claims);
if (!grant) {
std::puts("error grant");
return 2;
}
bundle.insert(bundle.end(), grant->begin(), grant->end());
}
if (!write_new(out, bundle)) {
std::puts("error out (exists or unwritable)");
return 1;
}
std::printf("wrote %llu grants serial %llu..%llu valid %llu s\n",
static_cast<unsigned long long>(count), static_cast<unsigned long long>(first),
static_cast<unsigned long long>(first + count - 1),
static_cast<unsigned long long>(o.lifetime));
return 0;
}
int run(const RunOptions& o) {
const auto key = issuer(o.issuer_key);
if (!key) {
std::puts("error issuer-key");
return 2;
}
for (std::size_t i = 0; i < id.size(); ++i)
claims.grant_id |= static_cast<std::uint64_t>(id.at(i)) << (8U * i);
claims.grant_id = std::max<std::uint64_t>(claims.grant_id, 1);
if (!o.account)
return 2; // Required at parse time.
GrantClaims claims;
claims.account = *o.account;
claims.serial = o.serial;
claims.world = {o.world, o.frame};
claims.region = o.region;
claims.issued_at =
static_cast<std::uint64_t>(std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
.count());
claims.issued_at = now_seconds();
claims.expires_at = claims.issued_at + o.lifetime;
const auto grant = key->sign(claims);
const auto grant = sign(*key, claims);
if (!grant) {
std::puts("error grant");
return 2;
}
client::RegionSessionClientConfig config;
const auto address = resolve(o.host);
const auto address = quic::resolve_ipv4(o.host);
if (!address) {
std::puts("error resolve");
return 2;
@@ -340,7 +369,12 @@ int main(int argc, char** argv) {
if (args.size() == 3 && args[0] == "keys" && args[1] == "--out")
return keys(std::filesystem::path{std::string{args[2]}});
RunOptions o;
bool ok = !args.empty() && args[0] == "run" && args.size() % 2 == 1;
const bool bundle = !args.empty() && args[0] == "grants";
std::string out;
std::uint64_t count = 1;
if (bundle)
o.lifetime = 300; // The region's default maximum.
bool ok = !args.empty() && (args[0] == "run" || bundle) && args.size() % 2 == 1;
for (std::size_t i = 1; ok && i + 1 < args.size(); i += 2) {
const auto flag = args[i];
const auto value = args[i + 1];
@@ -386,12 +420,22 @@ int main(int argc, char** argv) {
o.snapshots = *n;
else if (flag == "--interest")
ok = (o.interest = interest_of(value)).has_value();
else if (bundle && flag == "--out")
out = value;
else if (bundle && n && flag == "--count" && *n >= 1 && *n <= 64)
count = *n;
else
ok = false;
}
if (!ok || o.host.empty() || o.server_name.empty() || o.ca.empty() || o.issuer_key.empty() ||
!o.account || o.world == 0 || o.frame == 0 || o.region == 0 || o.serial == 0) {
std::fputs("usage: evo-session-probe keys --out DIR | run --connect HOST:PORT "
if (bundle && ok && !o.issuer_key.empty() && o.account && o.world != 0 && o.frame != 0 &&
o.region != 0 && !out.empty() && o.lifetime >= 60 && o.host.empty())
return grants(o, out, count);
if (bundle || !ok || o.host.empty() || o.server_name.empty() || o.ca.empty() ||
o.issuer_key.empty() || !o.account || o.world == 0 || o.frame == 0 || o.region == 0 ||
o.serial == 0) {
std::fputs("usage: evo-session-probe keys --out DIR | grants --issuer-key FILE "
"--world N --frame N --region N --account HEX32 --out FILE [--serial N] "
"[--count 1..64] [--lifetime 60..3600] | run --connect HOST:PORT "
"--server-name NAME --ca FILE --issuer-key FILE --world N --frame N "
"--region N --account HEX32 --serial N [--lifetime S] [--intents N] "
"[--actions N --action-base ID] [--query ID]... [--timeout-ms N] "
+19 -3
View File
@@ -69,13 +69,29 @@ if(EVO_BUILD_CLIENT)
add_executable(evo-client apps/evo-client/main.cpp apps/evo-client/panels.cpp)
target_link_libraries(evo-client PRIVATE evo_client_platform evo_client_ui evo_imgui)
target_compile_definitions(evo-client PRIVATE EVO_BUILD_IDENTITY="${EVO_BUILD_IDENTITY}")
if(EVO_BUILD_NETWORK)
# M9.7 remote dev session mode (ADR-0083).
target_link_libraries(evo-client PRIVATE evo_network_session)
if(EVO_BUILD_QUIC)
# M10.5c remote dev session mode over M10 QUIC sessions (ADR-0093); replaces the M9.7
# TCP session (ADR-0083), whose dev route is gone (ADR-0087).
target_link_libraries(evo-client PRIVATE evo_session_client)
target_compile_definitions(evo-client PRIVATE EVO_CLIENT_NETWORK=1)
endif()
evo_owned_target(evo-client)
evo_client_runtime(evo-client)
if(EVO_BUILD_QUIC)
evo_msquic_runtime(evo-client)
if(BUILD_TESTING)
# The client's remote session (apps/evo-client/remote_session.hpp) against a loopback
# region: snapshots, camera interest, intentions, reconnects, refusals (M10.5c).
add_executable(evo-client-remote-tests tests/client_remote_session.cpp)
target_include_directories(evo-client-remote-tests PRIVATE "${PROJECT_SOURCE_DIR}/apps/evo-client")
target_compile_definitions(evo-client-remote-tests PRIVATE EVO_CLIENT_NETWORK=1)
target_link_libraries(evo-client-remote-tests PRIVATE evo_client_ui evo_session_client evo_session_server)
evo_owned_target(evo-client-remote-tests)
evo_msquic_runtime(evo-client-remote-tests)
add_test(NAME client-remote-session COMMAND evo-client-remote-tests)
set_tests_properties(client-remote-session PROPERTIES TIMEOUT 120 LABELS "client;quic-session")
endif()
endif()
if(BUILD_TESTING)
add_executable(evo-client-lifecycle-tests tests/client_lifecycle.cpp tests/client_controls.cpp)
target_include_directories(evo-client-lifecycle-tests PRIVATE "${PROJECT_SOURCE_DIR}/src")
+5 -2
View File
@@ -1,6 +1,8 @@
# M10.2 QUIC transport (ADR-0090): pinned msquic 2.6.2 with its OpenSSL TLS provider
# (OpenSSL 3.5.9 LTS, TLS 1.3 only, built static inside the msquic shared library).
# Explicit preparation only: cmake -P tools/prepare-msquic.cmake. Windows builds need a
# Explicit preparation only: cmake -P tools/prepare-msquic.cmake. On Windows msquic.dll
# links the whole C runtime statically (M10.5c): the client package ships it and allows
# no runtime DLL imports (ADR-0086), including the UCRT forwarders. Windows builds need a
# native Perl (Strawberry Perl) and NASM for OpenSSL, plus nmake from the MSVC shell.
include_guard(GLOBAL)
include("${PROJECT_SOURCE_DIR}/tools/msquic-pin.cmake")
@@ -22,7 +24,8 @@ endif()
enable_language(C)
foreach(setting IN ITEMS "QUIC_TLS_LIB=openssl" "QUIC_BUILD_SHARED=ON" "QUIC_BUILD_TEST=OFF"
"QUIC_BUILD_TOOLS=OFF" "QUIC_BUILD_PERF=OFF" "QUIC_ENABLE_LOGGING=OFF" "QUIC_EMBED_GIT_HASH=OFF"
"QUIC_SOURCE_LINK=OFF" "QUIC_USE_EXTERNAL_OPENSSL=OFF" "QUIC_CODE_CHECK=OFF")
"QUIC_SOURCE_LINK=OFF" "QUIC_USE_EXTERNAL_OPENSSL=OFF" "QUIC_CODE_CHECK=OFF"
"QUIC_STATIC_LINK_CRT=ON" "QUIC_STATIC_LINK_PARTIAL_CRT=OFF")
string(REPLACE "=" ";" pair "${setting}")
list(GET pair 0 name)
list(GET pair 1 value)
+4 -4
View File
@@ -524,10 +524,10 @@ session control done; 10.3b QUIC session login (schemas/network/session-v1.md) d
10.3c durable per-world account control (schema v10) done. 10.4 split (ADR-0092):
10.4a intention/action protocol and admission done; 10.4b durable action records
(schema v11, same transaction as the checkpoint) done; 10.4c evo-server QUIC listener and
headless client with process kill tests done. The engineering GUI client still uses the
M9 dev path. 10.5 split (ADR-0093): 10.5a session protocol v2 and the replication core
done; 10.5b wiring (sessions, evo-server, client, probe) with process evidence done; 10.5c
the GUI client switch follows.
headless client with process kill tests done. 10.5 split (ADR-0093): 10.5a session
protocol v2 and the replication core done; 10.5b wiring (sessions, evo-server, client,
probe) with process evidence done; 10.5c engineering client switched to M10 sessions
(snapshot views, camera interest, grant bundles, msquic.dll in the Windows package) done.
10.6-10.9 planned.
**Entry:** M9 client/session evidence and M7/M8 dev/stage durability. Read
+6 -3
View File
@@ -35,8 +35,7 @@ from the durable record after crashes before or after a commit, unknown publicat
cross-region moves. M10.4c adds the opt-in
evo-server QUIC listener (session control and action records under the host's lease) and
the headless `evo-session-probe`, with real-process tests including SIGKILL before and after
an action's commit. M10.4 is complete; the GUI client still uses the M9 dev path. Next:
M10.5 bounded snapshots and spatial interest.
an action's commit. M10.4 is complete. Next: M10.5 bounded snapshots and spatial interest.
Deployment (2026-10-05): the maintainer deployed the M10 QUIC listener to evolution-dev
behind the ADR-0087 route; session protocol v1 is therefore frozen. The route admitted
only TCP 7400 while QUIC is UDP, so it is changed to UDP 7400 (ADR-0087 amendment). The
@@ -48,7 +47,11 @@ entity deltas against the acknowledged baseline, nearest first within 16 KiB per
a slower distant tier, datagram chunks and client assembly. M10.5b wires it end to end:
evo-server replicates the region's environment for each session's interest (default: the
first habitat site), the client assembles and acknowledges snapshots, and the probe prints
them. Next: the GUI client switch (10.5c).
them. M10.5c switches the engineering client to M10 sessions: snapshot-fed views, the camera
driving the interest after the user moves it, grant bundles (`evo-session-probe grants`,
evo-server `--m10-max-grant-lifetime` for dev), and `msquic.dll` in the Windows package.
M10.5 is complete. Deploying the v2 server to evolution-dev (the dev server still runs v1)
is a maintainer step. Next: M10.6 movement prediction and reconciliation.
## Previous gate - 2026-10-02
+2
View File
@@ -1,6 +1,8 @@
# ADR-0083: Dev region sessions, no-effect intentions and the session drill
## Status
The engineering client's remote mode moved to M10 sessions in M10.5c (ADR-0093); this
ADR's server path and `evo-dev-session` remain for their own tests.
Listener/Service rule narrowly superseded for evolution-dev by ADR-0087 (dev session
route), effective only when that route is enabled; until then this ADR applies as is.
Accepted for M9.7 (engineering client to one authoritative **dev** region). Decisions
+13
View File
@@ -51,3 +51,16 @@ Static runtime: each image has its own CRT state; SDL's C API passes no CRT obje
across the DLL boundary. Package and verification scripts change with the file
list. Clean-machine/VM runs and minimum hardware remain M9.8g qualification.
The notice inventory is an engineering record, not a legal review.
## Amendment (M10.5c, 2026-10-06): msquic.dll
- The package adds `msquic.dll` (msquic 2.6.2, MIT, with OpenSSL 3.5.9 built static inside,
Apache-2.0; pins and sources as in ADR-0090) and `LICENSES/msquic.txt` and
`LICENSES/OpenSSL.txt`, copied from the verified sources. BUILD-INFO lists both pins.
- msquic links the whole C runtime statically (`QUIC_STATIC_LINK_PARTIAL_CRT=OFF`; its
default imported the UCRT forwarders). Allowed imports add `msquic.dll` and the system
DLLs it needs: `crypt32`, `iphlpapi`, `ncrypt`, `ntdll`. All three images are checked.
- Determinism: OpenSSL is built by msquic with nmake, outside CMake's `/Brepro`; the package
script sets `CL=/Brepro` (cl.exe reads options from it) and `SOURCE_DATE_EPOCH` (the
commit time, used by OpenSSL's build-date string) for the build.
- The package CTest run adds the label `quic-session` (QUIC session and client remote
session tests).
@@ -133,3 +133,18 @@ only through `claim_account_control`, `renew_account_control` and
by a later migration when organisms arrive, under the same row and fencing.
- Not yet wired into evo-server or the engineering client (both keep the M9 dev path);
that integration comes with 10.4, so nothing deploys M10 sessions yet.
## Amendment (M10.5c, 2026-10-06): grant bundles and a dev grant lifetime
- **Bundles.** `evo-session-probe grants` signs 1-64 grants for one account in one file
(concatenated 160-byte grants, created new, owner-only), all issued now with consecutive
serials. Without `--serial` the first serial is 64 x the issue time in seconds, so a later
bundle for the account supersedes an earlier one without bookkeeping. The issuer key stays
with the operator; testers receive only the bundle and the dev CA. Grants cannot be dated
ahead (clock skew 30 s), so a bundle expires as a whole.
- **Lifetime.** The 300 s maximum would make a bundle unusable after five minutes. The
evo-server flag `--m10-max-grant-lifetime 60..3600` raises the region's maximum, refused
at startup outside `dev`; without it the 300 s default stands. A session ends when its
grant expires; the client then reconnects with the next grant of the bundle, which
succeeds only while that grant is still valid.
- Not changed: World0/stage issuance (no production identity provider yet), refresh within
a session, durable serial rules.
@@ -81,3 +81,32 @@ are ignored; malformed records, a slice mismatch or disagreeing chunk headers ar
- Evidence: the test region's default interest holds one habitat site, so the process test
shows a one-cell view refreshed every tick (40 chunks, 8,888 bytes in 40 ticks); the
225-cell and 32-session figures come from synthetic sources.
## M10.5c engineering client switch (2026-10-06)
- **Remote mode is M10 only.** `evo-client` builds its remote mode with `EVO_BUILD_QUIC`
(presets `client-network` and `client-package` now enable it) over `RegionSessionClient`;
the M9.7 TCP session path is no longer used by the GUI (`evo-dev-session` and the M9
server path keep their own tests). The launcher reads 160-byte M10 grants and defaults to
the dev route `void.aeternalisgames.com:7400` (ADR-0087); the endpoint is looked up once
(IPv4) when Connect is pressed.
- **One connection per grant.** A lost or closed session reconnects with the bundle's next
grant after a pause that grows from 2 s to 30 s and resets on Welcome (inside the
per-account attempt limit). Shutdown or capacity: retry. Refusals before any Welcome
(scope, signature, stale or expired grant) fail the launcher; `superseded` (another client
opened a session with a newer grant for the account) fails it at once instead of fighting
back; no grant left fails it as exhausted. A new epoch resets the views.
- **Views.** The newest applied snapshot feeds the environment and organism layers; a lost
session marks them stale. The camera follows the server's default view (re-centred on
its square while it fills in, nearest cells first) until the user pans or zooms; from then
on the camera centre's voxel, radius 7, in the snapshot's slice is the interest, sent at
most every 250 ms and again after each reconnect.
- **Intentions.** Sent as datagrams for server tick + 2 when the movement vector changes,
at most once per server tick. The Session panel's record shows sent, admitted, rejected,
**simulated** (the watermark covered it: final, never durable, ADR-0092) and unknown
(the session ended first). Entries are numbered by the client, since session sequences
restart with each session. The panel also shows the simulated watermark, the snapshot
(tick, cells, organisms), the interest and snapshot bytes.
- Evidence: `client-remote-session` drives `apps/evo-client/remote_session.hpp` against a
loopback region (launcher flow, 225-cell default view, following and the camera interest,
admitted then simulated intentions, epoch change with unknown outcomes and reconnect with
the next grant, superseded, wrong region, exhausted bundle, unresolvable endpoint).
+7 -6
View File
@@ -8,21 +8,22 @@ Contract: [client architecture](../architecture/CLIENT_ARCHITECTURE.md), ADR-007
Camera/input: [contracts and limits](CAMERA_INPUT.md), ADR-0079.
Environment: [presentation and encodings](ENVIRONMENT_RENDERING.md), ADR-0080.
Organisms/inspector: [encodings and budget](ORGANISM_RENDERING.md), ADR-0081.
Remote dev region: [operations](../networking/DEV_SESSION_OPERATIONS.md), ADR-0083.
Remote dev region: [M10 client sessions](../networking/M10_CLIENT_SESSIONS.md), ADR-0093
(the M9.7 path, ADR-0083, is no longer used by the client).
Engineering panels and launcher: [UI state](CLIENT_UI_STATE.md), ADR-0084.
Without arguments a launcher opens. **Local fixture** is labelled as an in-memory
stand-in, never as a server or ecosystem. **Connect** (preset `client-network`)
reads the endpoint, server name, dev CA file and grant bundle file when pressed;
stand-in, never as a server or ecosystem. **Connect** (preset `client-network`, with QUIC)
reads the endpoint, server name, dev CA file and M10 grant bundle file when pressed;
nothing is saved and no path, certificate or grant byte is shown or logged. Errors
use fixed wording. A connection with no Welcome after three failed attempts
(refused, TLS failure or timeout) or a refused grant fails with Retry/Cancel.
`--fixture` or `--connect HOST:PORT --server-name NAME --ca FILE --grants FILE`
skip the launcher (an unreadable file then exits 1). While running, a banner names
the mode (LOCAL FIXTURE or DEV REGION with its phase); Disconnect asks for
confirmation. The Session panel shows session/epoch, server tick, durable
watermark, grants left and the last ten intentions with their outcome (sent,
admitted, rejected, durable, not committed, unknown). That list is the record;
confirmation. The Session panel shows session/epoch, server tick, simulated
watermark, grants left, the snapshot, interest and snapshot bytes, and the last ten
intentions with their outcome (sent, admitted, rejected, simulated, unknown; M10.5c). That list is the record;
short notifications expire and can be dismissed.
## Build and run
+9 -7
View File
@@ -1,9 +1,10 @@
# Windows client package (M9.8e)
Decision: [ADR-0086](../adr/0086-windows-client-package.md). Windows development host
only; requires Visual Studio 2022 C++ tools and prepared SDL, Dear ImGui and Mbed TLS
sources (`cmake -P tools/prepare-sdl3.cmake`, `prepare-imgui.cmake`,
`prepare-mbedtls.cmake`).
only; requires Visual Studio 2022 C++ tools and prepared SDL, Dear ImGui, Mbed TLS and
msquic sources (`cmake -P tools/prepare-sdl3.cmake`, `prepare-imgui.cmake`,
`prepare-mbedtls.cmake`, `prepare-msquic.cmake`), plus Strawberry Perl and NASM for
msquic's OpenSSL build (ADR-0090).
## Build a package
@@ -13,15 +14,15 @@ powershell -NoProfile -ExecutionPolicy Bypass -File tools\client\package-windows
It refuses uncommitted tracked changes (`-AllowDirty` packages them with a `-dirty`
identity), configures `client-package` with `EVO_BUILD_IDENTITY=g<12 hex>`, builds,
runs the client/network CTest suite, stages the allowlisted files and writes
runs the client/network/quic-session CTest suite, stages the allowlisted files and writes
`build/packages/evo-client-windows-x64-<identity>.zip` and `.zip.sha256`. The staged
folder stays next to the ZIP. `-Clean` deletes `build/client-package` first; the
build log is `build/client-package.log` (+ `.err`).
Package content (exact): `evo-client.exe`, `SDL3.dll`, `README.txt`,
Package content (exact): `evo-client.exe`, `SDL3.dll`, `msquic.dll`, `README.txt`,
`BUILD-INFO.txt`, `THIRD-PARTY-NOTICES.txt`, `SHA256SUMS.txt` and `LICENSES/`
(SDL3, its HIDAPI, yuv2rgb, stb_image and Khronos notices, Apache-2.0, Mbed TLS,
Dear ImGui with fonts and stb notices). The tester README template is
Dear ImGui with fonts and stb notices, msquic, OpenSSL). The tester README template is
`tools/client/README-package.txt`; the notice index is
`tools/client/THIRD-PARTY-NOTICES.txt`. No credentials, grant bundles, CA files or
settings are ever packaged; dev CA and grants are issued to testers separately.
@@ -34,7 +35,8 @@ powershell -NoProfile -ExecutionPolicy Bypass -File tools\client\package-selftes
```
Verification works without Visual Studio (copy `tools/client` with the ZIP): digest,
exact content and SHA256SUMS, PE imports limited to system DLLs plus `SDL3.dll`,
exact content and SHA256SUMS, PE imports of all three images limited to system DLLs plus
`SDL3.dll` and `msquic.dll` (no C runtime DLLs),
credential and profile-path scan, then the extracted client runs with only the
Windows system directories on PATH. `-Interactive` opens a real window for 3 s.
The self-test proves each guard refuses its defect.
+73
View File
@@ -4406,3 +4406,76 @@ tests; clang-tidy 19 on sessions, client, replication, bridge, probe and tests;
checked). The repository format check fails only on `include/evo/server/session_window.hpp`
(already on main, not part of this change).
Not done: the GUI client (10.5c); deployment of v2 (the dev server still runs v1).
## 2026-10-06 — M10.5c engineering client on M10 sessions (ADR-0093, ADR-0091, ADR-0086)
Implemented the client's remote mode over `RegionSessionClient`
(`apps/evo-client/remote_session.hpp`):
- snapshot-fed views;
- the camera follows the default view, then drives the interest;
- intention record states, including `simulated`;
- reconnect with the bundle's next grant, with a growing pause.
Supporting changes:
- the launcher reads 160-byte grants, takes `authority_path`, and defaults to the dev route;
- `quic::resolve_ipv4`;
- `evo-session-probe grants`;
- evo-server `--m10-max-grant-lifetime` (dev only);
- presets `client-network` and `client-package` with QUIC;
- msquic with a fully static CRT;
- `msquic.dll` and the msquic and OpenSSL licences in the Windows package;
- `CL=/Brepro` and `SOURCE_DATE_EPOCH` for the package's OpenSSL build.
New test `client-remote-session` (labels client and quic-session) runs against a loopback
region:
- launcher flow and the 225-cell default view;
- following, then the camera interest (144 cells clipped);
- admitted then simulated intentions;
- an epoch change: unknown outcomes, stale views, reconnect with the next grant and the
views restored;
- client-side numbering across sessions;
- superseded, wrong region, an exhausted bundle, and an unresolvable endpoint.
The process test now runs evo-server with `--m10-max-grant-lifetime 900` and the probe with
a 900 s grant.
Found during development:
- test cells requesting water without moisture (the client refused the snapshot and closed);
- a budget-cut first snapshot skewed a one-time recentre, so the camera now follows until
the user moves it;
- session sequences collided in the outcome record, so the record now numbers entries
itself;
- msquic's default partial-static CRT imported the UCRT forwarders;
- a clang-tidy optional-access finding.
Executed:
- **Linux GCC 14**
- preset `client-network` (with QUIC): CTest 14/14; `client-remote-session` passed 5 times
in a row;
- preset `quic`: 4/4;
- `postgres-check.sh` with EVO_BUILD_QUIC: 20 suites, including the region m10 session
integration.
- **Linux Clang 19:** clang-tidy 19 on the client app, remote test, host lookup, probe,
launcher and UI-model test; clang-format 19 on the changed files.
- **Windows MSVC 19.44** (binaries rebuilt, timestamps checked):
- preset `client-network`: 12/12;
- preset `quic`: 4/4.
- **Windows package:**
- `package-windows.ps1`: client-package CTest 12/12;
- `verify-windows-package.ps1` passed;
- `package-selftest.ps1`: 10 refusals, including the missing `msquic.dll` and the
dynamic-runtime image;
- `msquic.dll` imports only advapi32, bcrypt, crypt32, iphlpapi, kernel32, ncrypt, ntdll,
user32, winmm and ws2_32;
- two `-Clean` builds gave identical ZIPs (sha256 `aaabc228…312cb2`, identity
`g33e91458e7ee-dirty`), the same as the earlier incremental build.
- `evo-session-probe grants`, checked by hand:
- 8 grants, 1280 bytes, mode 0600;
- refuses an existing file, a lifetime under 60 s, a count over 64 and connect flags;
- `--serial` respected.
Not done:
- a GUI run against evolution-dev (the dev server still runs session v1 and the flag is
not in the dev manifest);
- ASan of the client remote test (msquic under sanitizers is still open);
- a clean-VM package run.
+39
View File
@@ -0,0 +1,39 @@
# Engineering client over M10 sessions (M10.5c)
Decisions: ADR-0091 (grants, bundles, grant lifetime), ADR-0092 (intentions), ADR-0093
(snapshots, interest, client behaviour), ADR-0087 (dev route). **evolution-dev only.**
## Operator: issue a grant bundle
On a machine that holds the dev issuer key (never give the key to testers):
```sh
evo-session-probe grants --issuer-key issuer.key --world 100 --frame 9 --region 1 \
--account <32 hex digits, one per tester> --count 16 --lifetime 3600 --out tester.grants
```
The file is created new and owner-only; it holds 16 single-use grants, valid together for
the lifetime. A lifetime above 300 s needs the region to run with
`--m10-max-grant-lifetime` at least that long (dev only); otherwise every grant is refused.
Issue a new bundle (same account; newer serials are automatic) when one runs out or
expires. Give the tester the bundle and the public dev CA (`dev-ca.pem`).
## Tester: connect
Run `evo-client`, choose **Connect to a dev region** and fill in the endpoint (default
`void.aeternalisgames.com:7400`, UDP; reachable only from 172.10.1.0/24), the server name
on the dev certificate, `dev-ca.pem` and the bundle. Or:
```sh
evo-client --connect void.aeternalisgames.com:7400 --server-name NAME --ca dev-ca.pem \
--grants tester.grants
```
- The view follows the region's default view until you pan or zoom; then the 15 x 15
cells around the camera centre are replicated (radius 7).
- W A S D send movement intentions; the Session panel lists each as sent, admitted,
rejected, simulated (final; intentions are never durable) or unknown.
- Each reconnect uses the next grant. A second client with a bundle for the same account
takes the session over; the first stops (do not share bundles).
- A server still on session protocol v1 refuses the client (`unsupported_version`):
deploy the v2 server first.
+7 -4
View File
@@ -9,11 +9,13 @@
// M9.8c launcher model (toolkit- and network-independent). Validates what the user
// typed, loads the two credential files within bounds, and tracks the connect flow.
// M10.5c (ADR-0093): grant records are M10 session grants (network::session_grant_bytes),
// issued by `evo-session-probe grants`; the default endpoint is the dev route (ADR-0087).
// Error texts are fixed: they never contain file contents, grant bytes or keys, and
// nothing here is persisted or logged.
namespace evo::client {
inline constexpr std::size_t grant_record_bytes = 108; // network::dev_grant_bytes.
inline constexpr std::size_t max_grant_records = 64; // As issued by evo-dev-session.
inline constexpr std::size_t grant_record_bytes = 160; // network::session_grant_bytes.
inline constexpr std::size_t max_grant_records = 64; // As issued by the probe.
inline constexpr std::size_t max_authority_bytes = 65536; // One small PEM CA.
inline constexpr std::size_t max_field_bytes = 1024; // Every text field.
using GrantRecord = std::array<std::uint8_t, grant_record_bytes>;
@@ -35,7 +37,7 @@ enum class LaunchError : std::uint8_t {
[[nodiscard]] std::string_view launch_error_text(LaunchError error) noexcept;
struct ConnectForm {
std::string endpoint{"127.0.0.1:17400"}, server_name{"dev-region.evolution.test"};
std::string endpoint{"void.aeternalisgames.com:7400"}, server_name{"dev-region.evolution.test"};
std::string authority_path, grants_path;
};
struct Endpoint {
@@ -45,6 +47,7 @@ struct Endpoint {
struct ConnectMaterial {
Endpoint endpoint;
std::string server_name, authority_pem;
std::string authority_path; // The same CA as a file (the QUIC stack loads it too).
std::vector<GrantRecord> grants;
};
// "host:port", "[ipv6]:port" or "a.b.c.d:port"; plain DNS host names only.
@@ -56,7 +59,7 @@ enum class ConnectSignal : std::uint8_t {
welcome, // A session was opened.
lost, // Transport/TLS failure or deadline before a Close.
refused, // Closed as unauthenticated/expired/duplicate: this grant cannot work.
not_ready, // Closed as server_shutdown/capacity: the server will retry later.
not_ready, // Closed as shutdown/capacity: the session retries later with the next grant.
exhausted // No unused grant remains.
};
enum class LaunchPhase : std::uint8_t { choosing, fixture, connecting, connected, failed };
+5 -3
View File
@@ -9,17 +9,19 @@
namespace evo::client {
enum class OutcomeState : std::uint8_t {
sent, // Queued to the server; no reply yet.
admitted, // Accepted for scheduling; not yet durable.
admitted, // Accepted for scheduling; not yet simulated or durable.
rejected, // IntentResult other than admitted (final).
durable, // Committed with no biological effect (final).
not_committed, // The carrying input was dropped (final).
unknown // The connection ended first; the outcome is not known (final).
unknown, // The connection ended first; the outcome is not known (final).
simulated // M10 realtime intention: the region simulated its tick (final; never
// durable, ADR-0092).
};
struct OutcomeEntry {
std::uint64_t sequence{};
OutcomeState state{};
std::uint8_t detail{}; // IntentStatus code for rejections.
std::uint64_t tick{}, commit_sequence{}; // For durable outcomes.
std::uint64_t tick{}, commit_sequence{}; // Intended/simulated tick; commit when durable.
};
class OutcomeLog {
public:
+4
View File
@@ -23,6 +23,7 @@
#include <cstdint>
#include <expected>
#include <memory>
#include <optional>
#include <span>
#include <string>
#include <vector>
@@ -139,4 +140,7 @@ class MessageReassembler {
std::vector<std::uint8_t> buffer_;
};
[[nodiscard]] std::vector<std::uint8_t> frame_message(std::span<const std::uint8_t> payload);
// The endpoint takes a numeric address (the pinned server name is checked separately):
// looks a host name up once, IPv4 only, blocking. A numeric address comes back unchanged.
[[nodiscard]] std::optional<std::string> resolve_ipv4(const std::string& host);
} // namespace evo::network::quic
+3 -3
View File
@@ -46,7 +46,7 @@ std::string_view launch_error_text(LaunchError error) noexcept {
case LaunchError::authority_path:
return "Choose the dev CA certificate file (dev-ca.pem).";
case LaunchError::grants_path:
return "Choose a grant bundle file issued by evo-dev-session grants.";
return "Choose a grant bundle file issued by evo-session-probe grants.";
case LaunchError::authority_unreadable:
return "The dev CA file could not be read.";
case LaunchError::authority_invalid:
@@ -116,7 +116,7 @@ std::expected<ConnectMaterial, LaunchError> load_connect(const ConnectForm& form
return std::unexpected(bundle.error());
if (bundle->size() % grant_record_bytes != 0)
return std::unexpected(LaunchError::grants_invalid);
ConnectMaterial material{*endpoint, form.server_name, std::move(pem), {}};
ConnectMaterial material{*endpoint, form.server_name, std::move(pem), form.authority_path, {}};
for (std::size_t at = 0; at < bundle->size(); at += grant_record_bytes) {
GrantRecord grant{};
std::copy_n(bundle->begin() + static_cast<std::ptrdiff_t>(at), grant.size(), grant.begin());
@@ -167,7 +167,7 @@ void Launcher::observe(ConnectSignal signal) noexcept {
phase_ = LaunchPhase::connecting;
return;
case ConnectSignal::not_ready:
return; // The session retries with the same grant.
return; // The session retries after a pause.
case ConnectSignal::exhausted:
fail(LaunchError::grants_exhausted);
return;
+47
View File
@@ -0,0 +1,47 @@
// M10.5c host name lookup for QUIC clients (ADR-0093). Kept apart from the msquic
// endpoint so the platform socket headers never meet msquic's own Windows includes.
#ifdef _WIN32
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <winsock2.h>
// After <winsock2.h>.
#include <ws2tcpip.h>
#else
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#endif
#include "evo/network/quic_transport.hpp"
namespace evo::network::quic {
std::optional<std::string> resolve_ipv4(const std::string& host) {
#ifdef _WIN32
static const bool started = [] {
WSADATA data{};
return WSAStartup(MAKEWORD(2, 2), &data) == 0; // Process lifetime; never cleaned up.
}();
if (!started)
return std::nullopt;
#endif
if (host.empty())
return std::nullopt;
addrinfo hints{};
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_DGRAM;
addrinfo* found = nullptr;
if (getaddrinfo(host.c_str(), nullptr, &hints, &found) != 0 || found == nullptr)
return std::nullopt;
char text[INET_ADDRSTRLEN] = {};
const auto* address = reinterpret_cast<const sockaddr_in*>(found->ai_addr);
const bool ok = inet_ntop(AF_INET, &address->sin_addr, text, sizeof text) != nullptr;
freeaddrinfo(found);
if (!ok)
return std::nullopt;
return std::string{text};
}
} // namespace evo::network::quic
+288
View File
@@ -0,0 +1,288 @@
// M10.5c: the engineering client's remote session (apps/evo-client/remote_session.hpp)
// against a loopback region (ADR-0093): the launcher's connect flow, snapshot-fed views,
// the camera recentre and interest, intention outcomes (simulated, unknown), reconnects
// with the next grant of the bundle, and refusals (scope, superseded, exhausted).
#include "evo/client/session_host.hpp"
#include "evo/network/dev_credentials.hpp"
#include "evo/network/session_grant.hpp"
#include "evo/server/region_sessions.hpp"
#include "remote_session.hpp"
#include <algorithm>
#include <chrono>
#include <cstdio>
#include <filesystem>
#include <fstream>
#include <functional>
#include <source_location>
#include <stdexcept>
#include <string>
#include <thread>
#include <vector>
namespace {
using namespace evo;
using namespace evo::network;
using client::LaunchError;
using client::LaunchPhase;
using client::OutcomeState;
using client_app::RemoteSession;
using Clock = std::chrono::steady_clock;
void check(bool ok, std::source_location at = std::source_location::current()) {
if (!ok)
throw std::runtime_error("client remote session line " + std::to_string(at.line()));
}
#define CHECK(...) check(static_cast<bool>(__VA_ARGS__))
constexpr std::string_view name = "dev-region.evolution.test";
constexpr world::WorldIdentity world_id{7, 3};
constexpr std::uint64_t region = 12;
constexpr std::uint64_t start = 1'800'000'000;
struct Files {
std::filesystem::path dir, ca, certificate, key;
std::string ca_pem;
};
Files credentials() {
const auto made = generate_dev_credentials(DeploymentEnvironment::dev, name, 1,
std::chrono::system_clock::now());
CHECK(made.has_value());
Files f;
f.dir = std::filesystem::temp_directory_path() / "evo-client-remote-session";
std::filesystem::remove_all(f.dir);
std::filesystem::create_directories(f.dir);
f.ca_pem = made->authority_pem;
f.ca = f.dir / "ca.pem";
f.certificate = f.dir / "server.pem";
f.key = f.dir / "server.key";
for (const auto& [path, text] : {std::pair{f.ca, made->authority_pem},
std::pair{f.certificate, made->server_certificate_pem},
std::pair{f.key, made->server_key_pem}}) {
std::ofstream out{path, std::ios::binary | std::ios::trunc};
out << text;
CHECK(out.good());
}
return f;
}
AccountId account(std::uint8_t tag) {
AccountId a;
a.bytes.fill(tag);
return a;
}
std::array<std::uint8_t, grant_private_key_bytes> scalar() {
std::array<std::uint8_t, grant_private_key_bytes> s{};
s.back() = 0x2B;
return s;
}
client::EnvironmentCell cell(std::int64_t x, std::int64_t y, std::uint64_t quantity) {
client::EnvironmentCell c;
c.voxel = {x, y, -7};
c.chunk_revision = 40;
c.habitat = {{100}, {200}, {0}, {1000}, {500}, {10}};
c.volume = {1000ULL * 500 * 10};
c.substrate = {1};
c.terrain_material = {2};
c.terrain_fill = 1000;
c.presence[0] = client::FieldPresence::present;
c.quantity[0] = quantity;
c.presence[1] = client::FieldPresence::missing;
c.presence[7] = client::FieldPresence::present;
c.quantity[7] = 5;
c.moisture_status = world::MoistureStatus::available; // Water is requested.
c.moisture = {3, 50};
return c;
}
// A region on loopback with a 21 x 21 slice (x, y in -10..10 at z -7), one snapshot per tick.
struct Region {
explicit Region(const Files& f) : files{f} {
server::RegionSessionsConfig c;
c.transport.certificate_pem_file = f.certificate.string();
c.transport.key_pem_file = f.key.string();
c.control.environment = DeploymentEnvironment::dev;
c.control.world = world_id;
c.control.region = region;
c.control.epoch = epoch;
c.control.max_account_attempts = 16;
c.issuer_keys.push_back({1, *key.public_key()});
auto made = server::RegionSessions::create(std::move(c));
CHECK(made.has_value());
sessions = std::move(*made);
sessions->set_default_interest({3, 3, -7, 7});
}
WireGrant grant(const AccountId& who, std::uint64_t serial,
std::uint64_t in_region = region) const {
GrantClaims c;
c.grant_id = 900 + serial;
c.account = who;
c.serial = serial;
c.world = world_id;
c.region = in_region;
c.issued_at = start;
c.expires_at = start + 120;
const auto g = key.sign(c);
CHECK(g.has_value());
return *g;
}
// The launcher's material: the endpoint by host name, as a tester types it.
client::ConnectMaterial material(std::vector<WireGrant> grants) const {
return {{"localhost", sessions->port()},
std::string{name},
files.ca_pem,
files.ca.string(),
std::move(grants)};
}
void pump() {
sessions->poll({true, epoch, tick}, start + 1, Clock::now());
if (tick != replicated) {
replicated = tick;
sessions->replicate(tick, [&](const SessionInterest&) {
ReplicationSource s;
s.identity = world_id;
s.field_revision = tick;
s.mask = (1U << 0) | (1U << 1) | (1U << 7);
for (std::int64_t x = -10; x <= 10; ++x)
for (std::int64_t y = -10; y <= 10; ++y)
s.environment.push_back(cell(x, y, 30));
return s;
});
}
static_cast<void>(sessions->take_events());
}
const Files& files;
GrantSigningKey key = *GrantSigningKey::import(DeploymentEnvironment::dev, 1, scalar());
std::unique_ptr<server::RegionSessions> sessions;
std::uint64_t epoch{3}, tick{100}, replicated{};
};
struct Client {
client::SessionHost<RemoteSession> host;
client::UiState ui;
client::Intention intention;
// Steps the region and the client together (one region tick every `tick_every`
// iterations, 0: none) until `done` or the limit.
bool until(Region& r, const std::function<bool()>& done, int tick_every = 0,
std::chrono::milliseconds limit = std::chrono::milliseconds{15000}) {
const auto end = Clock::now() + limit;
for (int i = 1; Clock::now() < end; ++i) {
r.pump();
if (tick_every != 0 && i % tick_every == 0)
++r.tick;
host.step(Clock::now(), intention, ui);
if (done())
return true;
std::this_thread::sleep_for(std::chrono::milliseconds{1});
}
return done();
}
[[nodiscard]] LaunchPhase phase() const {
return host.launcher().phase();
}
[[nodiscard]] std::size_t cells() const {
const auto* s = host.session();
const auto* e = s ? s->environment().current() : nullptr;
return e ? e->cells().size() : 0;
}
[[nodiscard]] bool has(OutcomeState state) const {
const auto* s = host.session();
return s && std::ranges::any_of(s->outcomes().entries(),
[&](const auto& e) { return e.state == state; });
}
};
void views_interest_and_intentions(Region& r) {
Client c;
CHECK(c.host.connect(
RemoteSession::open(r.material({r.grant(account(1), 1), r.grant(account(1), 2)}))));
CHECK(c.until(r, [&] { return c.phase() == LaunchPhase::connected; }));
// The default interest (3, 3, radius 7) arrives as the copied view.
CHECK(c.until(r, [&] { return c.cells() == 225; }, 20));
auto& s = *c.host.session();
const auto* view = s.environment().current();
CHECK(view != nullptr && view->slice_z() == -7 &&
std::ranges::all_of(view->cells(), [](const auto& e) {
return e.voxel.x >= -4 && e.voxel.x <= 10 && e.voxel.y >= -4 && e.voxel.y <= 10;
}));
CHECK(s.environment().freshness() == client::Freshness::current);
// The camera follows the view: the middle of its square, offered once per change.
const auto centre = s.take_recentre().value_or(client::WorldPoint{-1, -1});
CHECK(centre.x_mm == 3500 && centre.y_mm == 3500 && !s.take_recentre());
s.focus(centre); // Where the view put it: still following, no interest sent.
static_cast<void>(c.until(r, [] { return false; }, 20, std::chrono::milliseconds{300}));
CHECK(!s.status().focused && c.cells() == 225); // 300 ms of ticks: the same view.
// The user moves the camera: its centre's voxel becomes the interest (clipped).
s.focus({-5500, -5200});
CHECK(c.until(r, [&] { return c.cells() == 144; }, 20)); // x, y in -10..1.
const auto status = s.status();
CHECK(status.focused && status.focus_x == -6 && status.focus_y == -6 && status.focus_z == -7 &&
status.phase == "connected" && status.grants_left == 1 && status.snapshot_bytes > 0);
// An intention: sent once per change, admitted, then simulated (never durable).
c.intention.move_x = 700;
CHECK(c.until(r, [&] { return c.has(OutcomeState::admitted); }));
CHECK(c.until(r, [&] { return c.has(OutcomeState::simulated); }, 20));
const auto& first = s.outcomes().entries().front();
CHECK(first.sequence == 1 && first.tick != 0 && s.status().simulated_tick >= first.tick);
// A new epoch closes the session: the open intention is unknown, the views are stale,
// and the session reconnects with the bundle's next grant after its pause.
const auto old_session = s.status().session;
c.intention.move_x = -700;
CHECK(c.until(r, [&] { return c.has(OutcomeState::admitted) || c.has(OutcomeState::sent); }));
r.epoch = 4;
CHECK(c.until(r, [&] { return c.has(OutcomeState::unknown); }));
CHECK(s.environment().freshness() == client::Freshness::stale);
CHECK(s.outcomes().entries().size() == 2 && s.outcomes().entries()[1].sequence == 2 &&
s.outcomes().entries()[1].state == OutcomeState::unknown);
CHECK(c.until(r, [&] { return s.status().phase == "connected"; }, 20));
CHECK(s.status().epoch == 4 && s.status().session != old_session &&
s.status().grants_left == 0 && c.phase() == LaunchPhase::connected);
// Views restart for the new epoch, at the camera's interest (sent again).
CHECK(c.until(r, [&] { return c.cells() == 144 && s.status().snapshot_tick > 0; }, 20));
// The current intention is sent again in the new session; the record numbers it on
// (session sequences restart) and keeps the earlier entries.
CHECK(c.until(r, [&] { return s.outcomes().entries().size() == 3; }));
CHECK(s.outcomes().entries()[0].state == OutcomeState::simulated &&
s.outcomes().entries()[2].sequence == 3);
// Another client with a newer grant for the account supersedes this one: no fight back.
Client other;
CHECK(other.host.connect(RemoteSession::open(r.material({r.grant(account(1), 9)}))));
CHECK(other.until(r, [&] {
c.host.step(Clock::now(), c.intention, c.ui);
return c.phase() == LaunchPhase::failed && other.phase() == LaunchPhase::connected;
}));
CHECK(c.host.launcher().error() == LaunchError::grant_refused && !c.host.session());
}
void refusals(Region& r) {
// A grant for another region: refused before any Welcome; the launcher stops.
Client wrong;
CHECK(wrong.host.connect(RemoteSession::open(r.material({r.grant(account(2), 1, 99)}))));
CHECK(wrong.until(r, [&] { return wrong.phase() == LaunchPhase::failed; }));
CHECK(wrong.host.launcher().error() == LaunchError::grant_refused);
// One grant: once its session ends there is nothing to reconnect with.
Client one;
CHECK(one.host.connect(RemoteSession::open(r.material({r.grant(account(3), 1)}))));
CHECK(one.until(r, [&] { return one.phase() == LaunchPhase::connected; }));
r.epoch = 5;
CHECK(one.until(r, [&] { return one.phase() == LaunchPhase::failed; }));
CHECK(one.host.launcher().error() == LaunchError::grants_exhausted);
// Nothing to open: an unresolvable endpoint or an empty bundle.
auto bad = r.material({r.grant(account(4), 1)});
bad.endpoint.host = "no-such-host.invalid";
CHECK(!RemoteSession::open(bad));
CHECK(!RemoteSession::open(r.material({})));
}
} // namespace
int main() try {
const auto files = credentials();
{
Region r{files};
views_interest_and_intentions(r);
refusals(r);
}
std::filesystem::remove_all(files.dir);
std::puts("client remote session tests passed");
return 0;
} catch (const std::exception& e) {
std::fprintf(stderr, "%s\n", e.what());
return 1;
}
+4 -1
View File
@@ -163,7 +163,10 @@ void launcher() {
write("ca.pem", "-----BEGIN CERTIFICATE-----\nMIIB\n-----END CERTIFICATE-----\n");
form.grants_path = write("grants.bin", std::string(grant_record_bytes * 3, '\x01'));
const auto loaded = load_connect(form);
CHECK(loaded && loaded->grants.size() == 3 && loaded->endpoint.port == 17400);
// The default endpoint is the dev route (ADR-0087); records are M10 grants (160 bytes).
CHECK(loaded && loaded->grants.size() == 3 && loaded->endpoint.port == 7400 &&
loaded->endpoint.host == "void.aeternalisgames.com" && grant_record_bytes == 160 &&
loaded->authority_path == form.authority_path);
const auto refused_with = [&](const ConnectForm& f, LaunchError e) {
const auto r = load_connect(f);
return !r && r.error() == e;
+17 -16
View File
@@ -92,22 +92,22 @@ struct Setup {
}
[[nodiscard]] std::vector<std::string> args() const {
return server_args(
region,
{"--synthetic-inputs", "development-v1", "--m10-listen", "127.0.0.1:0", "--m10-cert",
(region.root / "server.pem").string(), "--m10-key",
(region.root / "server.key").string(), "--m10-issuer",
(region.root / "issuer.pub").string(), "--m10-environment", "dev", "--session-window",
"test-" +
std::to_string(static_cast<std::uint64_t>(
std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
.count())) +
":" +
std::to_string(static_cast<std::uint64_t>(
std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
.count()) +
1200)});
region, {"--synthetic-inputs", "development-v1", "--m10-listen", "127.0.0.1:0",
"--m10-cert", (region.root / "server.pem").string(), "--m10-key",
(region.root / "server.key").string(), "--m10-issuer",
(region.root / "issuer.pub").string(), "--m10-environment", "dev",
"--m10-max-grant-lifetime", "900", "--session-window",
"test-" +
std::to_string(static_cast<std::uint64_t>(
std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
.count())) +
":" +
std::to_string(static_cast<std::uint64_t>(
std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
.count()) +
1200)});
}
[[nodiscard]] WireGrant grant(const AccountId& who, std::uint64_t serial) const {
GrantClaims c;
@@ -315,6 +315,7 @@ void end_to_end() {
"--region", "151",
"--account", hex(bob),
"--serial", "1",
"--lifetime", "900", // Over the default 300 s: allowed by the server flag.
"--intents", "3",
"--actions", "2",
"--action-base", "10",
+7 -3
View File
@@ -13,7 +13,7 @@ Requirements
------------
Windows 10 or 11, x64. No installer and no Visual C++ redistributable is needed:
the client uses the static Microsoft C++ runtime and only Windows system DLLs plus
the bundled SDL3.dll. Minimum hardware is not yet qualified.
the bundled SDL3.dll and msquic.dll. Minimum hardware is not yet qualified.
Running
-------
@@ -21,10 +21,14 @@ Extract the whole folder anywhere and run evo-client.exe. A launcher opens:
* Local fixture - an in-memory stand-in for an environment with static organisms.
It is not a server, not an ecosystem and not authoritative.
* Connect to a dev region - needs an endpoint, the server name, the dev CA file
* Connect to a dev region - needs an endpoint (default: the dev route,
void.aeternalisgames.com:7400, UDP), the server name, the dev CA file
(dev-ca.pem) and a grant bundle file. These are issued separately by the
development team and are never part of this package. Files are read when you
press Connect; nothing is saved. Do not share grant bundles.
press Connect; nothing is saved. Do not share grant bundles: each grant opens one
session, a bundle expires as a whole, and a second client using the same bundle
takes the session over. The view follows the region until you pan; then it
follows the camera (15 x 15 cells around it).
Controls (defaults, rebindable in Controls...): W A S D move, arrow keys pan,
mouse wheel zooms, left click selects, Tab toggles UI capture. Key names refer to
+4
View File
@@ -21,6 +21,10 @@ Mbed TLS (statically linked) Apache-2.0 (chosen from Apache-2.0 OR
GPL-2.0-or-later) LICENSES/MbedTLS.txt,
LICENSES/Apache-2.0.txt
MsQuic (msquic.dll) MIT License LICENSES/msquic.txt
Compiled into msquic.dll:
- OpenSSL (TLS 1.3 provider) Apache-2.0 LICENSES/OpenSSL.txt
Dear ImGui (statically linked) MIT License LICENSES/DearImGui.txt
- Embedded fonts ProggyClean and ProggyForever (MIT)
LICENSES/DearImGui-embedded-fonts.txt,
+13 -6
View File
@@ -12,23 +12,30 @@ $script:PackageFiles = @(
'LICENSES/DearImGui.txt',
'LICENSES/Khronos.txt',
'LICENSES/MbedTLS.txt',
'LICENSES/OpenSSL.txt',
'LICENSES/SDL3-hidapi.txt',
'LICENSES/SDL3-stb_image.txt',
'LICENSES/SDL3-yuv2rgb.txt',
'LICENSES/SDL3.txt',
'LICENSES/msquic.txt',
'README.txt',
'SDL3.dll',
'SHA256SUMS.txt',
'THIRD-PARTY-NOTICES.txt',
'evo-client.exe'
'evo-client.exe',
'msquic.dll'
)
# Imports allowed for the executables: Windows system DLLs and the bundled SDL3.dll.
# The C/C++ runtime is static (no MSVCP/VCRUNTIME/api-ms-win-crt/ucrtbase).
# Imports allowed for the executables: Windows system DLLs and the bundled SDL3.dll and
# msquic.dll (M10.5c). The C/C++ runtime is static (no MSVCP/VCRUNTIME/api-ms-win-crt/
# ucrtbase), in msquic.dll too.
$script:AllowedImports = @(
'advapi32.dll', 'bcrypt.dll', 'gdi32.dll', 'imm32.dll', 'kernel32.dll', 'ole32.dll',
'oleaut32.dll', 'sdl3.dll', 'setupapi.dll', 'shell32.dll', 'user32.dll', 'version.dll',
'winmm.dll', 'ws2_32.dll'
'advapi32.dll', 'bcrypt.dll', 'crypt32.dll', 'gdi32.dll', 'imm32.dll', 'iphlpapi.dll',
'kernel32.dll', 'msquic.dll', 'ncrypt.dll', 'ntdll.dll', 'ole32.dll', 'oleaut32.dll',
'sdl3.dll', 'setupapi.dll', 'shell32.dll', 'user32.dll', 'version.dll', 'winmm.dll',
'ws2_32.dll'
)
# Every shipped image whose imports are checked.
$script:PackageImages = @('evo-client.exe', 'SDL3.dll', 'msquic.dll')
function Get-Sha256([string]$Path) {
(Get-FileHash -Algorithm SHA256 -LiteralPath $Path).Hash.ToLowerInvariant()
+3 -2
View File
@@ -26,13 +26,14 @@ $secrets = { param($p) Assert-NoSecrets $p }
# Baseline: the untouched copy passes every guard.
Assert-PackageContent $Staged
Assert-NoSecrets $Staged
foreach ($binary in @('evo-client.exe', 'SDL3.dll')) { Assert-AllowedImports (Join-Path $Staged $binary) }
foreach ($binary in $script:PackageImages) { Assert-AllowedImports (Join-Path $Staged $binary) }
Expect-Refused 'extra file' { param($p) [IO.File]::WriteAllText((Join-Path $p 'notes.txt'), 'x', $utf8) } $content
Expect-Refused 'missing file' { param($p) Remove-Item -LiteralPath (Join-Path $p 'LICENSES\SDL3.txt') } $content
Expect-Refused 'missing msquic.dll' { param($p) Remove-Item -LiteralPath (Join-Path $p 'msquic.dll') } $content
Expect-Refused 'checksum mismatch' { param($p) [IO.File]::AppendAllText((Join-Path $p 'README.txt'), ' ', $utf8) } $content
Expect-Refused 'credential file type' { param($p) [IO.File]::WriteAllText((Join-Path $p 'dev-ca.pem'), 'x', $utf8) } $secrets
Expect-Refused 'grant bundle file type' { param($p) [IO.File]::WriteAllBytes((Join-Path $p 'client-grants.bin'), [byte[]]::new(108)) } $secrets
Expect-Refused 'grant bundle file type' { param($p) [IO.File]::WriteAllBytes((Join-Path $p 'client-grants.bin'), [byte[]]::new(160)) } $secrets
Expect-Refused 'private key text' {
param($p) [IO.File]::AppendAllText((Join-Path $p 'README.txt'),
"-----BEGIN EC PRIVATE KEY-----`nMHcCAQEEIBbF0p3l9QpKl2+abcdefghijklmnopqrstuvwxyzABCDEFG`n", $utf8) } $secrets
+16 -3
View File
@@ -59,6 +59,10 @@ $build = Join-Path $root 'build\client-package'
if ($Clean -and (Test-Path -LiteralPath $build)) { Remove-Item -LiteralPath $build -Recurse -Force }
$log = Join-Path $root 'build\client-package.log'
New-Item -ItemType Directory -Force (Split-Path -Parent $log) | Out-Null
# msquic builds OpenSSL with nmake, outside CMake's /Brepro (M10.5c): cl.exe also reads
# options from CL, and OpenSSL's build-date string honours SOURCE_DATE_EPOCH (commit time).
$env:CL = '/Brepro'
$env:SOURCE_DATE_EPOCH = "$epoch"
# A separate process (stderr in its own file): Windows PowerShell 5.1 would turn
# harmless native stderr lines into terminating errors here.
$check = Start-Process -FilePath 'powershell.exe' -NoNewWindow -Wait -PassThru `
@@ -68,7 +72,7 @@ $check = Start-Process -FilePath 'powershell.exe' -NoNewWindow -Wait -PassThru `
if ($check.ExitCode -ne 0) { throw "Package build or tests failed; see $log and $log.err" }
$summary = Select-String -LiteralPath $log -Pattern '(\d+)% tests passed, (\d+) tests failed out of (\d+)' | Select-Object -Last 1
if (!$summary -or $summary.Matches[0].Groups[2].Value -ne '0') { throw "No passing test summary in $log" }
$tests = "client-package CTest (labels client|network): $($summary.Matches[0].Groups[3].Value) passed, 0 failed"
$tests = "client-package CTest (labels client|network|quic-session): $($summary.Matches[0].Groups[3].Value) passed, 0 failed"
$exe = Join-Path $build 'evo-client.exe'
$version = (& $exe --version | Out-String).Trim()
@@ -88,10 +92,13 @@ $compiler = $matches[1]
$sdlVersion = Read-Pin 'sdl3-pin.cmake' 'EVO_SDL_VERSION'
$imguiVersion = Read-Pin 'imgui-pin.cmake' 'EVO_IMGUI_VERSION'
$mbedVersion = Read-Pin 'mbedtls-pin.cmake' 'EVO_MBEDTLS_VERSION'
$msquicVersion = Read-Pin 'msquic-pin.cmake' 'EVO_MSQUIC_VERSION'
$opensslVersion = Read-Pin 'msquic-pin.cmake' 'EVO_OPENSSL_VERSION'
$sdl = Join-Path $root "build\external\sdl3\SDL3-$sdlVersion"
$imgui = Join-Path $root "build\external\imgui\imgui-$imguiVersion"
$mbed = Join-Path $root "build\external\mbedtls\mbedtls-$mbedVersion"
foreach ($source in @($sdl, $imgui, $mbed)) {
$msquic = Join-Path $root "build\external\msquic\msquic-$msquicVersion"
foreach ($source in @($sdl, $imgui, $mbed, $msquic)) {
if (!(Test-Path -LiteralPath (Join-Path $source 'evo-verified.sha256'))) { throw "Unverified dependency source: $source" }
}
@@ -102,6 +109,7 @@ $licenses = Join-Path $stage 'LICENSES'
New-Item -ItemType Directory -Force $licenses | Out-Null
Copy-Item -LiteralPath $exe -Destination $stage
Copy-Item -LiteralPath (Join-Path $build 'SDL3.dll') -Destination $stage
Copy-Item -LiteralPath (Join-Path $build 'msquic.dll') -Destination $stage
# Repository templates are re-written with CRLF so checkout line-ending settings
# cannot change the package bytes.
Write-Text (Join-Path $stage 'THIRD-PARTY-NOTICES.txt') ([IO.File]::ReadAllLines((Join-Path $PSScriptRoot 'THIRD-PARTY-NOTICES.txt')))
@@ -127,6 +135,9 @@ Write-Text (Join-Path $licenses 'Khronos.txt') $khronosLines
Write-Text (Join-Path $licenses 'Apache-2.0.txt') (
Get-Block (Join-Path $mbed 'LICENSE') '^\s+Apache License\s*$' 'END OF TERMS AND CONDITIONS')
Copy-Item -LiteralPath (Join-Path $mbed 'LICENSE') -Destination (Join-Path $licenses 'MbedTLS.txt')
# msquic.dll (MIT) with OpenSSL (Apache-2.0) built static inside it (ADR-0090).
Copy-Item -LiteralPath (Join-Path $msquic 'LICENSE') -Destination (Join-Path $licenses 'msquic.txt')
Copy-Item -LiteralPath (Join-Path $msquic 'submodules\openssl\LICENSE.txt') -Destination (Join-Path $licenses 'OpenSSL.txt')
Copy-Item -LiteralPath (Join-Path $imgui 'LICENSE.txt') -Destination (Join-Path $licenses 'DearImGui.txt')
Copy-Item -LiteralPath (Join-Path $imgui 'docs\FONTS.md') -Destination (Join-Path $licenses 'DearImGui-FONTS.md')
$draw = Join-Path $imgui 'imgui_draw.cpp'
@@ -159,6 +170,8 @@ Write-Text (Join-Path $stage 'BUILD-INFO.txt') @(
"sdl3: $sdlVersion sha256=$(& $pin 'sdl3-pin.cmake' 'EVO_SDL_SHA256')",
"dear_imgui: $imguiVersion sha256=$(& $pin 'imgui-pin.cmake' 'EVO_IMGUI_SHA256')",
"mbedtls: $mbedVersion sha256=$(& $pin 'mbedtls-pin.cmake' 'EVO_MBEDTLS_SHA256')",
"msquic: $msquicVersion sha256=$(& $pin 'msquic-pin.cmake' 'EVO_MSQUIC_SHA256')",
"openssl: $opensslVersion sha256=$(& $pin 'msquic-pin.cmake' 'EVO_OPENSSL_SHA256')",
"tests: $tests",
"version_output: $version")
@@ -169,7 +182,7 @@ $sums = foreach ($relative in (Get-RelativeFiles $stage)) {
Assert-PackageContent $stage
Assert-NoSecrets $stage
foreach ($binary in @('evo-client.exe', 'SDL3.dll')) { Assert-AllowedImports (Join-Path $stage $binary) }
foreach ($binary in $script:PackageImages) { Assert-AllowedImports (Join-Path $stage $binary) }
# Deterministic ZIP: sorted entries under one top folder, commit time stamps.
Add-Type -AssemblyName System.IO.Compression
+1 -1
View File
@@ -23,7 +23,7 @@ try {
$folder = $top[0].FullName
Assert-PackageContent $folder
Assert-NoSecrets $folder
foreach ($binary in @('evo-client.exe', 'SDL3.dll')) { Assert-AllowedImports (Join-Path $folder $binary) }
foreach ($binary in $script:PackageImages) { Assert-AllowedImports (Join-Path $folder $binary) }
$identity = ([IO.File]::ReadAllLines((Join-Path $folder 'BUILD-INFO.txt')) | Where-Object { $_ -like 'identity: *' }) -replace '^identity: ', ''
if ($top[0].Name -ne "evo-client-windows-x64-$identity") { throw 'Folder name does not match BUILD-INFO identity' }