ADR 0127
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 2m23s
Foundation / checks (tsan) (push) Successful in 10m11s
Foundation / checks (client) (push) Failing after 14m26s
Foundation / checks (network) (push) Successful in 18m54s
Foundation / checks (checks) (push) Successful in 42m9s
Foundation / checks (postgres) (push) Successful in 43m51s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 2m23s
Foundation / checks (tsan) (push) Successful in 10m11s
Foundation / checks (client) (push) Failing after 14m26s
Foundation / checks (network) (push) Successful in 18m54s
Foundation / checks (checks) (push) Successful in 42m9s
Foundation / checks (postgres) (push) Successful in 43m51s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
This commit is contained in:
@@ -310,12 +310,66 @@ void builder_batches_reserved_birth_after_empty_tick() {
|
||||
CellularSessionBatchError::duplicate_birth);
|
||||
CHECK(builder->candidate().snapshot() == snapshot && builder->batch().ticks.size() == 1);
|
||||
}
|
||||
void unavailable_birth_does_not_freeze_the_tick() {
|
||||
for (const bool funded : {false, true}) {
|
||||
auto primitive =
|
||||
PrimitiveLives::create({94, 1, 1, 17, founder_price(funded ? 2 : 1), {{0, 0}}});
|
||||
CHECK(primitive);
|
||||
LifeRequest request{};
|
||||
request.account.back() = 1;
|
||||
request.action = 1;
|
||||
CHECK((*primitive)->spawn(request, {101, 101, 101, 101, {1}}));
|
||||
auto habitat = biology::CellularHabitat::create({94, 1, 1, 1000, 1000, {}});
|
||||
CHECK(habitat);
|
||||
auto state =
|
||||
CellularLives::create(**primitive, std::move(*habitat), {{1000, 1000}, 1, 293150});
|
||||
CHECK(state);
|
||||
persistence::RegionHead head{};
|
||||
head.frame = 1;
|
||||
head.end_tick = 1;
|
||||
head.commit.fill(1);
|
||||
head.digest.fill(2);
|
||||
CellularTickIntents::Birth birth{};
|
||||
birth.account.back() = 2;
|
||||
birth.request = 1;
|
||||
birth.generation = 1;
|
||||
birth.identity = 102;
|
||||
const std::array births{birth};
|
||||
// Movement vacates the nursery in the underfunded case, isolating each refusal.
|
||||
const std::array baseline{
|
||||
CellularLifeIntent{101, {{static_cast<std::int16_t>(funded ? 0 : 1000), 0}, {}}}};
|
||||
// A founder moves only a few um per tick: first move it fully away from the site.
|
||||
if (!funded) {
|
||||
for (int i = 0; i < 100; ++i)
|
||||
CHECK((*state)->advance_tick(baseline));
|
||||
head.end_tick = (*state)->tick();
|
||||
}
|
||||
auto strict = CellularSessionBatchBuilder::create(**state, head);
|
||||
CHECK(strict);
|
||||
CHECK(strict->append(head.end_tick + 1, baseline, {}, births).error() ==
|
||||
CellularSessionBatchError::invalid_birth);
|
||||
CHECK(strict->candidate().tick() == head.end_tick);
|
||||
auto builder = CellularSessionBatchBuilder::create(**state, head);
|
||||
CHECK(builder &&
|
||||
builder->append_with_birth_refusals(head.end_tick + 1, baseline, {}, births));
|
||||
CHECK(builder->refused_births().size() == 1 && builder->refused_births()[0].birth == birth);
|
||||
CHECK(
|
||||
builder->refused_births()[0].reason ==
|
||||
(funded ? CellularLivesError::no_placement : CellularLivesError::insufficient_funding));
|
||||
CHECK(builder->candidate().tick() == head.end_tick + 1 &&
|
||||
builder->candidate().lives().size() == 1);
|
||||
CHECK(builder->batch().ticks.back().births.empty());
|
||||
const auto replay = replay_cellular_batch(**state, builder->batch());
|
||||
CHECK(replay && (*replay)->snapshot() == builder->candidate().snapshot());
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main() try {
|
||||
actions_bind_to_owned_life_and_preserve_other_inputs();
|
||||
durable_mutation_reservations_bind_to_the_exact_offer();
|
||||
builder_batches_reserved_birth_after_empty_tick();
|
||||
unavailable_birth_does_not_freeze_the_tick();
|
||||
std::puts("cellular session batch: ok");
|
||||
} catch (const std::exception& e) {
|
||||
std::fprintf(stderr, "%s\n", e.what());
|
||||
|
||||
Reference in New Issue
Block a user