# Final center return and sensor-check evidence — build 7

## Physical evidence

Read build 5 logs directly from the connected iPhone without changing device data. Three attempts were present in `/tmp/rideform-physical-calibration-logs`:

- 19:59:43Z and 20:00:32Z attempts on 2026-10-01 passed the final center return at approximately 4.3° and 4.7°, then failed `unverifiedConvention`. These were not return failures. The logs do not contain the raw quaternion/matrix or residuals needed to identify that rejection’s underlying cause.
- 20:05:14Z attempt hovered around 6–9° from the original neutral during final return. The 0.10 rad entry gate never accumulated the required hold, exhausted two automatic retries and terminated with `timedOut`. Center, left and forward evidence was already collected.

## Change

Final fitting uses the initial neutral and the two lean arrays. Final return samples were never part of that fit. Keep the spoken instruction to return comfortably, but remove its redundant pose acceptance gate. After that instruction, the next sensor sample advances to the unchanged convention and fit checks. Intermediate return before forward remains, to separate the gestures. Original neutral remains unchanged. Automatic recording still waits for successful fit and completion of the ready announcement.

There is no right-lean calibration stage: left establishes the lateral axis and forward supplies the second independent axis. Right remains part of physical sign validation and recorded drills.

The adapter now includes the first invalid quaternion/matrix sample or nonfinite input and gravity-check counts/residual sums in capture summaries; failed-fit attempt logs retain that detail. Sensor-check rejection speech distinguishes it from center-position failure. Convention validation is not bypassed or relaxed. The device-only diagnostic subsequently identified and verified the fix below.

## Verification

An 8° final-return regression reproduced the exhausted-retry failure before the fix (`/tmp/rideform-final-return-red.log`). It asserts fitting succeeds without retries and original neutral samples remain intact. Existing unknown-convention and invalid-input rejection tests remain in place.

Independent Swift review caught a zero-valued policy field incompatible with the solver’s positive numeric parameter contract in the first implementation. Changed it to `guidedFinalReturnAdvisory=1` before deployment; the initial test run also caught this. No weakening of solver limits.

Corrected implementation: 42 iPhone integration tests passed (`/tmp/rideform-final-return-final-tests.log`), including automatic recording after spoken completion, manual setup, standard-mount setup and rejection of unknown/invalid sensor conventions. Watch integration and screen workflow passed (`/tmp/rideform-final-return-watch.log`). Device-only `MotionCaptureTests/testPhysicalSensorConventionEvidence` captures 100 samples and attaches the diagnostic snapshot; its purpose is actual sensor evidence, not a synthetic correctness claim.


## Sensor convention root cause and hardware confirmation

The device-only capture reproduced `matrix mismatch=true` before any gravity checks. The first actual sample had a direct matrix/quaternion residual of 0.28198176, while the transposed relationship agreed within approximately 2.21e-8. The validator assumed an active quaternion and Core Motion DCM must be identical; Core Motion provided opposite transform representations. That first valid sample permanently invalidated the capture, making every subsequent fit fail independently of posture.

Added that exact physical quaternion, matrix and gravity to `MotionCaptureTests`; it failed before the representation fix (`/tmp/rideform-sensor-transpose-red.log`). The adapter now maintains both possible matrix relationships across every basis vector and sample. Losing both still invalidates the capture permanently. Gravity still independently selects quaternion direction using the unchanged thresholds. Raw values are not rewritten. New inverse mappings use `quaternion conjugate`; the old combined literal remains accepted by the portable decoder for existing masters.

The corrected adapter was exercised again on the connected iPhone: 100 samples, `verified=true`, canonical mapping `identity`, transpose relationship confirmed, no matrix mismatch or invalid sample. Identity gravity residual sum was 6.012148e-6 (mean 6.012148e-8), versus inverse residual sum 152.2126. Evidence: `/tmp/rideform-sensor-device-green.log` and `/tmp/rideform-physical-sensor-green/43F59BA5-7151-4F41-A140-372D620C0F29.txt`. This is real sensor-convention evidence, not yet a mounted sign or successful full human-calibration trial.

An intermediate iPhone UI run was disrupted by overlapping simulator test launches during diagnosis. Final verification runs each iPhone suite sequentially; hardware and Watch runs use separate devices.

Final verification: all 41 portable core tests passed (`/tmp/rideform-convention-core-final.log`); all 44 iPhone integration tests and all four UI workflows passed in one sequential run (`/tmp/rideform-calibration7-final-tests.log`); Watch integration/UI passed (`/tmp/rideform-calibration7-watch.log`). Signed device build succeeded (`/tmp/rideform-calibration7-device-final.log`) and deep strict signature verification passed. Independent final Swift review found no remaining findings. The full human-mounted calibration sequence and physical rider signs still require James’s trial.

Build 7 installed successfully (`/tmp/rideform-calibration7-install.json`); device inventory confirmed bundleVersion 7 (`/tmp/rideform-calibration7-inventory.json`). Existing app data was preserved.
