# Test — Panel-Width Persistence

**Task**: AZ-470_test_panel_width_persistence
**Name**: Panel-width debounced PUT + rehydration on reload
**Description**: Implement the 3 blackbox tests pinning the panel-width persistence behavior: a debounced PUT (≤1 s after resize-end) and rehydration of the saved width on reload.
**Complexity**: 2 points
**Dependencies**: AZ-456_test_infrastructure
**Component**: 10_app-shell + 06_annotations (split panels) (Blackbox Tests)
**Tracker**: AZ-470
**Epic**: AZ-455

## Problem

Layout preferences are a quality-of-life feature that must NOT thrash the suite with PUTs (debounce required) and MUST persist across reloads (saved-state contract). Both regress silently — users notice but rarely report.

## Outcome

- 3 scenarios pass.

## Scope

### Included

| Scenario | Profile | Source file |
|----------|---------|-------------|
| FT-P-37 — panel-width persistence — debounced PUT on resize end | fast | blackbox-tests.md |
| FT-P-38 — panel-width rehydration on reload | fast + e2e | blackbox-tests.md |
| NFT-PERF-08 — panel-width persistence debounce ≤ 1 s after resize-end | fast | performance-tests.md |

### Excluded

- Flight-selection persistence (covered in 08_test_flight_selection_persistence) — different state key but same `PUT /api/annotations/settings/user` endpoint.

## Acceptance Criteria

**AC-1: Debounce window**
Multiple resize events within 1 s yield exactly one outbound PUT. Asserted via captured request log.

**AC-2: Body shape**
The PUT body carries the `panelWidths` field (per the contract).

**AC-3: Rehydration**
After reload with `seed_user_settings.panelWidths` set, the rendered panel widths match the seed.

## System Under Test Boundary

- System under test: panel split component(s) + `<UserSettings>` save path.
- Allowed stubs: MSW for `PUT /api/annotations/settings/user`.
- Disallowed: reading internal React state.
- Expected observables per `results_report.md` rows 64-65.

## Constraints

- Use Vitest fake-timers to simulate the debounce window deterministically.
