# U5 recording workflow evidence

## Scope and implementation

The workflow has explicit uncalibrated, calibrating, ready, recording, finalizing, saved, and saveError states. One MotionCapture remains continuous through calibration and recording: starting a writer does not restart the arbitrary attitude reference frame. A locked recording sink attaches the writer atomically relative to capture callbacks, resets per-recording sample sequences/counts, and enqueues every accepted record directly off-main. Only live presentation is throttled. Stopping drains capture before detaching the writer and finalizing. Any stopped reference requires recalibration before another recording, including interruption while ready.

Calibration retains original neutral/LEFT/FORWARD samples and verifies the capture convention before solving. Guided and standard mount paths use the same solver checks. Previous calibration evidence survives rejected retries but does not authorize recording after reference invalidation. Requested/measured rate, counts, elapsed time, availability, relative angles, high-contrast recording indication, and accessible large controls are shown.

Five annotations timestamp the button handler with the shared Mach clock. Optional spoken CENTER/LEFT/CENTER/RIGHT/CENTER cues retain scheduled and actual speech dispatch times; acoustic onset is unmeasured. Stop/interruption cancels pending cues. Foreground capture owns and restores the preexisting idle timer setting. Scene interruption saves an interrupted master and gates the next recording behind saved review.

Saved masters reopen from the session list after relaunch. Export preparation and session loading run off-main. Sharing uses temporary zip/CSV artifacts and cancellation does not mutate the master. The initial saved screen reports counts/rates/calibration/events/angles; full analysis review is U7.

## RED evidence

The main coordinator captured `/tmp/rideform-u5-red-snapshot` before production writes and ran an isolated Xcode build. `/tmp/rideform-u5-red.log` exited 65 for missing RecordingController and CuePlayer. This is compile-time contract RED, not executed assertion evidence.

After initial implementation, `/tmp/rideform-u5-preview-compile.log` compiled the app but surfaced the uncalibrated lifecycle assertion failure: the test had requested physical motion on a simulator. The test now explicitly selects synthetic input and still exercises the real capture validation/calibration boundary.

## Verification pending main authoritative run

`RecordingLifecycleTests` exercises actual simulator input through neutral coverage, LEFT/FORWARD gestures, convention verification, recording, all five persisted markers, interrupted save, idle restoration, double taps, sequence reset, a second independently calibrated recording, and immutable prior master. Each synthetic source uses a different nonidentity neutral orientation to detect accidental reference restart at Start.

`CueTimingTests` delays dispatch and checks actual versus scheduled timestamps plus cancellation suppression. `RecordingWorkflowTests` drives actual accessible controls, inspects saved event counts, cancels sharing, saves an interrupted second recording, relaunches, and reopens preserved sessions.

The simulator fixture compiles only under `targetEnvironment(simulator)`, requires explicit `--uitest-motion` (or unit-test injection), and displays SYNTHETIC UI labeling. Its quaternion, matrix, gravity, and optional independent raw records enter the real callback validation boundary; it does not inject fitted calibration results. Simulator evidence is never hardware evidence.

Physical mounting/sign checks, matched raw/fused trials, real sensor rates/permission behavior, acoustic onset, and garage transition trials remain human device gates. Main coordinator owns authoritative builds, device installation, and commits.

## GREEN workflow and preview freeze

Main authoritative isolated snapshot `/tmp/rideform-u5-preview3-snapshot` passed app integration tests (16 tests) and `RecordingWorkflowTests` (one full workflow, 41.428 seconds) with `TEST SUCCEEDED` in `/tmp/rideform-u5-preview3-tests.log`. Result bundle: `/tmp/rideform-u5-preview3-derived/Logs/Test/Test-RideForm-2026.10.01_11-34-10--0500.xcresult`.

The first UI run exposed a share-dismissal/scroll hit-testing failure after successfully saving five markers and preparing export. The fix explicitly clears the SwiftUI share presentation from the native activity completion callback. The final UI test waits for actual dismissal and button hitability, then recalibrates and records another session, backgrounds, relaunches, and reopens saved evidence. No sleeps substitute for UI state checks.

Source was frozen for the first physical iPhone preview after this GREEN run. Installation is owned by the main coordinator. This preview has no claimed physical calibration/sign/rate evidence.

Later convention invalidation now forces recalibration and saves active recordings as interrupted with a diagnostic. Checkpoint failure stops acquisition, records a diagnostic, and attempts finalization. If durable finalization succeeds, the saved screen retains a warning; if it fails, saveError blocks new recordings and retains the writer for explicit retry.
