mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-21 21:01:14 +00:00
dea0b8b4c0
Batch 2: 27 new tests, 31/31 total passing.
AZ-286 TileService (9 tests):
- BT-01 download stores tiles via repository
- BT-02 cache reuse passes existing tiles to downloader
- BT-02b stale-version cached tiles are NOT treated as still-valid
- BT-N02 GoogleMapsDownloaderV2 rejects zoom levels not in {15..19}
- GetTileAsync known/unknown id
AZ-287 RegionService (6 tests):
- AC-1 RequestRegionAsync inserts entity and queues request
- AC-2/AC-3 ProcessRegionAsync transitions queued→processing→completed
and writes CSV + summary files
- AC-4 stitch path is set when stitchTiles=true
- ProcessRegionAsync handles RateLimitException by writing failed
summary with the error message preserved
- GetRegionStatusAsync mapping
- Missing region id is logged and short-circuits without DB writes
AZ-288 RouteService (12 tests):
- AC-1 every consecutive pair is ≤200m apart on 2-point route
- AC-2 first/last user points keep their roles; middles are interpolated
- BT-10 10pt route → 1 start, 1 end, 8 action, plus intermediates
- BT-12 20pt route → 1 start, 1 end, 18 action
- AC-3 TotalDistanceMeters == Σ Haversine(point[i-1], point[i])
- BT-N03 < 2 points throws ArgumentException
- regionSize <100 / >10000 throws ArgumentException
- BT-N04 (0,0) corner throws
- BT-N05 inverted NW.lat <= SE.lat throws
- BT-11 valid geofence creates region requests + links them with
isGeofence=true
- BT-07 GetRouteAsync returns route + points
- GetRouteAsync unknown id returns null
Code review: PASS_WITH_WARNINGS — 3 Low Spec-Gap findings:
1. BT-N01 (invalid coords) deferred to AZ-289 integration tests
(TileService doesn't validate coordinates — API-layer concern)
2. Point-type label drift between blackbox-tests.md ("original")
and code ("start"/"action"/"end")
3. Region status drift: spec "pending" vs code "queued" — initial
state on insert
Verification: docker dotnet test — 31/31 pass in 0.83s.
Co-authored-by: Cursor <cursoragent@cursor.com>
4.7 KiB
4.7 KiB
Code Review Report
Batch: 2 — AZ-286 + AZ-287 + AZ-288 (TileService / RegionService / RouteService unit tests) Date: 2026-05-10 Verdict: PASS_WITH_WARNINGS
Findings
| # | Severity | Category | File:Line | Title |
|---|---|---|---|---|
| 1 | Low | Spec-Gap | (deferred) | BT-N01 (invalid coords) not unit-tested — TileService does not validate lat/lon |
| 2 | Low | Spec-Gap | (docs) | Point-type label drift between blackbox-tests.md ("original"/"intermediate") and code ("start"/"action"/"end"/"intermediate") |
| 3 | Low | Spec-Gap | (docs) | Region status drift: blackbox-tests.md "pending → processing → completed" vs code "queued → processing → completed" |
Finding Details
F1: BT-N01 not service-unit-tested (Low / Spec-Gap)
- Location: out-of-scope for
TileService - Description: AZ-286 lists BT-N01 (invalid lat/lon) but neither
TileService.DownloadAndStoreTilesAsyncnorGoogleMapsDownloaderV2.DownloadSingleTileAsyncvalidates coordinate ranges. Validation lives at the API endpoint layer (Program.cs). - Suggestion: Cover BT-N01 in AZ-289 (integration tests) which exercises the HTTP API. Optionally add API-layer validation in a future testability/refactor step.
- Tasks: AZ-286, AZ-289
F2: Point-type label drift (Low / Spec-Gap)
- Location:
_docs/02_document/tests/blackbox-tests.mdBT-06 / BT-10 / BT-12 vsSatelliteProvider.Services/RouteService.cs:66 - Description: Test spec says first/last point type is
original. Code emitsstart/action/endfor user-supplied points andintermediatefor interpolated. The spec's "original" appears to be a generic term for "user-supplied", which does not match any actual code value. RouteService unit tests assert the actual code values to keep tests honest. - Suggestion: Update
blackbox-tests.mdBT-06/BT-10/BT-12/BT-N* phrasing OR introduce an "original" alias in code. Either option is harmless but should be tracked. The traceability matrix should be updated to reflect the chosen wording. - Task: AZ-288 (and downstream test-spec sync in Step 12)
F3: Region status string drift (Low / Spec-Gap)
- Location:
_docs/02_document/tests/blackbox-tests.mdBT-03/BT-04 vsSatelliteProvider.Services/RegionService.cs:48(initial state ="queued") - Description: Spec uses "pending → processing → completed". Code uses "queued → processing → completed". Tests assert the code's actual transitions.
- Suggestion: Update test-spec to match code, or add a
"pending"alias in code. Same trade-off as F2. Track in test-spec sync (Step 12). - Task: AZ-287
Phase Summary
- Phase 1 (Context): AZ-286/287/288 specs loaded; ACs identified.
- Phase 2 (Spec compliance):
- AZ-286 AC-1: 3/4 (BT-01 ✓, BT-02 ✓ + BT-02b stale-version, BT-N02 ✓; BT-N01 deferred → F1).
- AZ-286 AC-2: ✓ (
ISatelliteDownloaderis mocked everywhere; no real Google Maps). - AZ-286 AC-3: ✓ (happy path + cache reuse + zoom validation negative).
- AZ-287 AC-1: ✓ (
RequestRegionAsync_InsertsEntityAndQueues_BT03_AC1). - AZ-287 AC-2: ✓ (
ProcessRegionAsync_HappyPath_TransitionsToCompletedAndWritesArtifacts_BT03_AC2_AC3— verifies "processing → completed"; initial "queued" is set inRequestRegionAsync). - AZ-287 AC-3: ✓ (CSV + summary files asserted on disk).
- AZ-287 AC-4: ✓ (
ProcessRegionAsync_StitchEnabled_SetsStitchedImagePath_BT05_AC4). - AZ-288 AC-1: ✓ (≤200m spacing iterated and verified).
- AZ-288 AC-2: ✓ (start/end/action/intermediate counts verified — see F2).
- AZ-288 AC-3: ✓ (
ComputesTotalDistanceViaHaversine_AC3cross-checksTotalDistanceMetersagainst summed Haversine distances). - AZ-288 AC-4: ✓ (BT-N03 < 2 points, region-size validation, BT-N04, BT-N05).
- Phase 3 (Quality): tests follow Arrange/Act/Assert; helpers (
BuildService,BuildRequest,MakeDownloaded) keep arrange sections small; no duplication. - Phase 4 (Security): no secrets, no injection vectors. The mock API key
"test-key"inGoogleMapsDownloaderZoomValidationTestsnever escapes the test (no HTTP performed). - Phase 5 (Performance): tests run in <1s total — no anti-patterns.
- Phase 6 (Cross-task): shared fixtures (
TestCoordinates) used uniformly. Mock setups consistent across test files. - Phase 7 (Architecture): tests sit in
SatelliteProvider.Tests/and consume only Public API of Common, DataAccess, Services permodule-layout.md. No layering violation. No new cycles. No duplicate symbols.
Test Run
Container: mcr.microsoft.com/dotnet/sdk:8.0
- Tests discovered: 31 (4 from Batch 1 + 27 new in Batch 2)
- Passed: 31 / 31
- Total time: 0.83s
Verdict Logic
3 Low findings, 0 Medium, 0 High, 0 Critical → PASS_WITH_WARNINGS.