Show what a bud costs (ADR-0129 amendment)
Foundation / checks (ecs) (push) Successful in 2m20s
Foundation / checks (deploy) (push) Successful in 4m4s
Foundation / checks (tsan) (push) Successful in 9m59s
Foundation / checks (client) (push) Successful in 19m19s
Foundation / checks (network) (push) Successful in 19m24s
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 32m13s
Foundation / checks (checks) (push) Canceled after 32m19s

The v10 cellular perception carries the bud cost after the diagnostics block: the
energy (construction plus the bud's provision) and matter per channel one bud takes
from a fully grown cell's reserve. biology::bud_cost reads it from fund_bud itself,
so the shown cost is exactly the charge; the server caches it per genome. The
client shows it and names the channels the reserve is short on. v10 clients must
be rebuilt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dingo
2026-10-15 19:11:28 -04:00
co-authored by Claude Opus 5.5
parent a97f0c3fea
commit d98d71e7c0
13 changed files with 225 additions and 13 deletions
+31
View File
@@ -113,6 +113,36 @@ void only_a_grown_undamaged_reproducing_parent_buds() {
CHECK(barren);
CHECK(fund_bud(*barren, {1000, 0}, plenty(), temperate).error() == BuddingError::no_capability);
}
// ADR-0129 amendment: the shown bud cost is exactly the charge. A reserve equal to it buds;
// one unit short on any channel refuses.
void the_shown_bud_cost_is_exactly_what_funding_takes() {
const auto genome = founder();
const auto shown = bud_cost(genome, temperate);
if (!shown)
throw std::runtime_error("budding: founder has no bud cost");
const Inventory cost = *shown;
CHECK(cost.energy.value != 0);
const auto exact = fund_bud(genome, {1000, 0}, cost, temperate);
CHECK(exact && exact->parent_reserve == Inventory{});
for (std::size_t c = 0; c <= cost.matter.size(); ++c) {
auto short_one = cost;
auto& unit = c == 0 ? short_one.energy.value : short_one.matter[c - 1].value;
if (unit == 0)
continue;
--unit;
CHECK(fund_bud(genome, {1000, 0}, short_one, temperate).error() ==
BuddingError::insufficient_funding);
}
const auto barren = Genome::create({9,
1,
2,
{},
{{Capability::energy_conversion, 400, 0},
{Capability::membrane, 1, 0},
{Capability::target_size, 8'000'000, 0}}});
CHECK(barren && !bud_cost(*barren, temperate));
}
} // namespace
int main() {
@@ -120,6 +150,7 @@ int main() {
a_grown_parent_funds_the_largest_bud_its_investment_builds();
every_short_channel_refuses_and_spends_nothing();
only_a_grown_undamaged_reproducing_parent_buds();
the_shown_bud_cost_is_exactly_what_funding_takes();
} catch (const std::exception& error) {
std::cerr << error.what() << '\n';
return 1;