# V3 Reconnect Validation

Canonical source: `libs/oshun/analytics/src/v3-reconnect-budget.ts`

Evidence artifact: `V3/validation/reconnect-validation.json`

Manifest version: `v3-reconnect-budget.v1`

The Lilith reconnect gate validates a 30 second transient disconnect and the
path back to an active native UE session with session state preserved. The
deterministic harness uses 96 samples, a 60 second retained-session TTL, the
same gateway shard pin, the last server sequence, and the world-server retained
participant transform/input sequence.

| Phase                        | Budget | p50    | p95    | Max    |
| ---------------------------- | ------ | ------ | ------ | ------ |
| `disconnect_detection`       | 250 ms | 200 ms | 218 ms | 219 ms |
| `retained_session_lookup`    | 320 ms | 264 ms | 287 ms | 289 ms |
| `resume_token_refresh`       | 480 ms | 396 ms | 427 ms | 429 ms |
| `world_shard_pin_reuse`      | 550 ms | 460 ms | 495 ms | 499 ms |
| `gateway_resume_ack`         | 650 ms | 566 ms | 606 ms | 609 ms |
| `world_session_resume`       | 550 ms | 461 ms | 496 ms | 499 ms |
| `snapshot_and_voice_catchup` | 350 ms | 285 ms | 307 ms | 309 ms |
| **Reconnect total**          | 3.0 s  | 2.62 s | 2.73 s | 2.77 s |

The gate is anchored to `apps/v3/lilith-realtime-gateway/src/lib.rs`, where
`simulate_transient_reconnect_validation` exercises `GatewayReconnectDirectory`
and `SessionPinDirectory` for each run. Every sample retains the session,
resumes after the modeled 30 second drop, reuses the same shard pin, and
preserves the last server sequence. It is paired with the world-server
`world_server_retains_session_state_for_thirty_second_reconnect` test in
`apps/v3/lilith-world-server/src/lib.rs`, which verifies the participant
transform and `last_input_sequence` survive the retained-session resume.

`pnpm verify:v3 reconnect` fails closed when the 30 second transient-drop shape
is weakened, retained-session TTL drops below 60 seconds, sample count is below
96, p95 or max reconnect time exceeds 3,000 ms, any phase p95 exceeds its
budget, shard pin / room / server sequence / world transform state is not
preserved, percentiles are inconsistent, or source/doc/evidence wiring is
missing.
