dashboard: fix the pooled ring's property names -- recent/now were NaN, never rendered

Two judge slices (Tasmania 27B, :8101) independently found what the auditor's
pass at 1505ef2 missed: accWindow pushes {ratio, dr, da} but acceptTriple read
d.r/d.a/last.r/last.a -- accPrev's names, a different object. Every pooled sum
was undefined, so the acceptance detail line was frozen at 'highest X% - recent
-' in the PRODUCTION page since 1505ef2. The headline was unaffected, which is
why it looked alive. Fixed to d.dr/d.da/last.dr/last.da.

Also from the judges: the Speculation 'Average' bullet printed 0% for an
undefined lifetime marginal (no drafts yet), breaking the panel's own rule that
0 reads as failure -- now a dash. The comment above it cited a 'GUIDE' that does
not exist; it now cites the README section, which is re-landed here (dropped in
the rebase onto v1.9.0) with the worked example corrected: 56/75/77 implies
43.4% marginal, not the 44% previously claimed.

New test the_pooled_acceptance_ring_reads_the_names_accWindow_writes holds both
sides of the ring contract to the same names -- it fails on the exact bug above,
which no C++ test could see because the page JS is never executed here.

Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
This commit is contained in:
Memoria (Noblistic) authored and StillDeadcode committed 2026-10-21 09:27:48 +02:00
1 parent 7c18d8d1bb
commit 77f91a0240
3 files changed
+59 -5

No files matched your search

+31
View File
@@ -271,6 +271,37 @@ TEST(stats_reports_how_long_bringup_took_once_the_server_listens) {
CHECK_EQ(d.get("/stats").value("startup_s", (int64_t)-1), (int64_t)47);
}
/* The pooled ring's element shape is a contract between two functions in the page, and no
* browser runs here to notice when they disagree. accWindow pushes {ratio, dr, da}; acceptTriple
* iterates the ring as `d` and reads `last`. When a rename left acceptTriple reading accPrev's
* {r, a} instead, the pooled figures became NaN and the detail line froze at "recent -" while
* every C++ test stayed green (Turnstone judge slices 08 and 11, 2026-10-20). So: scan the page
* text and hold the two sides to the same names. */
TEST(the_pooled_acceptance_ring_reads_the_names_accWindow_writes) {
Dash d(false);
const std::string p = d.srv->router().call("GET", "/").body;
const std::string aw = function_body(p, "function accWindow(");
const std::string at = function_body(p, "function acceptTriple(");
REQUIRE(!aw.empty() && !at.empty());
/* what goes INTO the ring */
CHECK(aw.find("dr: dr") != std::string::npos);
CHECK(aw.find("da: da") != std::string::npos);
/* what comes OUT of it: every `d.<field>` and `last.<field>` must be a ring name */
const std::set<std::string> ring = {"dr", "da"};
for (const std::string& n : fields(at, "d")) {
CHECK(ring.count(n) == 1);
if (!ring.count(n))
fprintf(stderr, " acceptTriple reads d.%s, which the ring does not carry\n", n.c_str());
}
for (const std::string& n : fields(at, "last")) {
CHECK(ring.count(n) == 1);
if (!ring.count(n))
fprintf(stderr, " acceptTriple reads last.%s, which the ring does not carry\n", n.c_str());
}
/* and the ring must not be empty by construction: the push is gated on dr > 0 */
CHECK(aw.find("dr <= 0") != std::string::npos);
}
TEST(every_field_the_page_reads_is_one_the_routes_emit) {
Dash d(false);
HttpResponse page = d.srv->router().call("GET", "/");