@@ -123,6 +123,34 @@ function checkKind(kind, doc, group, data) {
123123 check ( group , "all phases in fig42 table" , / e x t r a c t / . test ( f42 ) && / c o m m i t \( f s y n c \) / . test ( f42 ) && / a p p l y / . 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+
126154function 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 / ( M E E T S G O A L | M I S S ) / . test ( banner ) && / ( K E E P S U P | O V E R I N T E R V A L ) / . 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 ) && / M I S S / . test ( banner ) && ! / M E E T S G O A L / . 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 ) && / K E E P S U P / . 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)" , / 4 0 5 m s / . 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 ) && / M I S S / . 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" , / 6 0 [ 3 4 ] ( \. \d ) ? m s / . test ( text ) , text . slice ( 0 , 120 ) ) ;
459489 } else if ( run . id === "phase2-c6id8xl-c48a55c6-20260724T000724Z" ) {
460490 check ( group , "SAC p99 ≈ 456 ms surfaced" , / 4 5 [ 5 6 ] ( \. \d ) ? m s / . 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 ) && / M E E T S G O A L / . test ( bannerTxt ) , bannerTxt . slice ( 0 , 140 ) ) ;
464492 }
465493 window . close ( ) ;
466494}
0 commit comments