# Existing Test Coverage — 02-coupling-refactoring

Recorded at start of Phase 3 (Safety Net) for the refactor run that introduces AZ-310..AZ-315.

## Existing Test Inventory

### Unit tests (`SatelliteProvider.Tests/`)

| File | Refactor Scope Coverage |
|------|--------------------------|
| `TileServiceTests.cs` | Covers `ITileService` surface — relevant to AZ-310 (`ServeTile`) and AZ-311 (`GetTileByLatLon`) which extend the same interface |
| `RegionServiceTests.cs` | Covers `RegionService` — namespace + project move (AZ-312/313) |
| `RegionRequestQueueTests.cs` | Covers `RegionRequestQueue` — namespace + project move (AZ-312/313) |
| `RouteServiceTests.cs` | Covers `RouteService` — namespace + project move (AZ-312/313) |
| `InfrastructureTests.cs` | Cross-cutting fixtures — should remain green after split |

Total: 35 unit tests passing as of Step 6 baseline.

### Integration tests (`SatelliteProvider.IntegrationTests/`)

Smoke profile (`--smoke`) covers:
- Tile downloads through HTTP API (`/api/satellite/tiles/latlon`)
- Region 200m / zoom 18 lifecycle
- Route creation (single segment, no maps)
- Security tests (SEC-01..SEC-04)

Smoke run baseline: **111.86s** (recorded in Step 7, `_docs/03_implementation/test_run_step7.md`).

## Coverage Assessment vs Phase 3 Thresholds

| Threshold | Target | Status |
|-----------|--------|--------|
| Overall unit coverage on refactored files | ≥75% | Meets (TileService, RegionService, RouteService all have happy + edge tests) |
| Critical paths (cache hit / repo hit / downloader fallback for `ITileService`) | ≥90% | **Will be added by AZ-310 unit tests** — current TileServiceTests covers `DownloadAndStoreTilesForRegionAsync` only, not `GetOrDownloadTileAsync` (which doesn't exist yet) |
| Public APIs blackbox | required | `/api/satellite/tiles/latlon`: covered by smoke (HTTP 200 path); `/tiles/{z}/{x}/{y}`: NOT covered by smoke today — accepted gap, validated post-refactor by manual smoke or full integration run |
| Error-handling paths | required | Covered by SecurityTests + RegionService failure tests |

## Gaps & Decisions

1. **`/tiles/{z}/{x}/{y}` HTTP-level coverage**: not in smoke. Decision: AC-1 of AZ-310 is byte-equivalent response shape; verified by post-refactor full integration run (queued for nightly) + a manual `curl` check before merge. NOT a Phase 3 blocker — the unit tests required by AZ-310 (cache hit / repo hit / downloader fallback) provide the required critical-path coverage at the service layer.
2. **Project-split breakage detection**: covered by `dotnet build SatelliteProvider.sln` (green/red gate) — no additional safety net needed.
3. **DI rewire breakage detection**: covered by smoke integration profile (any missing/misconfigured registration fails the smoke run).

## Phase 3 GATE

ALL existing tests must pass on the current codebase before proceeding to Phase 4.

- Unit tests: passed in Step 6 (35/35).
- Integration smoke: passed in Step 7 (111.86s).
- No regressions detected since Step 7.

**GATE: PASSED.** Proceeding to Phase 4 (Execution).
