Skip to content

Commit df1f0c1

Browse files
authored
smoke: derive the phase-goal verdict from run data, not the run-id prefix (#36)
The viewer smoke test pinned every phase2-* run to a '2 / 3 MISS' goal banner and every phase1-* run to '3 / 3 MEETS GOAL'. Those were true of the July runs (SAC's ingest p99 missed the 405 ms Phase 2 goal), but the gate is run by scripts/ingest.sh --push-main against every committed run, so the first Phase 2 run that cleared the goal on all three profiles (phase2-500ledgers-8x-query-d77cc53c-20260826T211822Z, stellar-rpc run 33002437931) failed the gate and was never committed or pushed. Compute the expected count and verdict from the run JSON the same way docs/app.js and docs/summary.js do (hot ingest_total p99 median vs the paced phase's ingest_p99_target_ns), and assert the banner matches. The check now also covers phase runs whose id lacks the phaseN- prefix. The per-run SAC p99 figures for the two July Phase 2 runs stay pinned.
1 parent 5958e2b commit df1f0c1

1 file changed

Lines changed: 40 additions & 12 deletions

File tree

tests/smoke/smoke.mjs

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,34 @@ function checkKind(kind, doc, group, data) {
123123
check(group, "all phases in fig42 table", /extract/.test(f42) && /commit \(fsync\)/.test(f42) && /apply/.test(f42), f42.slice(0, 160));
124124
}
125125

126+
/* Expected phase-goal verdict, derived from the run data the same way the
127+
viewer derives it (docs/app.js + docs/summary.js): count the units whose
128+
hot ingest_total p99 median is within the paced phase's ingest_p99_target_ns.
129+
Returns null when the run carries no phase or no goal, so callers skip the
130+
check rather than pin a verdict that the data does not define. */
131+
function expectedGoal(D) {
132+
const camp = D && D.campaign;
133+
if (!camp || camp.phase == null || !Array.isArray(camp.phase_targets)) return null;
134+
const sel = camp.phase_targets.find(p => p.phase === camp.phase);
135+
const goalNs = sel && sel.ingest_p99_target_ns;
136+
if (!goalNs) return null;
137+
const hot = D.ingest_hot || {};
138+
const units = Object.keys(hot).filter(u => hot[u].driver && hot[u].driver.ingest_total && hot[u].driver.ingest_total.p99);
139+
if (!units.length) return null;
140+
const pass = units.filter(u => hot[u].driver.ingest_total.p99.m <= goalNs).length;
141+
return { pass, n: units.length, met: pass === units.length, goalNs };
142+
}
143+
144+
/* Assert a goal banner's headline matches the verdict the run data implies:
145+
"<pass> / <n>" plus MEETS GOAL when every unit clears the goal, else MISS. */
146+
function checkGoalBanner(group, bannerTxt, g, what) {
147+
const want = g.met ? "MEETS GOAL" : "MISS";
148+
const other = g.met ? "MISS" : "MEETS GOAL";
149+
check(group, `${what}: ${g.pass} / ${g.n} ${want} (from run data)`,
150+
new RegExp(`${g.pass} / ${g.n}`).test(bannerTxt) && new RegExp(want).test(bannerTxt) && !new RegExp(other).test(bannerTxt),
151+
bannerTxt.slice(0, 140));
152+
}
153+
126154
function checkSanity(kind, doc, group, D) {
127155
const report = doc.getElementById("report");
128156
// Synthetic wraps its two verdict banners (phase goal + block model) in a
@@ -145,12 +173,11 @@ function checkSanity(kind, doc, group, D) {
145173
// per-run blocks below pin the actual state for each committed run.
146174
check(group, "banner shows both goal + keep-up verdicts",
147175
/(MEETS GOAL|MISS)/.test(banner) && /(KEEPS UP|OVER INTERVAL)/.test(banner), banner.slice(0, 140));
148-
if (group.startsWith("phase2-")) {
149-
// SAC's ~604 ms ingest p99 misses the 405 ms Phase 2 goal: the headline
150-
// must read 2 / 3 with a MISS, not an all-clear 3 / 3.
151-
check(group, "phase 2 headline is 2 / 3 MISS (not all-clear)",
152-
/2 \/ 3/.test(banner) && /MISS/.test(banner) && !/MEETS GOAL/.test(banner), banner.slice(0, 140));
153-
}
176+
// The headline count and verdict follow from the data, not from the run's
177+
// phase: a Phase 2 run may miss on SAC (the 2026-07 runs) or clear all
178+
// three profiles (the 2026-08 runs), and both must pass this gate.
179+
const g = expectedGoal(D);
180+
if (g) checkGoalBanner(group, banner, g, `phase ${phase} headline`);
154181
} else {
155182
check(group, "banner 3 / 3 KEEPS UP", /3 \/ 3/.test(banner) && /KEEPS UP/.test(banner), banner.slice(0, 60));
156183
}
@@ -448,19 +475,20 @@ for (const run of manifest.runs) {
448475
const meta = txt(doc.getElementById("machine-metadata"));
449476
check(group, "machine metadata block filled", meta.length > 100, meta.length + " chars");
450477
// Per-run sanity values.
478+
// The goal banner's count and verdict follow from the run data (see
479+
// expectedGoal); the run id only selects the fixed target and per-run figures.
480+
const g = expectedGoal(runJSON(run.id));
481+
if (g) checkGoalBanner(group, bannerTxt, g, `phase ${phNo} banner`);
451482
if (run.id.startsWith("phase2-")) {
452483
check(group, "Phase 2 ingestion target derived (405 ms)", /405 ms/.test(phTbl), phTbl.slice(0, 200));
453-
check(group, "phase 2 banner: 2 / 3 with a MISS (SAC over 405 ms)", /2 \/ 3/.test(bannerTxt) && /MISS/.test(bannerTxt), bannerTxt.slice(0, 140));
454-
// SAC's p99 is a per-box number, not a per-phase one — both Phase 2 runs miss
455-
// the 405 ms goal, but at 604 ms on the m6id.2xlarge and 456 ms on the faster
456-
// c6id.8xlarge. Key each figure to its own run id.
484+
// SAC's p99 is a per-box number, not a per-phase one — the two 2026-07 Phase 2
485+
// runs miss the 405 ms goal, at 604 ms on the m6id.2xlarge and 456 ms on the
486+
// faster c6id.8xlarge. Key each figure to its own run id.
457487
if (run.id === "phase2-m6id2xl-c48a55c6-20260723T035541Z") {
458488
check(group, "SAC p99 ≈ 604 ms surfaced", /60[34](\.\d)? ms/.test(text), text.slice(0, 120));
459489
} else if (run.id === "phase2-c6id8xl-c48a55c6-20260724T000724Z") {
460490
check(group, "SAC p99 ≈ 456 ms surfaced", /45[56](\.\d)? ms/.test(text), text.slice(0, 120));
461491
}
462-
} else if (run.id.startsWith("phase1-")) {
463-
check(group, "phase 1 banner: 3 / 3 MEETS GOAL", /3 \/ 3/.test(bannerTxt) && /MEETS GOAL/.test(bannerTxt), bannerTxt.slice(0, 140));
464492
}
465493
window.close();
466494
}

0 commit comments

Comments
 (0)