[AZ-460] [AZ-462] [AZ-466] [AZ-475] Batch 4 - destructive UX/forms/overlay/save

AZ-466 — Destructive UX policy + ConfirmDialog a11y + no-alert (4pts):
  src/components/ConfirmDialog.test.tsx (8 fast),
  tests/destructive_ux.test.tsx (4 fast, AdminPage class-delete drift),
  e2e/tests/destructive_ux.e2e.ts. New static checks STC-SEC7 (alert
  allowlist) + STC-SEC8 (destructive-surfaces gated/drift) wired through
  scripts/check-banned-deps.mjs reading tests/security/banned-deps.json.

AZ-475 — Numeric form input rejection (2pts):
  tests/form_hygiene.test.tsx (3 fast). Documents two SettingsPage drifts:
  silent zero coercion via parseInt(v)||0 and labels missing htmlFor.

AZ-462 — Overlay membership at in-window edges (2pts):
  tests/overlay_membership.test.tsx (6 fast). Documents getTimeWindowDetections
  strict < drift; AC-1 boundary tests are it.fails(); AC-2 / control PASS.
  Mocks HTMLCanvasElement.getContext to capture strokeRect.

AZ-460 — Annotation save URL + payload contract (2pts):
  tests/annotations_endpoint.test.tsx (6 fast),
  e2e/tests/annotations_endpoint.e2e.ts. AC-1 URL canary PASSes; AC-2
  payload missing 4 fields documented as it.fails(); AC-3 manual-draw
  PASS, AI-suggestion-accept + bulk-edit-save QUARANTINE skip.

Test infrastructure:
  - tests/setup.ts: NoopResizeObserver + NoopEventSource JSDOM polyfills.
  - tests/msw/handlers/annotations.ts: doubly-prefixed paths matching
    production calls (e.g. /api/annotations/annotations).
  - tests/msw/handlers/flights.ts: plural /aircrafts paths.

Verification: bun run test:fast → 80 passed, 13 skipped (14 files).
scripts/run-tests.sh --static-only → 24/24 PASS (was 22; +STC-SEC7/SEC8).
Per-batch self-review verdict: PASS_WITH_WARNINGS. Cumulative review
of batches 04-06 due after batch 6 per implement/SKILL.md Step 14.5.
Report: _docs/03_implementation/batch_04_report.md.

Also includes the previously-untracked
_docs/03_implementation/cumulative_review_batches_01-03_report.md
generated at the start of this session before batch 4 began.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-11 04:15:01 +03:00
parent 2051088706
commit 1dd25edee3
20 changed files with 1812 additions and 32 deletions
@@ -0,0 +1,57 @@
# 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.