fix(server): end a player's life under the reservation's root identity
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 5s
Foundation / checks (network) (push) Successful in 4s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 4s
Foundation / checks (deploy) (push) Successful in 4m27s
Foundation / postgres-tools (push) Successful in 26s
Foundation / server-image (push) Successful in 4m18s
Foundation / image (push) Successful in 5m4s

Playtest: after becoming a split's offspring and being engulfed, every new
birth was refused ("Existing cell is already bound to this account"). The
region recorded the ending under the dead cell's own identity, which was never
reserved, so the database ignored it and the founder's reservation stayed
open. After Adhesion the opposite happened: the merged founder's ending closed
the reservation while the player lived on as the organism.

An account's life now ends only when no life holds the account, and the ending
names the lineage root (cellular_lineage_root): the life born from the
reservation, reached through parent links in lives and corpses.

tools/ops/end-account-life.sql lets the operator end one stranded account's
reservation (dry run unless confirm=yes; exactly one match required).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-26 13:24:06 -04:00
co-authored by Claude Opus 5.5
parent 5dab8e4018
commit 736bf98aaa
6 changed files with 129 additions and 7 deletions
+11 -6
View File
@@ -746,12 +746,17 @@ const HostStatus& CellularRegionHost::step() {
void CellularRegionHost::note_endings(const CellularLives& before, const CellularLives& after,
const persistence::Uuid& commit) {
for (const auto& life : before.lives())
if (life.account != LifeAccount{} &&
std::ranges::find(after.lives(), life.identity.life, [](const CellularOwnedLife& next) {
return next.identity.life;
}) == after.lives().end())
pending_endings_.push_back({commit, life.identity.life});
for (const auto& life : before.lives()) {
// Rules 13: control can move to another life (becoming a split's offspring or a bud,
// Adhesion's organism). The account's life ends only when no life holds it any more.
if (life.account == LifeAccount{} ||
std::ranges::find(after.lives(), life.account, &CellularOwnedLife::account) !=
after.lives().end())
continue;
// The reservation names the life born from it, the root of the lineage control
// followed, so the ending is recorded against that root.
pending_endings_.push_back({commit, cellular_lineage_root(after, life.identity.life)});
}
}
void CellularRegionHost::flush_endings() {
+20
View File
@@ -1028,6 +1028,26 @@ cellular_organism_genome(const biology::Genome& genome, std::uint32_t members) {
return organism_genome(genome, members);
}
std::uint64_t cellular_lineage_root(const CellularLives& state, std::uint64_t life_id) {
const auto parent_of = [&](std::uint64_t id) -> std::optional<std::uint64_t> {
for (const auto& life : state.lives())
if (life.identity.life == id)
return life.parent_life;
for (const auto& corpse : state.corpses())
if (corpse.life_id == id)
return corpse.parent_life;
return std::nullopt;
};
auto root = life_id;
auto parent = parent_of(life_id);
for (std::size_t step = 0; parent && *parent != 0 && step < biology::max_archived_organisms;
++step) {
root = *parent;
parent = parent_of(root);
}
return root;
}
bool cellular_can_emerge(const CellularOwnedLife& life, const CellularRevampRules& rules) noexcept {
std::uint64_t mass{};
for (std::size_t c = 0; c < life.body.matter.size(); ++c)