# NFT-RES-02 — Companion mid-flight reboot recovery

**Task**: AZ-433_nft_res_02_companion_reboot
**Name**: SUT recovers from companion mid-flight reboot via FC pose snapshot (AC-5.2, AC-5.3)
**Description**: Implement NFT-RES-02 — Tier-1 OR Tier-2; mid-flight Derkachi replay; trigger companion-process restart (`docker compose restart gps-denied-onboard` on Tier-1, `systemctl restart gps-denied-onboard` on Tier-2); measure resume time + first-emission accuracy.
**Complexity**: 3 points
**Dependencies**: AZ-406, AZ-407
**Component**: Blackbox Tests / Resilience (epic AZ-262)
**Tracker**: AZ-433
**Epic**: AZ-262 (E-BBT)

## Problem

Companion-process reboots are an inevitable operational event. AC-5.2 / AC-5.3 prescribe a recovery contract — without measurement the project has no honest claim of recoverability.

## Outcome

- pytest scenario at `e2e/tests/resilience/test_nft_res_02_companion_reboot.py`. Tier-1 OR Tier-2.
- Mid-flight: trigger `restart` of the SUT process; measure (a) `resume_time` (wall-clock from restart command to first post-restart emission); (b) `first_emission_accuracy` (vincenty distance from first post-restart estimate to GT at that timestamp).
- Assert `resume_time ≤ 30 s` AND `first_emission_accuracy ≤ 100 m`.

## Scope

### Included
- Mid-flight restart trigger.
- Resume-time + accuracy measurement.

### Excluded
- Cold-start TTFF — owned by NFT-PERF-03.

## Acceptance Criteria

**AC-1: restart trigger**
Given a Derkachi replay in progress past the 60 s mark
When the test issues the restart command
Then the SUT process restarts within ≤5 s (Docker / systemd response).

**AC-2: resume time ≤ 30 s**
Given the restart event
Then the first post-restart outbound emission occurs within ≤30 s of the restart command.

**AC-3: first-emission accuracy ≤ 100 m**
Given the first post-restart emission
Then `vincenty(estimate, GT) ≤ 100 m`.

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

## System Under Test Boundary

End-to-end through public boundaries.

- **Allowed**: Docker / systemd restart commands (public process-management interfaces); SITL outbound capture; GT from `data_imu.csv`.
- **Forbidden**: pre-snapshotting SUT internal state to short-circuit the cold-start.

## Constraints

- The restart command differs by tier; conftest passes the appropriate command per the runner's tier.

## Document Dependencies

- `_docs/02_document/tests/resilience-tests.md` § NFT-RES-02
- `_docs/02_document/tests/test-data.md` § Resilience (NFT-RES-02 row)
