feat(admin): region page redesign, resource ledger, drip and dark mode
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m40s
Foundation / postgres-tools (push) Successful in 30s
Foundation / server-image (push) Successful in 4m46s
Foundation / image (push) Successful in 5m34s
Foundation / checks (client) (push) Successful in 5s
Foundation / checks (checks) (push) Successful in 5s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / checks (network) (push) Successful in 5s
Foundation / checks (postgres) (push) Successful in 4s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m40s
Foundation / postgres-tools (push) Successful in 30s
Foundation / server-image (push) Successful in 4m46s
Foundation / image (push) Successful in 5m34s
The region view adds the rules-13 drip and complete counts and totals over every life and deposit. The region page is rebuilt around the map: a KPI strip (tick pace, population, deposit capacity, region energy and matter, spent pool, next drip), layer toggles that double as the legend, zoom and a scale, and tabs for inspecting cells and deposits, resources (where each channel sits, the spent pool and each channel's next drip), actions, the running tuning and session access. The admin API serves the region tuning file read only (--region-tuning). Light and dark themes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "evo/server/lifecycle/cellular_admin_view.hpp"
|
||||
#include "fixtures/cellular_ecology.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
@@ -59,12 +60,87 @@ void renders_cells_and_deposits() {
|
||||
"deposit limit keeps ids 1 and 2");
|
||||
const auto none = render_cellular_admin_view(*state, {}, {.cells = 0, .deposits = 0});
|
||||
require(none.find("\"cells\":[],\"deposits\":[]}") != std::string::npos, "empty lists");
|
||||
|
||||
// Counts and totals cover everything, whatever the limits; no drip before rules 13.
|
||||
std::array<std::uint64_t, 5> reserve{}, body{}, bubbles{};
|
||||
std::array<std::size_t, 3> kinds{};
|
||||
const auto add = [](std::array<std::uint64_t, 5>& totals, const accounting::Inventory& stock) {
|
||||
totals[0] += stock.energy.value;
|
||||
for (std::size_t i = 0; i < 4; ++i)
|
||||
totals[i + 1] += stock.matter[i].value;
|
||||
};
|
||||
for (const auto& life : state->lives()) {
|
||||
add(reserve, life.reserve);
|
||||
add(body, life.body);
|
||||
}
|
||||
for (const auto& patch : state->habitat().patches()) {
|
||||
++kinds[static_cast<std::size_t>(patch.kind)];
|
||||
if (patch.kind == biology::CellularDepositKind::mote)
|
||||
add(bubbles, patch.stock);
|
||||
}
|
||||
const auto list = [](const std::array<std::uint64_t, 5>& totals) {
|
||||
std::string text = "[";
|
||||
for (std::size_t i = 0; i < totals.size(); ++i)
|
||||
text += (i == 0 ? "" : ",") + std::to_string(totals[i]);
|
||||
return text + "]";
|
||||
};
|
||||
const auto counts = "\"counts\":[4,0," + std::to_string(kinds[0]) + "," +
|
||||
std::to_string(kinds[1]) + "," + std::to_string(kinds[2]) + "]";
|
||||
require(reserve[0] > 0 && body[1] > 0, "the fixture's cells hold stock");
|
||||
for (const auto& text : {view, none}) {
|
||||
require(text.find(counts) != std::string::npos, "counts");
|
||||
require(text.find("\"totals\":{\"reserve\":" + list(reserve) + ",\"body\":" + list(body) +
|
||||
",") != std::string::npos,
|
||||
"cell totals");
|
||||
require(text.find(",\"bubbles\":" + list(bubbles) + "}") != std::string::npos,
|
||||
"bubble totals");
|
||||
require(text.find("\"drip\"") == std::string::npos, "a drip before rules 13");
|
||||
}
|
||||
}
|
||||
|
||||
// The trial liquid rules (cellular_revamp_owner_tests).
|
||||
CellularLiquidRules liquid() {
|
||||
return {.currents = {5, 48'000, 48'000, 250, 2, 4, 3'000, 6'000, 60, 300},
|
||||
.founder = {.thrust_q10 = 20'480,
|
||||
.reverse_thrust_q10 = 20'480,
|
||||
.forward_drag_ppm = 95'163,
|
||||
.lateral_drag_ppm = 95'163,
|
||||
.turn = 3'276},
|
||||
.deposits = {.drift_radius_um = 200,
|
||||
.max_drift_q10 = 100 * 1'024,
|
||||
.drift_decay_ppm = 95'163,
|
||||
.merged_cap = 8,
|
||||
.bubble_radius_um = biology::cellular_mote_radius_um}};
|
||||
}
|
||||
|
||||
// A rules-13 owner's view carries its spent-pool drip.
|
||||
void renders_the_drip() {
|
||||
auto state = opening(7, true, 2, false);
|
||||
checked(state->advance_tick({}), "genesis tick");
|
||||
state = checked(state->migration_upgrade_candidate(), "boundary upgrade");
|
||||
state = checked(state->maturation_upgrade_candidate(), "maturation upgrade");
|
||||
state = checked(state->inheritance_upgrade_candidate(), "inheritance upgrade");
|
||||
state = checked(state->photosynthesis_upgrade_candidate({0, 1, {0}}), "light upgrade");
|
||||
state = checked(state->liquid_upgrade_candidate(liquid()), "liquid upgrade");
|
||||
CellularRevampRules rules{.body = {.essential_upkeep_per_thousand = 250},
|
||||
.burn_pj_per_kfg = {2'000, 2'000, 2'000, 2'000},
|
||||
.step = {.engulf_ratio_milli = 1'500,
|
||||
.engulf_reserve_percent = 100,
|
||||
.kill_bubble_per_thousand = 500},
|
||||
.drip_interval_ticks = 20,
|
||||
.drip_bubble_pj = 20'000'000,
|
||||
.drip_bubble_fg = 1'000'000};
|
||||
state = checked(state->revamp_upgrade_candidate(rules), "revamp upgrade");
|
||||
const auto view = render_cellular_admin_view(*state, {});
|
||||
require(view.find("],\"drip\":[20,20000000,1000000],\"cells_total\":") != std::string::npos,
|
||||
"rules-13 drip");
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main() {
|
||||
try {
|
||||
renders_cells_and_deposits();
|
||||
renders_the_drip();
|
||||
} catch (const std::exception& error) {
|
||||
std::fprintf(stderr, "%s\n", error.what());
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user