[AZ-310] [AZ-311] Route tile endpoints through ITileService

Move cache+DB+download logic for /tiles/{z}/{x}/{y} and
/api/satellite/tiles/latlon out of Program.cs into TileService.
Endpoints now inject only ITileService + ILogger. Service owns
IMemoryCache (1h absolute / 30min sliding preserved). Added
TileBytes DTO; ITileService gains GetOrDownloadTileAsync and
DownloadAndStoreSingleTileAsync. 5 new unit tests cover cache
hit, repo hit, downloader fallback, and AZ-311 happy + error.

Build clean (0/0), unit suite 40/40. Resolves architecture
baseline F3 in code (docs handled by AZ-315).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Oleksandr Bezdieniezhnykh
2026-05-10 06:06:11 +03:00
parent 220277b9c7
commit 12b582deac
12 changed files with 387 additions and 121 deletions
@@ -0,0 +1,48 @@
# Batch Report
**Batch**: 4 (refactor 02-coupling-refactoring · Phase A)
**Tasks**: AZ-310, AZ-311
**Date**: 2026-05-10
## Task Results
| Task | Status | Files Modified | Tests | AC Coverage | Issues |
|------|--------|---------------|-------|-------------|--------|
| AZ-310 ServeTile via ITileService | Done | 5 src + 2 tests | 40/40 | 5/5 ACs covered | None |
| AZ-311 GetTileByLatLon via ITileService | Done | (shared) | (shared) | 3/3 ACs covered | None |
## Files Changed
- `SatelliteProvider.Common/DTO/TileBytes.cs` (new)
- `SatelliteProvider.Common/Interfaces/ITileService.cs`
- `SatelliteProvider.Services/SatelliteProvider.Services.csproj`
- `SatelliteProvider.Services/TileService.cs`
- `SatelliteProvider.Api/Program.cs`
- `SatelliteProvider.Tests/SatelliteProvider.Tests.csproj`
- `SatelliteProvider.Tests/TileServiceTests.cs`
- `SatelliteProvider.Tests/InfrastructureTests.cs`
## AC Test Coverage
8 of 8 ACs covered (5 unit-tested, 3 verified by static inspection of `Program.cs` + reachable via integration smoke run).
## Code Review Verdict
**PASS** — no findings. See `_docs/03_implementation/reviews/batch_04_review.md`.
## Auto-Fix Attempts
0
## Build / Tests
- `dotnet build SatelliteProvider.sln --configuration Release` → 0 warnings, 0 errors
- `dotnet test SatelliteProvider.Tests` → 40/40 passed (35 baseline + 5 new)
## Architecture-Baseline Impact
- F3 (Medium — endpoint routing bypasses ITileService): resolved by this batch (code change). Doc resolution deferred to AZ-315.
## Next Batch
AZ-312 + AZ-313 + AZ-314 (Phase B — split `SatelliteProvider.Services` into 3 csprojs, rewire consumers, DI extension methods).