Repository navigation
feat(power-loss): power-loss autostop core — MCP V1 signal, pure policy, engine seam (#1392) - #1401
9thLevelSoftware wants to merge 32 commits into
Conversation
…cy, engine seam (#1392) Phase 1 of the signed-off power-loss autostop enhancement (issue #1392): - domain/powerloss: validated pre-EMA paired control samples, MCP V1 signal (9.81/1000 x sum(load x max(v,0)) sample mean, idle cable zero, no cross-cable substitution), quality reasons, ordered accumulator, and a finite-state concentric phase normalizer (P1) - pure PowerLossPolicy reducer with the signoff SD1-SD4 semantics: frozen reference-at-decision facts, unrounded threshold equality, trusted short-ROM qualification surviving missing power, SHORT_ROM-over-POWER_LOSS tie-break with both facts persisted, unknown-ROM no reference promotion, earliest-tie reference retention, ordinal-adjacency streak breaks, cap independence (P2) - ExecutionTargetPlan + protocol byte-bound validator + capability gate; REP identity preserved (nominal never stops POWER early; unlimited stays unlimited) (P2/SD4) - SetEndReason + MAX_REPS_BACKSTOP / POWER_LOSS / SHORT_ROM (P3, persisted names; unknown still maps to UNKNOWN) - engine seam: per-set PowerLossSetController, POWER-only VBT auto-end and voice/defer suppression, once-per-set near-limit cue, non-blocking stop path (P3/SD5). Inert by default (REP_TARGET) behind the capability gate. Tests: PowerLossPolicyTest (signoff 4.1 fixture matrix), PowerLossAcquisitionTest, ExecutionTargetPlanTest, SetEndReasonTest updated for the new persisted reasons.
…OM bound (#1392) - Add POWER_NEAR_LIMIT arms to the iOS and Android haptic/audio routers (exhaustive-when requirement); reuse existing beepboop asset, distinct medium-pulse haptic patterns per platform. - SHORT_ROM_FRACTION as Double so the 85%-of-reference-ROM bound compares in double precision (Float 0.85f x 200 misclassifies an exact-equality 170mm ROM as short). - Test names: Kotlin/Native forbids commas/parens in backtick names. Verified: :shared:iosSimulatorArm64Test --tests powerloss.* + SetEndReasonTest = 61 tests, 0 failures (SetEndReasonTest 5, ExecutionTargetPlanTest 10, PowerLossAcquisitionTest 14, PowerLossPolicyTest 32).
PowerLossSetEvidence/PowerLossAttemptRecord/PowerLossHudState/ PowerLossSetSummaryFacts + WorkoutExitSnapshot.powerLossEvidence + evidence-aware commitCompletedSet overloads + ExerciseConfig.powerLoss. Pure contract only: no behavior change, legacy paths unchanged.
…y view layer (#1392) PowerLossUiCopy (SD6 copy incl. headline clarification + nonbreaking presets), PowerLossConfigDraft (5-40 validation, caution 36-40, max-reps bound, two-consecutive SD1 helper), PowerLossHudUi/PowerLossSummaryUi/PowerLossHistoryUi state renderers, PowerLossExportUi entry, PowerLossConfigPropagation, PowerLossUiFacts adapter. Tests: config draft, HUD/summary/history state, export + copy guards.
…ce commit (#1392) Set/observation companion tables (migration 64, additive, API-26 safe), PowerLossCompanionStore codec (null-vs-zero preserved), evidence-aware commitCompletedSet(WithCompletion) overrides committing companions in the same transaction, powerLossEvidenceForSession reads. Schema parity + migration + upgrade tests green.
Rep target | Power-loss target toggle on PowerLossConfigDraftState; presets 10/20/30/Custom with SD6 nonbreaking labels; custom 5-40 validation and 36-40 caution; Max working reps with dynamic SD4 bound; two-consecutive switch with SD1 helper copy; Echo concentric-only note; near-limit cue readback; local-data disclosure. Apply commits atomically to ExerciseConfig.powerLoss; Cancel discards the draft.
…1392 P5) Renders 'Power-loss target · 20%' / 'Max 20 working reps' readback and the completed-vs-attempt identity line from PowerLossHudUi on the Execution page. The parallel engine 'powerLossHud' StateFlow is not in this tree, so facts come through the PowerLossUiFacts adapter (inert until wired).
… Koin + roundtrip test) (#1392)
PowerLossSummaryUi projection: 'Stopped at rep 9 — 21% power loss (best: rep 2)' renders ONLY with the adjacent SD6 clarification '8 completed reps · lifting attempt 9'; config line, help, saved-reps readbacks and local-data disclosure. Facts come via PowerLossUiFacts.summaryFacts (WorkoutState.SetSummary.powerLoss added by the parallel packet); null renders no block for REP sets.
RepDetailsSection renders PowerLossHistoryUi compact core rows per set (header line, per-attempt coreLine rows, trigger-only row, local-data disclosure) from PowerLossSetEvidence via powerLossHistorySet. Optional powerLossEvidence param keeps the legacy section byte-for-byte until the persistence packet threads evidence from the history store.
…normalization, live HUD (#1392) PowerLossSetController: ordered attempt records, immutable winner latch (SD2 both-facts), buildEvidence/buildSummaryFacts/hudState; engine: finite POWER WORKOUT_COMPLETE -> MAX_REPS_BACKSTOP (SD4), pre-teardown WorkoutExitSnapshot.powerLossEvidence + SetSummary.powerLoss capture, live powerLossHud StateFlow with committed Ending set... state (SD6); no stop-path waits (SD5 unchanged). Latch tests green (8 fixtures).
Test evidence — head
|
| Suite | Tests | Failures |
|---|---|---|
PowerLossPolicyTest |
32 | 0 |
PowerLossConfigDraftTest |
17 | 0 |
PowerLossAcquisitionTest |
14 | 0 |
PowerLossHudUiStateTest |
12 | 0 |
ExecutionTargetPlanTest |
10 | 0 |
PowerLossHistoryUiStateTest |
9 | 0 |
PowerLossSummaryUiStateTest |
9 | 0 |
PowerLossSetEvidenceLatchTest |
8 | 0 |
PowerLossExportAndCopyGuardTest |
7 | 0 |
SetEndReasonTest |
5 | 0 |
| Total | 123 | 0 |
P4 data-layer suites — :shared:testAndroidHostTest — BUILD SUCCESSFUL (3m 21s)
| Suite | Tests | Failures |
|---|---|---|
SchemaParityTest (fresh/upgrade/fallback parity incl. migration 64) |
35 | 0 |
IntervalsMigrationTest |
8 | 0 |
PowerHistoryExportRoundtripTest (export v1 null-vs-zero roundtrip) |
1 | 0 |
Android109UpgradeTest |
1 | 0 |
| Total | 45 | 0 |
validateSchemaManifest green at this head: 812 columns across 68 tables, all covered; column order matches SchemaManifest.
Regression status
Phase-1 A/B at 3d6f1e45 (recorded in PR body) proved zero regressions vs baseline main@4d4de558 (identical 1105 tests / identical 14 pre-existing failures, name-for-name). The 13 commits added since (547dcb95…620dc71b, P3/P4/P5) extend the evidence with the suites above; a full-suite sweep at the merged head is run before the merge gate and its result will be appended here.
Remaining before merge gate: P3 remainder (single-target propagation + production race tests), P4 remainder (backup v7 sections, versioned routine CSV / lossy-export block, runtime snapshot codec, golden no-new-wire-keys test), P5 remainder (bottom-sheet/JustLift/set-ready surfaces + propagation), P6 hardening, P7 implementation-branch visual QA (merge gate), P8 trainer evidence (release gate; feature stays off by default).
…1392) Pins the exact serialized wire path set of sessions + rep telemetry (55 paths, pre-feature contract captured on this branch whose data/sync chain is byte-identical to main@4d4de558), asserts no power-loss identifiers reach the wire, and guards the legacy powerWatts = avgPowerWatts mapping. Covers signoff acceptance gate 4 'golden push payload contains no new wire keys'.
|
Full-suite A/B at merged head |
…ss-autostop # Conflicts: # shared/src/commonMain/kotlin/com/devil/phoenixproject/di/DataModule.kt # shared/src/phoneMain/kotlin/com/devil/phoenixproject/presentation/screen/HistoryTab.kt # shared/src/phoneMain/kotlin/com/devil/phoenixproject/presentation/screen/SetSummaryCard.kt
…65 (#1392) migration 64 added by this branch raises the schema head to 65; the persisted-file upgrade harness default and both QA guides must name the current head (PersistedFileUpgradeHarnessContractTest).
PR follow-up (CI/comments hardening) — head
|
…ss-autostop # Conflicts: # shared/src/androidHostTest/kotlin/com/devil/phoenixproject/data/local/Android109UpgradeTest.kt # shared/src/androidHostTest/kotlin/com/devil/phoenixproject/data/local/IntervalsMigrationTest.kt # shared/src/commonMain/kotlin/com/devil/phoenixproject/data/local/MigrationStatements.kt # shared/src/commonMain/kotlin/com/devil/phoenixproject/presentation/manager/WorkoutExitSnapshot.kt # shared/src/commonMain/sqldelight/com/devil/phoenixproject/database/migrations/64.sqm # shared/src/commonMain/sqldelight/com/devil/phoenixproject/database/migrations/65.sqm
Implementation continuation — P3/P4/P5 remainders landed; CI green at
|
P7 visual QA progress — implementation branch head
|
|
P7 visual QA — iteration 4 (iOS power-loss config matrix). Progress only; the merge gate stays held. New implementation-branch captures (head 6cc4688, real UI via headless XCUITest + simulator screenshots, no hardware), uploaded to release tag
Remaining P7 matrix: the high-threshold caution visual state (the >35 caution block; its label is present in the accessibility tree but did not render in any captured frame — likely below the pinned footer at capture time), the 2-consecutive ON state (switch tap did not toggle in the driver), extended E01–E12 live HUD/summary/history states (Phantom BLE machine simulation), accessibility focus shots, per-platform full-set flow videos, and iOS 200% text / small-viewport variants. P8 physical-trainer evidence remains the release gate (owner evidence policy 2026-11-17: simulator/emulator evidence suffices; the feature stays off-by-default behind the capability gate). CI at head 6cc4688 remains fully green and the PR is MERGEABLE. 45 implementation-branch frames are now in |
|
P7 visual QA — iteration 5 (caution state, 2-consecutive ON, 200% text + narrow viewport). Progress only; the merge gate stays held. New implementation-branch captures (head 6cc4688, real UI via headless XCUITest + simulator screenshots, no hardware), uploaded to release tag
Driver fixes this iteration (capture-only, scratch checkout; excluded from the PR branch): multi-strategy switch toggling with helper-copy verification (element tap worked where coordinate taps no-op'd), measured single drags for below-keyboard content, and first-launch EULA pre-seeding via Remaining P7 matrix: extended E01–E12 live HUD/summary/history states (Phantom BLE machine simulation — CI at head 6cc4688 remains fully green and the PR is MERGEABLE. |
#1392) The engine published PowerLossHudState per scored rep but no caller passed it to WorkoutHud, so the signed-off ui-spec §4 power panel never rendered during a real set. Thread the state through MainViewModel -> WorkoutUiState -> WorkoutTab -> WorkoutHud and extend PowerLossHudState with the projection facts the signed-off copy requires: latest/best MCP watts, the two-consecutive qualifying streak, and the initial-ROM uncertainty flag (SD6). Warm-up identity comes from the separate warm-up rep counter. Adds PowerLossHudWattsAndStreakWiringTest.
…adout (#1392) PowerLossHudReadout rendered only the target/cap/locked/completed lines; the signed-off §4 panel layout was missing its power facts: the Power loss label, the primary loss percentage with status text, Latest lifting power, Best: rep N and the Target/cue threshold line, plus the conditional invalid-power, last- valid, short-ROM, warm-up and Ending set lines. All values come from the tested PowerLossHudUi projection — missing data stays '—' with a reason (SD6).
|
P7 visual QA — iteration 6 (live-set states + two P5 gap fixes on the branch). Progress only; the merge gate stays held. Two implementation gaps found by the live-set QA, fixed on this branchDriving a real set through the simulator exposed that the signed-off ui-spec §4/§6 live states could not render at all — not a capture problem but two P5 wiring gaps:
Both fixes are minimal production changes in scope of the signoff-approved spec; full Live-set captures (13 new frames in
|
…ble (#1392) The set-summary power-loss block never rendered in a real set: the engine freezes `PowerLossSetSummaryFacts` into `WorkoutState.SetSummary.powerLoss` (P3), but `SetSummaryCard` only read its `powerLossFacts` param, which every call site left null. The P7 live-set video confirmed the signed-off `Stopped at rep 9 — 21% power loss (best: rep 2)` headline and the per-attempt `Power details` table were absent from the summary. - Feed the block from `WorkoutState.SetSummary.powerLoss` when no explicit `powerLossFacts` override is passed (the param stays a test seam). - Render the per-attempt MCP table (F06) behind a `Power details` expandable: one compact `coreLine` row per working attempt with text badges, each row expanding to its reference-at-decision / ROM / con-ecc detail pairs. - Carry `savedNominalReps` on the frozen facts so the SD6 `Saved reps: 12` readback derives from the set-time config (null renders `—`, never fabricated). New `PowerLossSummaryFactsWiringTest` pins the controller→facts→summary-UI chain (headline + adjacent SD6 clarification + table rows) so the block can never render empty while facts are present.
|
P7 visual QA — iteration 7 (summary block gap found + fixed on the branch). Progress only; the merge gate stays held. A third P5 gap found by the live-set video, fixed on this branchRecording the full-set flow revealed the signed-off set-summary power-loss block never rendered — the same class of wiring gap as iteration 6's HUD fixes. The engine freezes
Summary capture (from the real implementation UI at head
|
The ui-spec section-4 'Initial ROM/mask uncertain' state never rendered: powerLossHudUi accepted referenceRomUncertain but dropped it, so 'Initial movement reference limited' and its range-checks caveat could not appear even though the controller computes the fact and WorkoutHud passes it. Slot the caveat into the status priority (below near-limit warnings, above the generic first-attempt/below-target states), render the persistent note line in the HUD readout, and pin the state and its precedence in PowerLossHudUiStateTest.
|
P7 visual QA — iteration 8 (a fourth P5 gap found + fixed; the three open scenario fixtures captured). Progress only; the merge gate stays held. Why the scenario captures kept coming up empty (harness, not product)The "flaky scripted triggers" of iterations 6–7 were a harness defect: the config-sheet arming helper's button geometry heuristic matched 0 buttons whenever the sheet's scroll position left the A fourth P5 gap found on the branch: the E04 uncertain-reference state never rendered
Scenario fixtures captured (real implementation UI, scripted Phantom machine stream)
Screen readers / platform evidence
CI + verificationAll required checks GREEN at Remaining P7 matrix
|
Field QA on the implementation branch saw set 1's frozen power panel (Working attempt 20 / Ending set...) render under the next set's headers after a max-reps backstop completion: WorkoutCoordinator._powerLossHud was written per rep but never cleared at the set boundary. - installBiomechanicsContext: a new set's context install starts its HUD clean (SD6 set-boundary rule), covering every start path. - resetBiomechanicsContext: the frozen panel ends with the set's teardown (completion/manual-stop paths), identity-guarded so a late teardown can never wipe a newer set's live HUD. PowerLossHudSetBoundaryResetTest pins the production-path reset at teardown and at the next set's install, plus the SD6 non-regression that the committed Ending set... state stays visible through the stop-to- completed window.
…nce (#1392) P7 field QA caught the max-reps summary card silently degrading to the MANUAL variant: when the machine-counter completion (SD4 WORKOUT_COMPLETE -> handleSetCompletion(MAX_REPS_BACKSTOP)) claims the one-winner latch before the final rep's metric evaluation can latch the policy winner, buildSummaryFacts saw winnerReason=null and dropped the signed-off 'Stopped at 20 working reps - max-reps limit' headline and its SD6 clarification. - buildSummaryFacts/buildEvidence accept the committed completion reason as a fallback winner (with the cap attempt as trigger of record) ONLY when the SD2 policy latch is empty; the latched winner is never overwritten and non-power end reasons never forge a power winner. - SetEndReason.toPowerStopReasonOrNull maps only the power vocabulary. PowerLossSummaryWinnerFallbackTest pins the headline/clarification, the SD2 latch precedence, the manual/safety null-headline regression, and evidence parity; PowerLossHudSetBoundaryResetTest pins the engine->SetSummary wiring on the production cap path.
|
P7 visual QA — iteration 9 (two more P5-class gaps found + fixed: set-boundary HUD reset + cap-summary committed winner; the missing cap summary fixture captured). Gap 5 (fixed in
|
|
P7 visual QA — iteration 10: the iOS VoiceOver focus-shot matrix is captured (iter9's The blocker: the iter9 next-step needed one more discoveryThe documented follow-up (
The working arming path (verified on xcrun simctl spawn <udid> defaults write /var/mobile/Library/Preferences/com.apple.Accessibility VoiceOverTouchEnabled -bool YES
xcrun simctl spawn <udid> defaults write com.apple.Accessibility VoiceOverTouchEnabled -bool YES
xcrun simctl spawn <udid> launchctl kickstart system/com.apple.VoiceOverTouchDisarm: same Focus-ring evidence (real implementation UI, head
|






Summary
Implementation of the signed-off power-loss autostop (VBT-style) enhancement (issue #1392, ticket
1569561696542920725), built as the bounded spec packets onfeature/1392-power-loss-autostop. Current head620dc71bcontains packets P1 + P2 complete, P3 core, P4 tier-1 + export v1, P5 main UI surfaces — all behind an inert-by-default capability gate (feature cannot arm until the escalated merge gate enables it after P6–P8).Fixes #1392 (closes on merge of the complete packet set — see Remaining packets below).
Packet map at this head
main@4d4de558; overlap recheck recorded belowPowerLossAcquisition.ktMCP V1 signal (commit9d2f4142)PowerLossPolicy.kt/PowerLossModels.kt, SD1–SD4 hard (commit9d2f4142)WORKOUT_COMPLETEcap normalization, live HUD, POWER-only VBT suppression, once-only near-limit cue, non-blocking stop (SD5) — commits3d6f1e45,547dcb95,d6ca8dc0. Remaining: ExecutionSeed/BlePacketFactory/counter/freshness single-target propagation + production-path race tests (signoff §4.2)SchemaManifest/MigrationStatements+ atomic evidence commit (WorkoutExitSnapshot) + power-history export v1 (codec/exporter/Koin/roundtrip) — commits11285534,b8a92be0,dd29acdb. Remaining: backup v7 versioned companion sections, versioned routine CSV / lossy-export block, runtime snapshot codec + restart/rebaseline, golden no-new-wire-keys testPowerLossConfigDraft/Propagation/UiCopy/UiFacts,ExerciseConfigModalSet-target section (presets 10/20/30 + Custom 5–40 with 36–40 caution, max-reps bound, two-consecutive),WorkoutHudpower-loss readout + attempt identity,SetSummaryCardheadline block,HistoryTabcompact rows — commits120561d5,26ac02d7,53fb2952,f49c30c7,e194b713. Remaining:ExerciseEditBottomSheet/JustLiftScreen/set-ready readback, routine/template/ad-hoc propagation throughRoutineFlowManager/DefaultWorkoutSessionManager, export entry + legacy-omission disclosure, remaining ui-spec statesWhat landed in detail
P1 — acquisition + identity (MCP V1 signal)
domain/powerloss/PowerLossAcquisition.kt: versioned validated pre-EMA paired control samples (per-cable kg + raw signed mm/s + positions + device ticks + monotonic ts + quality markers), MCP V1 = arithmetic sample mean of9.81/1000 × (loadA×max(vA,0) + loadB×max(vB,0))W — idle cable contributes 0, no cross-cable velocity substitution, signed lowering never counts.sample gap,stale data,rejected sample,buffer overflow,insufficient samples,phase unavailable.OrderedSampleAccumulator(ordered submit/drain, duplicate/out-of-order rejection, gap/overflow counters) andConcentricPhaseNormalizer(concentric start above 10 mm/s forward on an active cable; end on validated top-turnaround or two fresh at/below-threshold samples; seals exactly once on the next fresh ordered sample).phase unavailable→ null MCP.P2 — pure policy + target plan
domain/powerloss/PowerLossPolicy.kt: side-effect-free reducer (PowerLossObservation+PowerLossPolicyState→PowerLossDecision+ persistedPowerLossObservationRecord).SHORT_ROMwins overPOWER_LOSSin the same sealed observation; both qualification facts (and measured loss when valid) persist; same-cycle precedence safety > manual > cap > fatigue.100 × (1 − MCP/bestMCP) ≥ thresholdPercentin double precision (equality qualifies; display rounding never triggers); display clamp 0–100; ≥2 working reps before any fatigue trigger.PowerLossConfig/TargetMode/ExecutionTargetPlan/PowerLossProtocolFamily/PowerLossCapability(V1 effective modes: Old School, Pump, Echo, Just Lift execution style; TUT/TUT Beast/Eccentric-Only/timed/bodyweight inert; unknown target enum never arms POWER).P3 — engine integration (core)
SetEndReason+MAX_REPS_BACKSTOP,POWER_LOSS,SHORT_ROM(persisted names;fromPersistedstill maps unknown →UNKNOWN).PowerLossSetControllerwired intoActiveSessionEngine's completed-rep path; observations from validated paired samples through the pure phase normalizer.PowerLossEvidence.kt+WorkoutExitSnapshot): immutable winning reason + metrics latched before claim/teardown; rawWORKOUT_COMPLETEon a finite POWER plan normalizes toMAX_REPS_BACKSTOP(neverTARGET_REPS_REACHED, never inferred fatigue).evaluateLatestVbtResult(velocity analysis/display preserved; REP/legacy unchanged).max(0, threshold − 5)loss (HapticEvent.POWER_NEAR_LIMIT,beepsEnabled-gated, terminal supersedes, safety supersedes both); the stop path never waits for audio/animation/persistence (SD5).P4 — durable companions + codecs (tier-1)
PowerLossCompanionStore.kt), migration 64 (additive.sqm; API-26-safe),SchemaManifest.kt+MigrationStatements.ktupdated together (validateSchemaManifestgreen: 812 columns across 68 tables, all covered, order validated).commitCompletedSetviaWorkoutExitSnapshot(deep-frozen companions; attempt-only trigger rows survive).PowerHistoryExportCodec/PowerHistoryExporterImpl+ Koin wiring): separately identified version, stable IDs, attempt/completed identity, frozen config, metric version, reference/trigger/winner, nullable metrics/quality, units, explicit null-vs-zero semantics + import/roundtrip validation.P5 — config + presentation (main surfaces)
ExerciseConfigModalSet-target section:Rep target | Power-loss target, presets10% 20% 30% Custom(nonbreaking labels), custom 5–40 integer validation, persistent 36–40 caution copy,Max working repsdynamic bound, two-consecutive switch (SD1-corrected helper), non-toggleable short-ROM safeguard, Echo concentric-only note.WorkoutHud:Power-loss target · 20%/Max 20 working repsreadout (never9 / 12),8 completed reps · attempt 9 not confirmed completeattempt identity, near-limit once-only state, trusted short-ROMCable A 82% of reference, invalid-powerLast valid · attempt Nlabeling,Ending set….SetSummaryCard:Stopped at rep 9 — 21% power loss (best: rep 2)headline with the adjacent completed/attempt clarification + per-rep table layer.HistoryTab: compact power-loss rows (grouped + single-session; attempt-only rows render; missing data shows—, never fabricated zeros).Ending set…vs completed, history rows, headline clarification).Tests (all green at head
620dc71b)New suites (123 tests, 0 failures, executed 2026-11-17 via
./gradlew -Pskip.supabase.check=true :shared:iosSimulatorArm64Test --tests …—BUILD SUCCESSFUL):PowerLossPolicyTest(32) — signoff §4.1 fixture matrix: warmup exclusion, ≥2-attempt gate, positive baseline, first-row zero loss vs own reference, later-best + frozen decision facts, earliest-tie retention, no short-rep reference replacement, unrounded threshold equality (binary-exact 64→48 = 25%), sub-threshold no-trigger where display rounding would, display clamp, SHORT_ROM/POWER_LOSS tie-break with both facts, one-short-arm, 85%-equality not short (double-precision bound), trusted short ROM with null MCP, unavailable power resets streak, unknown-ROM non-promotion + non-stop, active-cable mask provenance, two-consecutive modes (either prior reason, terminal tie-break, adjacency breaks), cap without telemetry, cap > fatigue, nominal-below-cap, near-limit once-only + zero-baseline silence + terminal supersession, termination latch, config validation, unknown target enum.PowerLossAcquisitionTest(14) — asymmetric/single-cable units, signed velocity, MCP sample-mean math, all six quality reasons, accumulator ordering/gap/overflow/drain semantics, phase-normalizer start/end/seal-exactly-once/top-turnaround/stale rejection.ExecutionTargetPlanTest(10) — POWER finite cap derivation, impossible-plan rejection against supplied byte bounds, REP finite/unlimited identity (Just Lift/AMRAP), nominal-below-cap, capability gating (V1 mode map).PowerLossSetEvidenceLatchTest(8) — one-winner latch immutability across late callbacks,WORKOUT_COMPLETEcap normalization, evidence facts frozen at decision time.PowerLossConfigDraftTest(17) — config draft/commit/cancel semantics, preset/custom validation, caution band, max-reps bound, two-consecutive SD1 helper, mode-confirmation.PowerLossHudUiStateTest(12) /PowerLossSummaryUiStateTest(9) /PowerLossHistoryUiStateTest(9) /PowerLossExportAndCopyGuardTest(7) — HUD attempt identity + once-only cue states, summary reason variants + headline clarification, history grouping + attempt-only rows, export copy guards + no physiological/RPE claim copy.PowerHistoryExportRoundtripTest(androidHostTest) — export v1 roundtrip preserving null/zero/identity.SetEndReasonTest(5) — durable-schema guard pins the ten persisted reasons.Verification (exact head
620dc71b):shared:iosSimulatorArm64Test,BUILD SUCCESSFUL in 9m 25s;validateSchemaManifestgreen).SchemaParityTest,Android109UpgradeTest,IntervalsMigrationTest) — result recorded in the PR evidence comment below.main@4d4de558in the same harness (phase-1 head3d6f1e45): baseline:shared:iosSimulatorArm64Test(presentation-manager + packet-factory + end-reason suites) = 1105 tests, 14 failed; branch = the identical 1105 tests, the identical 14 failures, name-for-name. The 14 failures are pre-existing onmainin this test harness and untouched by this PR:VbtUiWiringTest×2,WorkoutMachineTeardownTest,Issue673DropSetProductFlowTest) fail in the test-runner'sreadProjectFilesource-location walk — same on baseline.DWSMWorkoutLifecycleTest×7,Issue687WorkoutExecutionIsolationTest×2,ActiveSessionEngineStopInvariantTest×1) expectWorkoutState.SetSummaryand observeWorkoutState.Completed— same assertion outcome on baseline.buildRepSummaries/avgPowerWatts/powerWattsuntouched).Remaining packets (on this branch before merge gate)
ExerciseEditBottomSheet/JustLiftScreen/set-ready readback, routine/template/ad-hoc propagation, export entry + legacy-omission disclosure, remaining ui-spec state rows (E01–E12).Signoff corrections SD1–SD8 mapping
All eight carried as hard requirements; SD5 (no stop delay), SD7 (no capture-only accommodations — this branch adds none; the Phantom capture binding is disposable-source-set only per ruling t_62c3867a), and SD8 (gates, not follow-ups) enforced in code/structure. SD6 (native UI corrections) applied in the P5 surfaces landed here.
Overlap recheck (P0)
Checked immediately before coding: #1369 (audio ready cue), #1375 (JustLift exit), #1386 (archival exit-snapshot trimming), #1388 (finalization/export) are all merged into
main@4d4de558. No unmerged sibling PR touchesdomain/powerloss/(new package),PowerLossSetController.kt(new file), or the engine seams edited here. #1386's archival trimming never trims the live control accumulator (newOrderedSampleAccumulatoris per-execution, not archival).Visual evidence
Not yet captured — P7 is an open merge gate. No capture-only accommodations exist on this branch. Mandatory implementation-branch captures (Android + iOS) accompany the remaining packets; the merge gate holds until they exist and are referenced here.
User-instructions / release-note summary
Full user guide + release-note draft:
user-instructions.md(artifact companion). Release-note draft carried in this PR:Merge policy
No merge authorized by this PR. Final merge is the escalated merge gate (
phoenix-rca) after exact-head CI and fresh review of the complete packet set.