Archived
tests/js: drive poll()'s restart decision, and the two clauses nothing reached
An adversarial pass mutated this leg of the dashboard and found three mutants that survived every committed check. All three were real gaps in my verification, and the reason was the same each time: the tests called the helper directly, so the code that DECIDES whether to call it was never exercised, and two clauses sat behind a guard that no test ever opened. Drive poll() itself. A scripted /stats sequence and a fixed clock, with resetWindows, newEngineRun and update replaced by counters, so the assertions are about what poll() decided rather than what the helper does once called. Three cases: the first poll is a baseline and clears nothing, a changed started_at clears, and a long quiet span takes the gap path without being read as a restart -- the distinction the previous commit exists to make. Re-sample a key after its extreme is set. The stamp records when the extreme was set, so a worse sample must not refresh it; nothing used to sample the same key twice, so moving the stamp to every sample -- which makes every age read about zero, wrong output rather than missing output -- passed unnoticed. Exercise acceptTriple with a live extreme. Its only previous call came from the restart case, which clears extAt first, so it returned at its guard before reaching the age clause: the clause was asserted zero times while triple's was asserted seven. Use the shipped pctn rather than a re-typed one. The copy diverged from the real formatter for small and non-finite values; nothing asserted on that output today, so it was a latent trap rather than a live error. Pass the sampled value as a parameter instead of interpolating it into the function source, so the null case is a real null and not the string "null". Verified by mutation, which is the only thing that makes a green suite mean anything here: disabling poll()'s detection line fails the suite, as does moving the stamp to every sample, as does deadening acceptTriple's clause, as does removing the uptime comparison added in the previous commit. extremes.test.js 27 checks, poll_spark.test.js 35, dashboard_test 241 over 8 cases, sched_test 62646 over 184, no failures. Found by an adversarial review pass on the author's own commits. Authored at: Memoria Qwen 3.8 Flash-Next 125B MoE (level not visible) via Open WebUI
This commit is contained in:
1 parent
4d8be7099d
commit
638aa3a683
2 files changed
+113
-20
No files matched your search
@@ -85,7 +85,9 @@ console.log("== the prune is the SHIPPED setMetric, actually called ==");
|
||||
function shippedPrune(seed, nowSVal, value) {
|
||||
const Mm = { m: { n: { firstChild: { nodeValue: "" } }, line: { setAttribute: () => {} } } };
|
||||
const hh = { m: seed.slice() };
|
||||
new Function("M", "hist", "nowS", "spark", "HIST_S", SETMETRIC + "\nsetMetric('m', " + value + ", 'x');\nreturn hist;")(Mm, hh, nowSVal, () => {}, HS);
|
||||
/* v is passed as a parameter, not interpolated into the source: interpolating the string
|
||||
"null" and the literal null produce the same text, so the null case would not be null. */
|
||||
new Function("M", "hist", "nowS", "spark", "HIST_S", "v", SETMETRIC + "\nsetMetric('m', v, 'x');\nreturn hist;")(Mm, hh, nowSVal, () => {}, HS, value);
|
||||
return hh.m;
|
||||
}
|
||||
let fast = []; for (let i = 0; i < 600; i++) fast.push({ t: i * 0.1, v: 1 });
|
||||
@@ -99,7 +101,7 @@ eq(r[0].t, 3000 - HS, "the oldest survivor is the first sample inside the window
|
||||
let edge = []; for (let i = 0; i < 5; i++) edge.push({ t: 1000 + i, v: 1 });
|
||||
eq(shippedPrune(edge, 1000 + HS, 1).length, 6, "a sample exactly at nowS-HIST_S survives (exclusive <)");
|
||||
eq(shippedPrune(edge, 1001 + HS, 1).length, 5, "one second later that same sample is pruned");
|
||||
r = shippedPrune([{ t: 10, v: 1 }], 1005, "null");
|
||||
r = shippedPrune([{ t: 10, v: 1 }], 1005, null);
|
||||
eq(r.length, 1, "a null reading records nothing and prunes nothing");
|
||||
eq(r[0].t, 10, "the earlier sample is untouched");
|
||||
console.log(fails ? "\n" + fails + " FAILURE(S) of " + checks : "\nALL " + checks + " CHECKS PASS on the shipped page JS");
|
||||
|
||||
Reference in new issue
Block a user