# FT-P-10 — GTSAM smoothing-loop look-back accuracy

**Task**: AZ-418_ft_p_10_smoothing_lookback
**Name**: Internal smoothing improves past-keyframe estimates (AC-4.5 revised, Mode B Fact #107)
**Description**: Implement FT-P-10 — full Derkachi replay; FDR contains per-keyframe (a) raw single-shot pose at first emission, (b) smoothed pose at iSAM2 convergence; assert `smoothed_error < raw_error` for ≥80 % of keyframes; `mean_improvement ≥ 5 m`. NOT validated as FC-side retroactive correction (out of scope per Mode B revision).
**Complexity**: 3 points
**Dependencies**: AZ-406, AZ-407
**Component**: Blackbox Tests / Positive / Internal smoothing (epic AZ-262)
**Tracker**: AZ-418
**Epic**: AZ-262 (E-BBT)

## Problem

The iSAM2 fixed-lag smoother is the project's IMU-fusion mechanism; if it doesn't actually improve past-keyframe estimates over raw single-shot, the entire C5 design loses its rationale. AC-4.5 (revised per Mode B) measures this as an internal-improvement metric, NOT FC-side retroactive correction.

## Outcome

- pytest scenario at `e2e/tests/positive/test_ft_p_10_smoothing_lookback.py`.
- Replays Derkachi end-to-end; reads FDR archive after replay.
- For each past keyframe: extracts (a) `raw_pose` (first single-shot emission for that keyframe) and (b) `smoothed_pose` (iSAM2-converged pose at smoother window end).
- Computes `distance(raw, GT)` and `distance(smoothed, GT)` against Derkachi `GLOBAL_POSITION_INT`.
- Aggregates: `improvement_rate = count(smoothed_error < raw_error) / total`; `mean_improvement = mean(raw_error - smoothed_error)`.

## Scope

### Included
- FDR archive reader for past-keyframe records (per AC-NEW-3 schema; raw + smoothed entries).
- Per-keyframe error computation against `GLOBAL_POSITION_INT` GT.
- Aggregate assertions.

### Excluded
- FC-side retroactive correction — explicitly OUT OF SCOPE per Mode B revision.
- Inter-keyframe interpolation accuracy — out of scope.
- iSAM2 timing — owned by NFT-PERF-01 (AZ-428).

## Acceptance Criteria

**AC-1: FDR contains raw + smoothed pose pairs**
Given a full Derkachi replay
Then the FDR archive contains, for each past keyframe k: (a) `raw_pose_k` recorded at the keyframe's first emission timestamp; (b) `smoothed_pose_k` recorded when k exits the iSAM2 window.

**AC-2: improvement rate**
Given the per-keyframe pairs
Then `count(smoothed_error_k < raw_error_k) / total_keyframes ≥ 0.80`.

**AC-3: mean improvement**
Given the per-keyframe pairs
Then `mean(raw_error_k − smoothed_error_k) ≥ 5 m` over all keyframes.

**AC-4: parameterization**
Given conftest parameterization
Then the scenario runs per `(fc_adapter, vio_strategy)`. Note: this AC is sensitive to VIO strategy quality; expected `vins_mono` (research) ≥ `okvis2` ≥ `klt_ransac` improvement rates — the test reports per-strategy rates as evidence even if all pass the threshold.

## System Under Test Boundary

End-to-end through public boundaries; FDR archive read post-flight.

- **Allowed**: FDR-archive read (a public on-disk artifact per AC-NEW-3).
- **Forbidden**: querying live iSAM2 graph state; importing SUT C5 module.

## Constraints

- The FDR record schema (AC-NEW-3) MUST distinguish raw vs smoothed past-keyframe entries; if only one is present, the test fails.
- "Past keyframe" in this scenario excludes the most recent K=10..20 keyframes (still inside the smoother window) — those have not yet converged.

## Document Dependencies

- `_docs/02_document/tests/blackbox-tests.md` § FT-P-10
- `_docs/02_document/tests/test-data.md` § FC contract & startup (FT-P-10 row)
