# FT-P-04 — Derkachi frame-to-frame registration success rate

**Task**: AZ-412_ft_p_04_derkachi_f2f_registration
**Name**: FT-P-04 frame-to-frame registration ≥95 % on normal Derkachi segments (AC-2.1a)
**Description**: Implement FT-P-04 — full Derkachi replay; SUT exposes per-frame registration-success metric (via `NAMED_VALUE_FLOAT` or FDR per AC-NEW-3); compute success ratio over normal segments only (nadir ±10° bank/pitch, ≥40 % inferred prior-frame overlap).
**Complexity**: 3 points
**Dependencies**: AZ-406, AZ-407
**Component**: Blackbox Tests / Positive (epic AZ-262)
**Tracker**: AZ-412
**Epic**: AZ-262 (E-BBT)

## Problem

The frame-to-frame registration success rate on "normal" segments is a direct measurement of the C1 VIO + C3 matcher quality in nominal conditions. AC-2.1a requires ≥95 % — without this scenario the project has no honest measurement.

## Outcome

- pytest scenario at `e2e/tests/positive/test_ft_p_04_derkachi_f2f_registration.py`.
- Replays the full Derkachi fixture; reads per-frame registration-success metric (boolean per frame).
- "Normal" segment classification: nadir bank/pitch within ±10° (estimated from `SCALED_IMU2`-derived attitude in `data_imu.csv`); ≥40 % inferred prior-frame overlap (heuristic from frame-to-frame translation magnitude).
- Computes success ratio over normal segments only.

## Scope

### Included
- Full-replay test method.
- Normal-segment derivation from `data_imu.csv` (the test computes attitude from `SCALED_IMU2` per AC-2.1a).
- Per-frame registration-success metric ingestion (via `NAMED_VALUE_FLOAT` listener OR post-run FDR read).
- Success-ratio computation + assertion.

### Excluded
- Sharp-turn segments — exercised separately by FT-N-02 (AZ-414) and explicitly excluded from this denominator.
- MRE budgets — owned by FT-P-05 / FT-P-06 (AZ-413).
- Cross-domain (UAV → satellite) success — owned by FT-P-05.

## Acceptance Criteria

**AC-1: normal-segment classification reproducibility**
Given the same Derkachi `data_imu.csv`
Then the same set of frames are classified "normal" across two runs of the test.

**AC-2: success ratio meets AC-2.1a budget**
Given the SUT exposes per-frame registration-success
Then `success_ratio_over_normal_segments ≥ 0.95`.

**AC-3: success-ratio computation excludes sharp-turn frames**
Given the per-frame attitude exceeds ±10° bank or pitch (sharp-turn region)
Then those frames are excluded from the denominator; the test reports `excluded_frame_count` separately for diagnostic clarity.

**AC-4: parameterization**
Given the conftest's `(fc_adapter, vio_strategy)` parameterization
Then the scenario runs once per parameterization.

## System Under Test Boundary

End-to-end through public boundaries.

- **Allowed**: per-frame metric exposure via `NAMED_VALUE_FLOAT` (a public MAVLink message) OR via post-run FDR archive read.
- **Forbidden**: importing C1 VIO internal state, monkeypatching C3 matcher pass/fail return, stubbing C2 retrieval to force successes.

## Constraints

- The per-frame registration-success metric is part of the SUT's documented public output (per AC-NEW-3 FDR schema). If it isn't there yet, the scenario fails — it does NOT compensate by inferring from another signal.
- Normal-segment derivation uses ONLY `data_imu.csv`, not internal SUT state.

## Document Dependencies

- `_docs/02_document/tests/blackbox-tests.md` § FT-P-04
- `_docs/02_document/tests/test-data.md` § Image processing quality (FT-P-04 row)
