
 RUN  v5.1.0 /home/athapa/patriothacks-wt/fix-miniapp-gaps-and-demo-video-wave1

 ✓ src/miniapps/waterwatch/fixtureIsolation.test.ts > GECCO fixture test/prod isolation (plan todo 17) > no production file under src/ (outside *.test.*/*.spec.*) references the GECCO fixture 7ms
 × src/miniapps/waterwatch/fixtureIsolation.test.ts > GECCO fixture test/prod isolation (plan todo 17) > the production vite build output (dist/) does not contain the fixture's content 4ms
   → dist/ does not exist - run `npm run build` first so this check exercises the real build artifact.
 ✓ src/miniapps/waterwatch/waterNetwork.test.ts > buildIndex (plan todo 1 - pipe-graph leak localization) > maps every node's sensorId, parent, children and BFS depth for DEFAULT_PIPE_NETWORK 4ms
 ✓ src/miniapps/waterwatch/waterNetwork.test.ts > buildIndex (plan todo 1 - pipe-graph leak localization) > builds a usable index for a small hand-written tree (source->J1->J2->tapC, J1->tapB) 1ms
 ✓ src/miniapps/waterwatch/cusum.test.ts > createChannelCusumGate (plan todo 17/1) > does not fire on the 1st sample (no baseline to deviate from yet) 3ms
 ✓ src/miniapps/waterwatch/cusum.test.ts > createChannelCusumGate (plan todo 17/1) > regression: a flat/stable 2nd reading at warmupSamples:1 must NOT spuriously fire (plan GAP-8 - the exact resident-report gate config from DeviceMonitor.tsx) 0ms
 ✓ src/miniapps/waterwatch/cusum.test.ts > createChannelCusumGate (plan todo 17/1) > a genuine spike still fires at warmupSamples:1 by the 2nd sample 0ms
 ✓ src/miniapps/waterwatch/cusum.test.ts > createChannelCusumGate (plan todo 17/1) > suppresses any detection while inWarmup, regardless of z 0ms
stdout | src/miniapps/waterwatch/gecco.test.ts > CUSUM/EWMA gate replayed on the real bundled GECCO 2018 fixture (plan todo 17) > runs end to end per channel in the documented property-check fallback mode (see comment above)
[todo 17 gecco.test.ts] validation mode: property-check (reason: 0 labeled anomaly windows in the bundled fixture)
[todo 17 gecco.test.ts] channel Tp: 0/1999 false positives on real labeled-clean data (rate 0.0000)
[todo 17 gecco.test.ts] channel Cl: 0/1999 false positives on real labeled-clean data (rate 0.0000)
[todo 17 gecco.test.ts] channel pH: 0/1999 false positives on real labeled-clean data (rate 0.0000)
[todo 17 gecco.test.ts] channel Redox: 0/1999 false positives on real labeled-clean data (rate 0.0000)
[todo 17 gecco.test.ts] channel Leit: 1/1999 false positives on real labeled-clean data (rate 0.0005)
[todo 17 gecco.test.ts] channel Trueb: 3/1999 false positives on real labeled-clean data (rate 0.0015)
[todo 17 gecco.test.ts] channel Cl_2: 0/1999 false positives on real labeled-clean data (rate 0.0000)
[todo 17 gecco.test.ts] channel Fm: 0/1999 false positives on real labeled-clean data (rate 0.0000)
[todo 17 gecco.test.ts] channel Fm_2: 0/1999 false positives on real labeled-clean data (rate 0.0000)

 ✓ src/miniapps/waterwatch/gecco.test.ts > CUSUM/EWMA gate replayed on the real bundled GECCO 2018 fixture (plan todo 17) > loads the real bundled fixture with real rows and confirms it has zero labeled anomaly windows 4ms
 ✓ src/miniapps/waterwatch/gecco.test.ts > CUSUM/EWMA gate replayed on the real bundled GECCO 2018 fixture (plan todo 17) > runs end to end per channel in the documented property-check fallback mode (see comment above) 17ms
 ✓ src/miniapps/waterwatch/ewma.test.ts > createRobustBaseline (plan todo 17/1) > returns z=0 with no real deviation on the very first sample (no baseline yet) 2ms
 ✓ src/miniapps/waterwatch/ewma.test.ts > createRobustBaseline (plan todo 17/1) > regression: a flat/stable 2nd reading must NOT produce a wildly inflated z (plan GAP-8 - was dividing by the minMad floor, producing z ~ 5e8) 0ms
 ✓ src/miniapps/waterwatch/ewma.test.ts > createRobustBaseline (plan todo 17/1) > still produces a large, clearly-anomalous z on the 2nd sample for a genuine spike 0ms
 ✓ src/miniapps/waterwatch/ewma.test.ts > createRobustBaseline (plan todo 17/1) > seeds mad with a real (non-floor) scale by the time the 2nd sample's z is computed 0ms
 ✓ src/miniapps/waterwatch/ewma.test.ts > createRobustBaseline (plan todo 17/1) > falls back to the minMad floor for a channel that genuinely starts at exactly 0 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > replayWaterWatchController (plan todo 2, QA happy path - settled reading survives reload) > rebuilds a fully-settled "alert" channel purely from replaying two corroborating sensors' raw reports 4ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > replayWaterWatchController (plan todo 2, QA failure path - mid-corroboration-window pending reading survives reload) > rebuilds a still-pending "corroborating" channel from a single sensor's raw report that never reached settlement - not just a fully-corroborated reading 1ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > replayWaterWatchController (plan todo 2, QA failure path - mid-corroboration-window pending reading survives reload) > never promotes a pending candidate to "alert" on replay just because no second sensor ever corroborated it 1ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > replayWaterWatchController (adversarial - stale_state / double-apply) > ignores settlement-only events (seed.resource.water, fairshare.allocation.cycle) when extracting raw reports 1ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > replayWaterWatchController (adversarial - stale_state / double-apply) > re-running replay from the same entries twice (simulating two renders of a React useMemo) produces byte-identical state, never a double-applied reading 1ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > replayWaterWatchController (adversarial - stale_state / double-apply) > replays entries out of insertion order correctly via deterministic Lamport ordering 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > replayWaterWatchController (never calls append - replay is read-only) > accepts no append/appendFn parameter at all - its signature makes a write path unreachable from replay 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > localizeAnomaly (plan todo 1 - pipe-graph leak localization) > folds two corroborating sensors' nodes through their lowest common ancestor (worked example: J1) 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > localizeAnomaly (plan todo 1 - pipe-graph leak localization) > reports a single detecting sensor as a low-confidence corridor candidate at its own node 1ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > localizeAnomaly (plan todo 1 - pipe-graph leak localization) > never throws on an unmapped/garbage sensorId - returns an explicit unmapped result instead 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > localizeAnomaly (plan todo 1 - pipe-graph leak localization) > drops an unmapped sensorId from a corroborating pair but still localizes off the mapped one 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > localizeAnomaly (plan todo 1 - pipe-graph leak localization) > returns an explicit, non-throwing unmapped result when every detecting sensorId is garbage 1ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > arrivalCountdowns (plan todo 1 - per-tap arrival-time countdown) > converts travel time from the origin into a finite ETA for every downstream tap (15s worked example) 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > arrivalCountdowns (plan todo 1 - per-tap arrival-time countdown) > excludes/marks Infinity for a tap that is not downstream of the origin 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > arrivalCountdowns (plan todo 1 - per-tap arrival-time countdown) > sorts reachable taps soonest-arrival first, with unreachable taps sorted last 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > arrivalCountdowns (plan todo 1 - per-tap arrival-time countdown) > reflects elapsed time since the alert when nowMs is later than alertTimestampMs 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > arrivalCountdowns (plan todo 1 - per-tap arrival-time countdown) > never throws and marks every tap unreachable for an origin node absent from the network 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > ChannelStatus localization/countdowns (plan todo 1 - populated by ingest when a network is present) > leaves localization/countdowns undefined for a "clean" reading even with a network present 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > ChannelStatus localization/countdowns (plan todo 1 - populated by ingest when a network is present) > populates a low-confidence corridor localization for a "corroborating" reading from the one detecting sensorId 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > ChannelStatus localization/countdowns (plan todo 1 - populated by ingest when a network is present) > populates a high-confidence pinpoint localization + countdowns for an "alert" reading from both corroborating sensorIds 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > ChannelStatus localization/countdowns (plan todo 1 - populated by ingest when a network is present) > stays undefined when no network is supplied, even for an alert reading (opt-in, never invented) 0ms
 ✓ src/miniapps/waterwatch/waterWatchController.test.ts > localization/countdowns survive a cold replay (adversarial - stale_state) > rebuilds the exact same pinpoint localization + reachable countdowns on replay as it had live 1ms
 ✓ src/miniapps/waterwatch/corroboration.test.ts > multi-sensor corroboration gate (plan todo 17, QA happy path) > fires only once a second independent sensor corroborates within the window, and the corroborated reading is the only one that reaches ma-fairshare's water resource 61ms
 ✓ src/miniapps/waterwatch/corroboration.test.ts > multi-sensor corroboration gate (plan todo 17, QA failure path - uncorroborated) > does NOT fire, and no reading reaches ma-fairshare's engine, for a single uncorroborated anomalous reading 3ms
 ✓ src/miniapps/waterwatch/corroboration.test.ts > multi-sensor corroboration gate (plan todo 17, QA failure path - uncorroborated) > does NOT corroborate two candidates on the same channel outside the corroboration window 2ms
 ✓ src/miniapps/waterwatch/corroboration.test.ts > two-sided CUSUM mechanism sensitivity (synthetic property test, NOT GECCO validation data) > fires when a sustained synthetic drift is injected into an otherwise-stable channel 2ms
 ✓ src/miniapps/waterwatch/corroboration.test.ts > two-sided CUSUM mechanism sensitivity (synthetic property test, NOT GECCO validation data) > does not fire on pure stable noise with no sustained drift 2ms
 ✓ src/miniapps/waterwatch/DeviceMonitor.test.tsx > DeviceMonitor (plan todo 18, QA happy path) > transitions the status light clean -> corroborating -> alert in exact step with the real corroboration gate, for two independent sensors corroborating the same spike 35ms
 ✓ src/miniapps/waterwatch/DeviceMonitor.test.tsx > DeviceMonitor (plan todo 18, QA failure path - uncorroborated) > never shows an alert status light for a single, never-corroborated candidate reading 13ms
 ✓ src/miniapps/waterwatch/ReportReadingForm.test.tsx > ReportReadingForm (plan todo 19 gap-closing UI) > drives a reading through the real controller/gate on real submit, never a direct ingest call from the test 144ms
 ✓ src/miniapps/waterwatch/ReportReadingForm.test.tsx > ReportReadingForm (plan todo 19 gap-closing UI) > does not double-count a reading when the submit button is clicked twice synchronously 16ms
 ✓ src/miniapps/waterwatch/ReportReadingForm.test.tsx > ReportReadingForm (plan todo 19 gap-closing UI) > rejects an empty device/sensor ID without appending anything to the real Event Log 25ms
 ✓ src/miniapps/waterwatch/coreLoopHonestyAnchor.test.tsx > Core-loop honesty-anchor integration (plan todo 19, QA happy path) > drives a real resident report through the real UI input all the way to a re-solved Fair Share allocation and an updated trend chart, with every intermediate artifact real 674ms
 ✓ src/miniapps/waterwatch/coreLoopHonestyAnchor.test.tsx > Core-loop honesty-anchor integration (plan todo 19, QA failure path - halts at the gate) > halts exactly at todo 17's gate for a single uncorroborated reading: no credit event, no re-solve, no Fair Share UI change 185ms

⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯

 FAIL  src/miniapps/waterwatch/fixtureIsolation.test.ts > GECCO fixture test/prod isolation (plan todo 17) > the production vite build output (dist/) does not contain the fixture's content
Error: dist/ does not exist - run `npm run build` first so this check exercises the real build artifact.
 ❯ src/miniapps/waterwatch/fixtureIsolation.test.ts:40:13
     38|   it("the production vite build output (dist/) does not contain the fi…
     39|     if (!existsSync(DIST_DIR)) {
     40|       throw new Error(
       |             ^
     41|         "dist/ does not exist - run `npm run build` first so this chec…
     42|       );

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯


 Test Files  1 failed | 9 passed (10)
      Tests  1 failed | 48 passed (49)
   Start at  14:28:00
   Duration  1.68s (tests 38%, environment 24%, import 17%, transform 10%, setup 9%, worker 2%)

