# Test — Annotation Overlay Window Membership

**Task**: AZ-462_test_overlay_membership
**Name**: Overlay membership at the in-window edges
**Description**: Pin the 4 inclusive/exclusive edge cases for the annotation overlay window (FT-P-14, FT-P-15, FT-N-01, FT-N-02). These edges have caused subtle off-by-one regressions before; without explicit edge-tests they recur silently.
**Complexity**: 2 points
**Dependencies**: AZ-456_test_infrastructure
**Component**: 06_annotations (overlay window) (Blackbox Tests)
**Tracker**: AZ-462
**Epic**: AZ-455

## Problem

The overlay window logic asserts an annotation is "in-window" iff `lowerBound <= ts <= upperBound`. Off-by-one mistakes (strict instead of inclusive, or shifted by one frame interval) only surface when the playback head is exactly on the boundary — a state that test scenarios rarely hit by accident.

## Outcome

- 4 edge-case scenarios pass per the inclusive-boundary contract.
- Tests are deterministic — they construct exact-edge fixtures rather than relying on real-time playback.

## Scope

### Included

| Scenario | Profile | Source file |
|----------|---------|-------------|
| FT-P-14 — overlay membership at the lower in-window edge | fast | blackbox-tests.md |
| FT-P-15 — overlay membership at the upper in-window edge | fast | blackbox-tests.md |
| FT-N-01 — overlay annotation below the lower bound is NOT rendered | fast | blackbox-tests.md |
| FT-N-02 — overlay annotation above the upper bound is NOT rendered | fast | blackbox-tests.md |

### Excluded

- Overlay style / Z-order / color (covered by class-color tests in component scenarios).
- Overlay clicking / selection (covered by 16_test_canvas_bbox).

## Acceptance Criteria

**AC-1: Inclusive boundary**
FT-P-14 / FT-P-15 assert an annotation EXACTLY on `lowerBound` (resp. `upperBound`) IS rendered in the overlay.

**AC-2: Strict exclusion**
FT-N-01 / FT-N-02 assert an annotation one frame interval before / after the window is NOT rendered.

**AC-3: Reads the DOM, not internal state**
The "rendered" assertion queries the canvas / overlay DOM nodes (or rendered SVG / Leaflet markers). It does NOT inspect React component state.

## System Under Test Boundary

- System under test: `<CanvasEditor>` + overlay annotation rendering.
- Allowed stubs: MSW for annotation list responses (the fixture pins exact timestamps).
- Disallowed: stubbing the overlay logic itself, or asserting on React state.
- Expected observables compared against `results_report.md` rows for FT-P-14, 15, FT-N-01, 02.

## Constraints

- Fixtures must pin timestamps to exact boundaries via deterministic numeric values; no `new Date()` or similar.
