Archived
An independent review of 9cc237f rejected its verification claim: the commit said 18 checks executed the shipped noteSample, triple, acceptTriple, resetWindows and newEngineRun, and the tree contained none of them. The harness was real and passing, but it lived in /tmp, so nobody else could re-run it and the claim was unfalsifiable from the repository. That is a fair rejection regardless of whether the checks were right -- a verification nobody can repeat is a claim about the author's machine. Move both harnesses into tests/js/ and add the extractor they need. The page is one C++ raw string, so a JS test has to pull the script out of the translation unit it ships in; page.js does that, and each test slices the functions it exercises by line range and CALLS them. Both details matter: a retyped copy tests the copy, and a sliced function that is defined but never invoked passes without testing anything, which has already happened once in this code. extremes.test.js, 17 checks: the age clause appears only when an extreme stands alone and is at least a second old, tracks the newest extreme rather than the first, survives a gap with its age, and is gone after a restart along with the extreme itself. poll_spark.test.js, 35 checks: the clamp's floor, ceiling and fallbacks, the in-flight trigger, the old storage key migrating to a flat rate, corrupt storage falling back, the summary label matching what is set, the sparkline's x axis being time-proportional rather than sample index, the right-edge fill at startup, a sample gap drawn as a gap in the line, and the prune loop keeping samples by elapsed time rather than by count. The window expectations derive from the shipped HIST_S, so changing the constant moves them instead of silently passing. Verified: both pass, and both fail when the code is wrong -- setting the age gate to zero fails extremes.test.js, and returning the sparkline to index spacing fails four checks in poll_spark.test.js. dashboard.cpp is unchanged by this commit and dashboard_test still reports 241 checks over 8 cases. Not wired into ctest: they need node, which is not a build dependency here and will not be on a contributor's box or in the ROCm build image. Making a missing optional tool a red build is worse than an opt-in test, so the README says how to run them and when to bother. Found by an independent review pass on the author's own commits. Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
16 lines
743 B
JavaScript
16 lines
743 B
JavaScript
/* Extract the embedded dashboard page's <script> from core/server/dashboard.cpp.
|
|
The page lives inside a C++ raw string, so a JS test has to pull it out of the
|
|
translation unit it ships in. Reading the real file is the point: a copy of the
|
|
page would test the copy. */
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const cpp = fs.readFileSync(
|
|
path.join(__dirname, "..", "..", "core", "server", "dashboard.cpp"),
|
|
"utf8",
|
|
);
|
|
const page = cpp.match(/R"HTML\(([\s\S]*)\)HTML"/);
|
|
if (!page) throw new Error("no R\"HTML(...)HTML\" page block in dashboard.cpp");
|
|
const script = page[1].match(/<script>([\s\S]*)<\/script>/);
|
|
if (!script) throw new Error("no <script> block in the dashboard page");
|
|
module.exports = script[1];
|