Qualify primitive life session recovery
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 1m24s
Foundation / checks (ecs) (push) Canceled after 1m33s
Foundation / checks (checks) (push) Canceled after 1m42s
Foundation / checks (client) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 1m24s
Foundation / checks (ecs) (push) Canceled after 1m33s
Foundation / checks (checks) (push) Canceled after 1m42s
This commit is contained in:
@@ -128,7 +128,9 @@ Local checks do not close ADR-0097's reference-worker qualification.
|
||||
probe have opt-in v5 request/query calls; v4 remains the default, and primitive
|
||||
v5 refuses the M10 action/movement/interest path. QUIC contract tests cover v5
|
||||
Hello, Welcome, durable-generation binding, receipt, outcome and read-only query.
|
||||
Runtime process/PostgreSQL qualification remains pending CI.
|
||||
The Linux/PostgreSQL process suite now provisions an isolated primitive region,
|
||||
creates a life over v5, restarts the host and checks the same durable result;
|
||||
execution remains pending CI.
|
||||
- Cross-region owner routing and reconnect-to-existing-life are not complete.
|
||||
The accepted v5 outcome has no owner-region/address field, while the delivery
|
||||
row requires routing. The host can identify a different reservation owner but
|
||||
|
||||
@@ -5813,3 +5813,8 @@ now exercises these client APIs end to end with a durable-control fake.
|
||||
Targeted MSVC Release/NDEBUG compilation of the modified session client, QUIC test and
|
||||
probe, manual relink of the test/probe, and `ctest --preset quic` passed (5/5). Formatting
|
||||
and `git diff --check` passed. Full server/process/PostgreSQL qualification remains in CI.
|
||||
|
||||
The Linux/PostgreSQL process suite now includes an isolated profile-3 lifecycle:
|
||||
owner-provision genesis, authenticate over v5, publish a founder, gracefully restart,
|
||||
and query the same immutable identity/commit receipt after recovery. This regression
|
||||
was added but cannot run locally on this Windows host; its CI evidence remains pending.
|
||||
|
||||
@@ -4,9 +4,12 @@
|
||||
// that survive SIGKILL after their commit, and resolve as "no record" (then commit once on
|
||||
// retry) after SIGKILL before it. Region 7/151. Run by tools/ci/postgres-check.sh
|
||||
// when the build has EVO_BUILD_QUIC.
|
||||
#include "evo/biology/founder.hpp"
|
||||
#include "evo/client/region_session.hpp"
|
||||
#include "evo/network/dev_credentials.hpp"
|
||||
#include "evo/network/session_grant.hpp"
|
||||
#include "evo/persistence/checkpoint_store.hpp"
|
||||
#include "evo/server/lifecycle/primitive_lives.hpp"
|
||||
#include "fixtures/server_process.hpp"
|
||||
#include <algorithm>
|
||||
#include <arpa/inet.h>
|
||||
@@ -260,6 +263,196 @@ std::optional<ActionOutcome> outcome_of(Server& server, RegionSessionClient& c,
|
||||
});
|
||||
return found;
|
||||
}
|
||||
|
||||
struct PrimitiveSetup {
|
||||
ServerRegion region;
|
||||
std::string ca_pem;
|
||||
std::optional<GrantSigningKey> issuer;
|
||||
explicit PrimitiveSetup(std::uint64_t r)
|
||||
: region{{7, r},
|
||||
fs::path(env("PGHOST")) / ("server-primitive-session-" + std::to_string(r))} {
|
||||
fs::remove_all(region.root);
|
||||
fs::create_directories(region.root);
|
||||
fs::permissions(region.root, fs::perms::owner_all, fs::perm_options::replace);
|
||||
auto db = owner();
|
||||
CHECK(db->query("INSERT INTO evolution.retained_builds(build_identity) VALUES "
|
||||
"(decode(repeat('b1',32),'hex')) ON CONFLICT DO NOTHING",
|
||||
{}, 5s));
|
||||
const auto endowed = biology::primitive_endowment();
|
||||
CHECK(endowed.has_value());
|
||||
auto funding = endowed->body;
|
||||
funding.energy.value += endowed->reserve.energy.value + endowed->construction.value;
|
||||
auto opening = server::PrimitiveLives::create(
|
||||
{region.key.world, region.key.region, region_identity.frame, 1, funding, {{0, 0}}});
|
||||
CHECK(opening.has_value());
|
||||
auto objects = persistence::FilesystemObjectStore::open(region.root, region.key,
|
||||
server::max_primitive_lives_bytes);
|
||||
CHECK(objects.has_value());
|
||||
persistence::Sha256Digest build{};
|
||||
build.fill(0xB1);
|
||||
persistence::Uuid commit{};
|
||||
commit.fill(static_cast<std::uint8_t>(r));
|
||||
CHECK(persistence::provision_primitive_region(
|
||||
*db, **objects, region.key, region_identity.frame, **opening, commit, build, 5s));
|
||||
const std::array<std::string, 2> allocator_args{std::to_string(region.key.world), "1"};
|
||||
CHECK(db->query(
|
||||
"INSERT INTO evolution.life_allocators VALUES($1::evolution.u64, $2::evolution.u64) "
|
||||
"ON CONFLICT DO NOTHING",
|
||||
allocator_args, 5s));
|
||||
const auto credentials = generate_dev_credentials(DeploymentEnvironment::dev, name, 1,
|
||||
std::chrono::system_clock::now());
|
||||
CHECK(credentials.has_value());
|
||||
ca_pem = credentials->authority_pem;
|
||||
write_text(region.root / "ca.pem", credentials->authority_pem);
|
||||
write_text(region.root / "server.pem", credentials->server_certificate_pem);
|
||||
write_text(region.root / "server.key", credentials->server_key_pem);
|
||||
for (int attempt = 0; attempt < 8 && !issuer; ++attempt) {
|
||||
std::array<std::uint8_t, grant_private_key_bytes> scalar{};
|
||||
CHECK(random_bytes(scalar));
|
||||
if (auto key = GrantSigningKey::import(DeploymentEnvironment::dev, 1, scalar)) {
|
||||
if (const auto public_key = key->public_key()) {
|
||||
write_file(region.root / "issuer.pub", *public_key);
|
||||
issuer.emplace(std::move(*key));
|
||||
}
|
||||
}
|
||||
}
|
||||
CHECK(issuer.has_value());
|
||||
}
|
||||
WireGrant grant(const AccountId& who, std::uint64_t serial) const {
|
||||
GrantClaims claims;
|
||||
claims.grant_id = 19000 + serial;
|
||||
claims.account = who;
|
||||
claims.serial = serial;
|
||||
claims.world = {region.key.world, region_identity.frame};
|
||||
claims.region = region.key.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.expires_at = claims.issued_at + 120;
|
||||
return must(issuer).sign(claims).value();
|
||||
}
|
||||
std::vector<std::string> args(std::uint16_t port = 0) const {
|
||||
return {env("EVO_SERVER_BIN"),
|
||||
"--profile",
|
||||
"primitive",
|
||||
"--world",
|
||||
std::to_string(region.key.world),
|
||||
"--region",
|
||||
std::to_string(region.key.region),
|
||||
"--frame",
|
||||
std::to_string(region_identity.frame),
|
||||
"--pg-host",
|
||||
env("PGHOST"),
|
||||
"--pg-port",
|
||||
env("PGPORT"),
|
||||
"--pg-database",
|
||||
env("PGDATABASE"),
|
||||
"--pg-user",
|
||||
env("EVO_PG_RUNTIME_USER"),
|
||||
"--objects",
|
||||
region.root.string(),
|
||||
"--build",
|
||||
"b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1b1",
|
||||
"--lease-profile",
|
||||
"fast",
|
||||
"--ready-file",
|
||||
(region.root / "ready").string(),
|
||||
"--primitive-listen",
|
||||
"127.0.0.1:" + std::to_string(port),
|
||||
"--primitive-cert",
|
||||
(region.root / "server.pem").string(),
|
||||
"--primitive-key",
|
||||
(region.root / "server.key").string(),
|
||||
"--primitive-issuer",
|
||||
(region.root / "issuer.pub").string(),
|
||||
"--primitive-environment",
|
||||
"dev"};
|
||||
}
|
||||
};
|
||||
|
||||
struct PrimitiveServer {
|
||||
std::unique_ptr<Child> child;
|
||||
std::uint16_t port{};
|
||||
explicit PrimitiveServer(const PrimitiveSetup& setup, std::uint16_t fixed_port = 0)
|
||||
: child{std::make_unique<Child>(setup.args(fixed_port))} {
|
||||
CHECK(child->wait_line("primitive listening ", 30s));
|
||||
for (const auto& line : child->lines())
|
||||
if (starts(line, "primitive listening "))
|
||||
port = static_cast<std::uint16_t>(std::stoul(line.substr(19)));
|
||||
CHECK(port != 0 && child->wait_line("ready 1", 30s));
|
||||
}
|
||||
void pump() {
|
||||
child->pump(1ms);
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<RegionSessionClient>
|
||||
connect_primitive(const PrimitiveSetup& setup, PrimitiveServer& server, const WireGrant& grant) {
|
||||
client::RegionSessionClientConfig config;
|
||||
config.transport.port = server.port;
|
||||
config.transport.server_name = name;
|
||||
config.transport.authority_pem = setup.ca_pem;
|
||||
config.transport.authority_pem_file = (setup.region.root / "ca.pem").string();
|
||||
config.grant = grant;
|
||||
config.protocol_version = session_protocol_v5;
|
||||
auto made = RegionSessionClient::connect(std::move(config), Clock::now());
|
||||
CHECK(made.has_value());
|
||||
return std::move(*made);
|
||||
}
|
||||
|
||||
bool until_primitive(PrimitiveServer& server, RegionSessionClient& client,
|
||||
const std::function<bool()>& done, std::chrono::milliseconds limit = 20s) {
|
||||
const auto end = Clock::now() + limit;
|
||||
while (Clock::now() < end) {
|
||||
client.poll(Clock::now());
|
||||
server.pump();
|
||||
if (done())
|
||||
return true;
|
||||
}
|
||||
return done();
|
||||
}
|
||||
|
||||
void primitive_life_v5_process_round_trip() {
|
||||
PrimitiveSetup setup{35};
|
||||
const auto who = account(0xA7);
|
||||
auto server = std::make_unique<PrimitiveServer>(setup);
|
||||
auto client = connect_primitive(setup, *server, setup.grant(who, 1));
|
||||
CHECK(until_primitive(*server, *client,
|
||||
[&] { return client->state() == RegionSessionState::established; }));
|
||||
CHECK(client->request_primitive_life(501));
|
||||
std::vector<PrimitiveLifeReceipt> receipts;
|
||||
std::vector<PrimitiveLifeOutcome> outcomes;
|
||||
CHECK(until_primitive(*server, *client, [&] {
|
||||
auto next_receipts = client->take_primitive_life_receipts();
|
||||
auto next_outcomes = client->take_primitive_life_outcomes();
|
||||
receipts.insert(receipts.end(), next_receipts.begin(), next_receipts.end());
|
||||
outcomes.insert(outcomes.end(), next_outcomes.begin(), next_outcomes.end());
|
||||
return !receipts.empty() && !outcomes.empty();
|
||||
}));
|
||||
CHECK(receipts.front().status == AdmitStatus::admitted &&
|
||||
outcomes.front().result == PrimitiveLifeResult::born &&
|
||||
outcomes.front().life_identity != 0 && outcomes.front().commit_sequence != 0);
|
||||
const auto born = outcomes.front();
|
||||
client->close();
|
||||
server->child->signal(SIGTERM);
|
||||
CHECK(server->child->wait_exit(30s) == 0);
|
||||
|
||||
server = std::make_unique<PrimitiveServer>(setup, server->port);
|
||||
auto resumed = connect_primitive(setup, *server, setup.grant(who, 2));
|
||||
CHECK(until_primitive(*server, *resumed,
|
||||
[&] { return resumed->state() == RegionSessionState::established; }));
|
||||
CHECK(resumed->query_primitive_life(501));
|
||||
outcomes.clear();
|
||||
CHECK(until_primitive(*server, *resumed, [&] {
|
||||
outcomes = resumed->take_primitive_life_outcomes();
|
||||
return !outcomes.empty();
|
||||
}));
|
||||
CHECK(outcomes.front() == born);
|
||||
resumed->close();
|
||||
server->child->signal(SIGTERM);
|
||||
CHECK(server->child->wait_exit(30s) == 0);
|
||||
}
|
||||
std::optional<ActionReceipt> receipt_of(Server& server, RegionSessionClient& c, std::uint64_t id) {
|
||||
std::optional<ActionReceipt> found;
|
||||
until(server, c, [&] {
|
||||
@@ -652,5 +845,6 @@ void run_region_m10_session_tests() {
|
||||
end_to_end();
|
||||
load_smoke();
|
||||
lease_loss_under_load();
|
||||
primitive_life_v5_process_round_trip();
|
||||
std::puts("region m10 session integration passed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user