Persist primitive life outcomes across control moves
Foundation / checks (deploy) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 1m57s
Foundation / checks (client) (push) Successful in 12m36s
Foundation / checks (network) (push) Successful in 13m43s
Foundation / checks (tsan) (push) Successful in 8m14s
Foundation / checks (postgres) (push) Failing after 17m26s
Foundation / checks (checks) (push) Successful in 33m23s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped

This commit is contained in:
dingo
2026-10-10 13:52:43 -04:00
parent f92198fd50
commit ea07d7c1f5
17 changed files with 303 additions and 83 deletions
@@ -26,7 +26,8 @@ enum class LifeRefusal : std::uint8_t {
none = 0, // Reserved only; NOT successful spawn.
insufficient_funding = 1,
no_placement = 2,
cancelled = 3
cancelled = 3,
existing_life = 4
};
struct LifeReservation {
std::uint64_t identity{}, region{};
@@ -40,6 +41,11 @@ struct PrimitiveLifeBinding {
std::uint64_t commit_sequence{};
friend bool operator==(const PrimitiveLifeBinding&, const PrimitiveLifeBinding&) = default;
};
struct PrimitiveLifeOutcome {
LifeReservation reservation;
std::optional<PrimitiveLifeBinding> published;
friend bool operator==(const PrimitiveLifeOutcome&, const PrimitiveLifeOutcome&) = default;
};
// Exact retry returns the original identity/owning region/refusal, even after
// account control moves. The result grants no authority in the returned region.
// request_id is in the new-life namespace, separate from M10 probe action IDs.
@@ -57,4 +63,10 @@ reject_primitive_life(Postgres& db, RegionKey key, const LeaseGrant& lease, cons
// are intentionally absent and must be reacquired after recovery.
[[nodiscard]] std::expected<std::vector<PrimitiveLifeBinding>, LifeReservationFailure>
load_primitive_lives(Postgres& db, RegionKey key, std::chrono::milliseconds timeout);
// Authenticated world/account/request lookup. A missing value is unknown; a
// present pending reservation is still not a published life.
[[nodiscard]] std::expected<std::optional<PrimitiveLifeOutcome>, LifeReservationFailure>
query_primitive_life(Postgres& db, RegionKey key, const LeaseGrant& lease, const Uuid& account,
std::uint64_t generation, std::uint64_t request_id,
std::chrono::milliseconds timeout);
} // namespace evo::persistence