M11-PT-001: log why a cellular tick cannot be built
Foundation / checks (network) (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 5s
Foundation / checks (client) (push) Canceled after 5s
Foundation / checks (deploy) (push) Canceled after 5s
Foundation / checks (ecs) (push) Successful in 2m26s
Foundation / checks (network) (push) Canceled after 0s
Foundation / checks (postgres) (push) Canceled after 0s
Foundation / checks (tsan) (push) Canceled after 0s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 5s
Foundation / checks (client) (push) Canceled after 5s
Foundation / checks (deploy) (push) Canceled after 5s
Foundation / checks (ecs) (push) Successful in 2m26s
A tick whose batch the builder refuses was dropped silently and retried every 50 ms,
so a region could stop advancing with nothing in its log: after a restart DEV region 6
stayed at tick 7144 while its owner was connected. The server now prints each distinct
refusal once ("cellular tick stalled tick=N at=create|append error=E") until a tick
builds again.
Also covers a founder that buds, is suspended while its wildlife bud lives on, and
resumes on its owner's return (rules 6); that path resumes correctly.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -942,6 +942,63 @@ void rules_five_owner_freezes_lingers_suspends_and_resumes() {
|
||||
resumed.position != parked.position && !owner->last_tick_feedback()[0].resume_blocked);
|
||||
CHECK(owner->current_total() == owner->opening_total());
|
||||
}
|
||||
// M11-PT-001: a founder buds, its owner leaves until it is suspended while the wildlife
|
||||
// bud lives on, then returns. The first unfrozen tick must resume it, not fail the tick.
|
||||
void suspended_parent_of_a_bud_resumes() {
|
||||
auto primitive = PrimitiveLives::create({96, 1, 7, 17, founder_price(1), {{0, 0}}});
|
||||
CHECK(primitive);
|
||||
LifeRequest request{};
|
||||
request.account.back() = 4;
|
||||
request.action = 1;
|
||||
CHECK((*primitive)->spawn(request, {1, 101, 201, 301, {1}}));
|
||||
constexpr std::uint64_t rich = 10'000'000'000;
|
||||
auto habitat = evo::biology::CellularHabitat::create(
|
||||
{96, 1, 7, 3'000, 2'000, {{{0, 0}, 29, {{rich}, {{{rich}, {rich}, {rich}, {rich}}}}}}});
|
||||
CHECK(habitat);
|
||||
auto created =
|
||||
CellularLives::create(**primitive, std::move(*habitat), {{3'000, 2'000}, 1, 293'150},
|
||||
CellularLivesProfile::balance);
|
||||
CHECK(created);
|
||||
auto& owner = **created;
|
||||
evo::biology::CellularStepIntent feed{};
|
||||
feed.intake_target = evo::biology::CellularPatchAddress{0, 0};
|
||||
evo::biology::CellularStepIntent bud{};
|
||||
bud.bud = true;
|
||||
evo::biology::CellularStepIntent frozen{};
|
||||
frozen.frozen = true;
|
||||
const auto with_wildlife = [&](CellularLifeIntent mine) {
|
||||
std::vector<CellularLifeIntent> intents{mine};
|
||||
if (const auto wild = wildlife_intents(owner, owner.tick() + 1); wild)
|
||||
for (const auto& intent : *wild)
|
||||
intents.push_back(intent);
|
||||
else
|
||||
throw std::runtime_error{"wildlife intents"};
|
||||
std::ranges::sort(intents, {}, &CellularLifeIntent::life_id);
|
||||
return intents;
|
||||
};
|
||||
for (std::size_t round = 0; round < 400 && owner.lives().size() == 1; ++round) {
|
||||
for (int tick = 0; tick < 19; ++tick)
|
||||
CHECK(owner.advance_tick(std::array{CellularLifeIntent{1, feed}}));
|
||||
CHECK(owner.advance_tick(std::array{CellularLifeIntent{1, bud}}));
|
||||
}
|
||||
CHECK(owner.lives().size() == 2);
|
||||
for (std::uint64_t tick = 0; tick <= cellular_linger_ticks + 1; ++tick) {
|
||||
const auto stepped = owner.advance_tick(with_wildlife({1, frozen}));
|
||||
if (!stepped)
|
||||
std::fprintf(stderr, "linger tick %llu error %u\n",
|
||||
static_cast<unsigned long long>(tick),
|
||||
static_cast<unsigned>(stepped.error()));
|
||||
CHECK(stepped.has_value());
|
||||
}
|
||||
CHECK(owner.lives()[0].presence == CellularPresence::suspended);
|
||||
const auto resumed = owner.advance_tick(with_wildlife({1, {}}));
|
||||
if (!resumed)
|
||||
std::fprintf(stderr, "resume error %u\n", static_cast<unsigned>(resumed.error()));
|
||||
CHECK(resumed && owner.lives()[0].presence == CellularPresence::active);
|
||||
for (int tick = 0; tick < 20; ++tick)
|
||||
CHECK(owner.advance_tick(with_wildlife({1, feed})));
|
||||
CHECK(owner.current_total() == owner.opening_total());
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
@@ -954,6 +1011,7 @@ int main() {
|
||||
rules_four_owner_buds_wildlife();
|
||||
rules_five_owner_freezes_lingers_suspends_and_resumes();
|
||||
rules_six_found_cheaper_cells_with_finer_mutations();
|
||||
suspended_parent_of_a_bud_resumes();
|
||||
std::puts(
|
||||
"PASS cellular lives: feeding, tick ownership, terminal closure, rules 3, budding");
|
||||
} catch (const std::exception& error) {
|
||||
|
||||
Reference in New Issue
Block a user