Implement calibrated Modern stadium periphery preview and staged upgrades (by Codex)

This commit is contained in:
Codex committed 2026-10-26 18:48:31 +01:00
1 parent fff2cc2f0b
commit bfcf9a07bf
12 files changed
+470 -37

No files matched your search

+32 -1
View File
@@ -140,7 +140,7 @@ void check_stadium_source(const fs::path &root, const std::shared_ptr<const Cata
!source.apply({built.revision, "stadium", {{"kind", "build"}, {"request",
{{"kind", "periphery"}, {"index", 0}, {"level", 1}}}}}).ok &&
source.snapshot().state == built.state && source.snapshot().revision == built.revision,
"Stale, duplicate or excluded periphery build changed state");
"Stale, duplicate or unchanged periphery build changed state");
const auto file = root / "stadium.ui.json";
source.save(file, default_desktop());
require(source.apply({source.snapshot().revision, "ticket", 9}).ok &&
@@ -162,6 +162,37 @@ void check_stadium_source(const fs::path &root, const std::shared_ptr<const Cata
source.snapshot().state.at("cash") == built.state.at("cash") &&
source.snapshot().state.at("ticket") == built.state.at("ticket"),
"Legacy stadium migration reset unrelated values");
const auto perimeter_initial = source.snapshot();
const auto perimeter_action = [](int level) {
return Json{{"kind", "build"}, {"request", {{"kind", "periphery"}, {"index", 0}, {"level", level}}}};
};
require(!source.apply({perimeter_initial.revision, "stadium", perimeter_action(3)}).ok &&
source.snapshot().state == perimeter_initial.state,
"Source accepted skipped periphery level");
require(source.apply({perimeter_initial.revision, "stadium", perimeter_action(2)}).ok,
"Periphery next level did not cross source boundary");
const auto perimeter_built = source.snapshot();
require(perimeter_built.revision == perimeter_initial.revision + 1 && source.dirty() &&
perimeter_built.state.at("stadium").at("periphery")[0].at("job").at("level") == 2 &&
!source.apply({perimeter_initial.revision, "stadium", perimeter_action(2)}).ok &&
!source.apply({perimeter_built.revision, "stadium", perimeter_action(2)}).ok &&
source.snapshot().state == perimeter_built.state,
"Periphery stale/duplicate booking changed source");
for (const auto &[key, value] : perimeter_initial.state.items())
if (key != "stadium") require(perimeter_built.state.at(key) == value, "Periphery changed unrelated state");
source.save(file, default_desktop());
require(source.apply({source.snapshot().revision, "ticket", 8}).ok, "Ticket change failed");
source.load(file);
require(source.snapshot().state == perimeter_built.state && !source.dirty(),
"Periphery pending checkpoint did not roundtrip");
auto old_stadium = Json::parse(bmh::editor::read_file(file));
old_stadium["stadium"].erase("periphery");
old_stadium["stadium"]["budget"] = initial.state.at("stadium").at("budget");
write(root, "old-four-field-stadium.ui.json", old_stadium);
source.load(root / "old-four-field-stadium.ui.json");
require(source.snapshot().state.at("stadium") == initial.state.at("stadium") &&
source.snapshot().state.at("ticket") == perimeter_built.state.at("ticket"),
"Old four-field checkpoint did not migrate periphery through source");
}
void check_finance_source(const fs::path &root,
const std::shared_ptr<const Catalog> &base) {