Commit Graph

7 Commits

Author SHA1 Message Date
Jonas Bark
e6407714a9 feat(self-test): offer switching the control protocol from the verdict
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 14:16:55 +02:00
Jonas Bark
331b864e15 feat(self-test): verdict CTAs — overlay reveal, mode switch, support hand-off
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 13:11:42 +02:00
Jonas Bark
16038c9ffc fix(self-test): bound headroom loop, ERG-safe skip path, hardened restores
Three ways the engine could strand a rider. The headroom loop spun forever
on a small gear range (maxGear is configurable down to 1) or against a
trainer that refuses to shift, so it now stops when the gear stops moving
and is capped either way. The power-target-less skip path returned before
the phase's finally, so a rider's manual ERG survived into the sweep —
pinning plateau 1 flat — and was then silently dropped by the first
shift; the check moved inside the try, and both ERG helpers now key off
the trainer's actual mode rather than only our own writes. Restores are
individually guarded: a refused gear write can no longer cost the rider
their ERG session, a refused ERG write no longer downgrades a scored run
to aborted, and run() resolves with a result whatever the harness does.

Also: a mid-test upstream dropout now aborts instead of misreporting
NO_CONTROL — prop's notifiers latch their last value, so a dead link used
to read as a trainer that ignores us.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 11:46:16 +02:00
Jonas Bark
631159defd fix(self-test): shift sweep always runs in SIM; rider ERG restored at finish
Restoring a rider's manual ERG target right after the staircase pinned
power flat for the whole shift sweep, so every transition read "no
change" and a healthy trainer verdicted ERG_OK_VS_FAIL. The staircase now
always exits ERG before the sweep, and the rider's own ERG session is put
back at the very end — still gated on the dirty flag, so a run that never
commanded a target (noData, early abort) writes nothing at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 11:20:35 +02:00
Jonas Bark
16ec79793e feat(self-test): SelfTestEngine state machine with verdict matrix
Baseline → ERG staircase → shift sweep on a 500 ms tick, with a cadence
pause watchdog and restore-always semantics: the gear goes back to where
the rider left it and our own ERG writes are undone on pass, fail, cancel
and exception alike. Eight scenarios drive it on a virtual clock through
a fake harness, so no test waits on wall time.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 11:16:32 +02:00
Jonas Bark
f6eab0eead feat(self-test): per-trainer result persistence and FitnessBikeHarness 2026-08-20 10:57:12 +02:00
Jonas Bark
f0c3a74050 feat(self-test): SelfTestResult model with bundle string and json roundtrip 2026-08-20 10:45:35 +02:00