Step 12 (Test-Spec Sync, cycle-update mode): - blackbox-tests.md: append BT-23..BT-26 for AZ-505's new observable behaviors (inventory order/shape; leaflet most-recent via location_hash; HTTP/2 multiplex over TLS+ALPN; request validation). - performance-tests.md: append PT-09 (inventory p95 ≤ 1000ms / 2500 tiles); records cycle-6 measured p95=66ms; documents promotion path to scripts/run-performance-tests.sh if budget ever tightens. - traceability-matrix.md: resolve the 5 AZ-503 deferrals (AC-5/6/9/10/12) by pointing at AZ-505 test names + add 7 AZ-505 AC rows (AC-1..AC-7) + bump totals (90 -> 94 tests, 56/56 -> 63/63 in-scope) + add cycle-6 coverage shape notes (budget relaxation rationale, voting-filter deferral note, TLS+ALPN pivot, NFR propagation). Step 13 (Update Docs, task mode): - common_dtos.md: add 5 new TileInventory DTOs. - common_interfaces.md: add ITileService.GetInventoryAsync. - services_tile_service.md: document TileService.GetInventoryAsync steps + the XOR-validation-in-handler note. - dataaccess_migrator.md: bump migration count 14 -> 15; describe migration 015 (AZ-505 leaflet covering index, lock window, INCLUDE-list trade-off). - system-flows.md: add F7 (Leaflet Tile Serving, AZ-310 + AZ-505 location_hash rewire + TLS+ALPN) and F8 (Tile Inventory Bulk Lookup) with sequence diagrams, validation surface, and AC-4 perf evidence. Update Flow Inventory + Dependencies tables accordingly. - glossary.md: add "Tile Inventory" entry pointing at the v1.0.0 contract. - ripple_log_cycle6.md: new file — exhaustive reverse-dependency analysis confirms zero stale downstream module docs. Advance autodev state from step 11 -> 14 (skipping 12+13 as completed in this commit; auto-chain through Step 14 = Security Audit optional gate). Co-authored-by: Cursor <cursoragent@cursor.com>
9.0 KiB
Module: Common/DTO
Purpose
Data transfer objects used across all layers — API requests/responses, inter-service communication, and queue messages.
Public Interface
GeoPoint
Geographic coordinate with tolerance-based equality.
Lat(double): latitude, JSON property"lat"Lon(double): longitude, JSON property"lon"- Constructor:
GeoPoint(),GeoPoint(double lat, double lon) - Equality: two points are equal if both coordinates differ by less than
0.00005(PRECISION_TOLERANCE) - Operator overloads:
==,!=
Direction
Result of a directional calculation between two points.
Distance(double): distance in metersAzimuth(double): bearing in degrees (0–360)
SatTile
Represents a single map tile with its spatial bounds.
X,Y(int): tile coordinates in the slippy map schemeZoom(int): zoom levelLeftTop,BottomRight(GeoPoint): computed bounding box corners (viaGeoUtils.TileToWorldPos)Url(string): download URLFileName → string: formatted as{X}.{Y}.{Zoom}.jpg
TileMetadata
Metadata about a stored tile (mirrors TileEntity but without DB-specific concerns).
Id(Guid),TileZoom,TileX,TileY(int),Latitude,Longitude(double)TileSizeMeters(double),TileSizePixels(int),ImageType(string)Version(int?),FilePath(string)CreatedAt,UpdatedAt(DateTime)
RegionRequest
Queue message for async region processing.
Id(Guid),Latitude,Longitude(double),SizeMeters(double)ZoomLevel(int),StitchTiles(bool)
RegionStatus
Response DTO for region status queries.
Id(Guid),Status(string),CsvFilePath,SummaryFilePath(string?)TilesDownloaded,TilesReused(int),CreatedAt,UpdatedAt(DateTime)
RoutePoint
Input point in a route creation request.
Latitude(double, JSON:"lat"),Longitude(double, JSON:"lon")
RoutePointDto
Output point in a route response (includes computed fields).
Latitude,Longitude(double),PointType(string: "start"/"end"/"action"/"intermediate")SequenceNumber,SegmentIndex(int),DistanceFromPrevious(double?)
CreateRouteRequest
API request body for route creation.
Id(Guid),Name(string),Description(string?)RegionSizeMeters(double),ZoomLevel(int)Points(List<RoutePoint>),Geofences(Geofences?)RequestMaps(bool),CreateTilesZip(bool)
RouteResponse
API response for route queries.
- All fields from the route entity plus
Points(List<RoutePointDto>) MapsReady(bool),TilesZipPath(string?)
GeofencePolygon
Axis-aligned bounding box defined by NW and SE corners.
NorthWest(GeoPoint?),SouthEast(GeoPoint?)
Geofences
Container for multiple geofence polygons.
Polygons(List<GeofencePolygon>)
UavTileMetadata (added AZ-488, extended AZ-503)
Per-tile metadata payload inside a UAV batch upload (POST /api/satellite/upload). Indexed-correlated with the multipart IFormFileCollection.
Latitude,Longitude(double)TileZoom(int)TileSizeMeters(double)CapturedAt(DateTime, UTC; subject to AZ-488 Rule 4 future-skew / age checks)FlightId(Guid?, JSON:"flightId") — AZ-503 optional flight identifier. When set, the per-itemtiles.idbecomesUuidv5(TileNamespace, "{z}/{x}/{y}/uav/{flightId}"), the on-disk path is./tiles/uav/{flightId}/{z}/{x}/{y}.jpg, and the UPSERT conflict key separates this row from rows belonging to other flights at the same cell. Whennull, the per-item id uses the zero-UUID00000000-0000-0000-0000-000000000000placeholder and the on-disk path uses the literalnonesegment (./tiles/uav/none/{z}/{x}/{y}.jpg). The placeholder UUID is purely a key-space marker — it never lands in theflight_idcolumn (which staysNULL); the UPSERT usesCOALESCE(flight_id, '00000000-...')for the conflict check.
UavTileBatchMetadataPayload (added AZ-488)
JSON envelope deserialized from the metadata form field of a UAV batch upload.
Items(IReadOnlyList<UavTileMetadata>)
UavTileBatchUploadResponse (added AZ-488)
Wire response for POST /api/satellite/upload. Returned with HTTP 200 regardless of per-item outcomes; envelope-level failures (auth, oversize, deserialization) bypass this shape.
Items(List<UavTileUploadResultItem>)
UavTileUploadResultItem (added AZ-488)
Per-item result inside UavTileBatchUploadResponse.
Index(int): zero-based index into the request batch.Status(string): one ofUavTileUploadStatus.Accepted/UavTileUploadStatus.Rejected.TileId(Guid?): set on accept (matches the new/updatedtiles.id); null on reject.RejectReason(string?): closed-enum reason code fromUavTileRejectReasons; null on accept.RejectDetails(string?): short human-readable note. MUST NOT leak server-internal paths / exception types / hostnames (AZ-488 Security NFR; covered by SEC-11).
UavTileUploadStatus (added AZ-488, static string constants)
Accepted = "accepted"Rejected = "rejected"
UavTileRejectReasons (added AZ-488, static string constants — closed enumeration v1.0.0)
Authoritative reject-reason codes for the UAV upload quality gate. Adding a new code requires a minor-version bump of _docs/02_document/contracts/api/uav-tile-upload.md.
InvalidFormat = "INVALID_FORMAT"— Rule 1 (content-type or JPEG magic bytes).SizeOutOfBand = "SIZE_OUT_OF_BAND"— Rule 2 (bytes outside[MinBytes, MaxBytes]).WrongDimensions = "WRONG_DIMENSIONS"— Rule 3 (image width/height ≠MapConfig.TileSizePixels).CapturedAtFuture = "CAPTURED_AT_FUTURE"— Rule 4 (timestamp ahead of now +CapturedAtFutureSkewSeconds).CapturedAtTooOld = "CAPTURED_AT_TOO_OLD"— Rule 4 (timestamp older thanMaxAgeDays).ImageTooUniform = "IMAGE_TOO_UNIFORM"— Rule 5 (luminance variance belowMinLuminanceVariance).StorageFailure = "STORAGE_FAILURE"— reserved for the orphan-row-recovery path when the on-disk write succeeds but the DB UPSERT fails; surfaced per-item without failing the envelope (AZ-488 Reliability NFR).
TileCoord (added AZ-505)
Single tile coordinate triple used by the inventory endpoint Form A request shape and as the per-entry input echo on the response.
TileZoom(int) — slippy zoom level.TileX,TileY(int) — slippy x/y at that zoom.- Defined in
SatelliteProvider.Common/DTO/TileInventory.cs. Matchestile-inventory.mdv1.0.0 Shape.
TileInventoryRequest (added AZ-505)
API request body for POST /api/satellite/tiles/inventory. Carries one of two XOR-exclusive batch shapes.
Tiles(IReadOnlyList<TileCoord>?) — Form A: coords-by-value. The server computeslocation_hash = Uuidv5(TileNamespace, "{z}/{x}/{y}")per entry.LocationHashes(IReadOnlyList<Guid>?) — Form B: hashes-by-reference. Used when the caller already has UUIDv5 location hashes (typical for the onboard cross-repo path).- Exactly one of
Tiles/LocationHashesmust be populated and non-empty; both-populated or neither → HTTP 400 (tile-inventory.mdInv-1). - Total entries (in either field) ≤
TileInventoryLimits.MaxEntriesPerRequest(5000); over-cap → HTTP 400 (Inv-7).
TileInventoryEntry (added AZ-505)
Per-entry result inside TileInventoryResponse. One entry per request entry, in the SAME order as the request (tile-inventory.md Inv-2).
LocationHash(Guid) — always populated; UUIDv5 of"{z}/{x}/{y}"fromUuidv5.LocationHashForTile(Form A) or echoed from request (Form B).Present(bool) —trueiff a row exists intileswith thislocation_hash(Inv-4).Id(Guid?) —tiles.idof the most-recent row across sources/flights (captured_at DESC, updated_at DESC, id DESC, Inv-5); null whenPresent=false(Inv-6).CapturedAt(DateTime?),Source(string?),FlightId(Guid?),ResolutionMPerPx(double?) — populated on the most-recent row; all null whenPresent=false.
TileInventoryResponse (added AZ-505)
API response body for POST /api/satellite/tiles/inventory.
Results(IReadOnlyList<TileInventoryEntry>) — one entry per request entry;Results.Countalways equals the request entry count (Inv-2).
TileInventoryLimits (added AZ-505, static constants)
MaxEntriesPerRequest = 5000— request-body cap enforced by the inventory handler (Inv-7).
Internal Logic
GeoPointuses a precision tolerance of0.00005degrees (~5.5 meters) for equality comparison.SatTileeagerly computes its bounding box corners on construction by callingGeoUtils.TileToWorldPos.
Dependencies
GeoPoint,Direction— no importsSatTile→SatelliteProvider.Common.Utils.GeoUtils- All others — no internal dependencies (or only
System.Text.Json.Serialization)
Consumers
- All services, repositories, and API endpoints consume these DTOs
RegionRequestis the message type forIRegionRequestQueue
Data Models
These ARE the data models (DTOs). They map closely to the database entities but are decoupled from the persistence layer.
Configuration
None consumed directly.
External Integrations
None.
Security
None.
Tests
No dedicated DTO tests.