Wrap up cycle 5 verification + documentation: - Steps 10/11 wrap-up reports (implementation_completeness + implementation_report) for the AZ-503-foundation + AZ-504 batch. - Step 12 test-spec sync: AZ-503-foundation/AZ-504 ACs appended; AZ-505 deferred ACs recorded. - Step 13 update-docs: architecture, data-model, glossary, module- layout, uav-tile-upload contract (v1.1.0), DataAccess + Services + Tests module docs synced; new common_uuidv5.md module doc. - Step 14 security audit: PASS_WITH_WARNINGS; 0 new Critical/High; 2 new Low informational (F1 flightId provenance, F2 pgcrypto deploy gap). - Step 15 performance test: PASS_WITH_INFRA_WARNINGS; PT-08 passed twice (AZ-504 fix verified); PT-01/02 failed due to recurring local Docker/colima DNS cold-start (not an app regression). Cycle-3 perf-harness leftover stays OPEN with replay #5 documented. - Autodev state moved to Step 16 (Deploy). Co-authored-by: Cursor <cursoragent@cursor.com>
18 KiB
Module Layout
Status: derived-from-code
Language: csharp
Layout Convention: custom (per-component .csproj per logical component)
Root: ./
Last Updated: 2026-05-12 (cycle 5 — AZ-503 tile-identity foundation added: SatelliteProvider.Common/Utils/Uuidv5.cs, migration 014_AddTileIdentityColumns.sql, 4 new TileEntity columns, integer-only flight-aware UPSERT, IntegrationTests → Common ProjectReference)
Layout Rules
- Each component owns ONE top-level project directory (
.csprojboundary). The previous sharedSatelliteProvider.Servicesproject was split into three per-component csprojs in epic AZ-309. - Shared code lives under
SatelliteProvider.Common/— the foundation layer. - Cross-cutting concerns (DTOs, interfaces, configs, geo-math, common exceptions) all reside in Common.
- Public API surface per component =
publictypes in the namespace root. Everything markedinternalor private is internal. - Tests live in separate projects:
SatelliteProvider.Tests/(unit) andSatelliteProvider.IntegrationTests/(integration). - DI registration per component lives in a
<Component>ServiceCollectionExtensions.csadjacent to the component's classes (e.g.TileDownloaderServiceCollectionExtensions.AddTileDownloader()).
Documentation Layout (canonical — AZ-495)
Each Layer-3 service component (Common, DataAccess, TileDownloader, RegionProcessing, RouteManagement) owns one description file under _docs/02_document/components/0N_<name>/description.md. The numeric prefix (01_common ... 05_route_management) matches the architectural-layer order — not the alphabetical order.
The WebApi component (SatelliteProvider.Api) intentionally does NOT have a components/* folder. Its documentation lives in _docs/02_document/modules/api_program.md. The rationale is that WebApi is the orchestrator / entry-point at Layer 4 rather than a Layer-3 service component — its concerns are minimal-API endpoint mapping, DI composition, and middleware chain composition, all of which are documented at module-level alongside the other process-level concerns (tests_unit.md, tests_integration.md, migrations.md). Splitting WebApi documentation into a component-stub plus a module file would create two sources of truth.
When authoring or reading a task that touches WebApi, use _docs/02_document/modules/api_program.md as the documentation anchor. Task-spec templates and the new-task / decompose skills point at this path; the components/06_web_api/ folder is intentionally absent and MUST NOT be created.
The cycle-1 (AZ-487) and cycle-2 (AZ-488) code reviews each surfaced an F1 (Low / Style) finding because task specs referenced the non-existent components/01_web_api/description.md path. AZ-495 settles this convention; the finding should not recur.
Per-Component Mapping
Component: Common
- Directory:
SatelliteProvider.Common/ - Public API:
SatelliteProvider.Common/Configs/MapConfig.csSatelliteProvider.Common/Configs/StorageConfig.csSatelliteProvider.Common/Configs/ProcessingConfig.csSatelliteProvider.Common/Configs/DatabaseConfig.csSatelliteProvider.Common/Configs/UavQualityConfig.cs(added by AZ-488; UAV quality-gate + request-envelope knobs)SatelliteProvider.Common/DTO/*.cs(all DTOs; AZ-488 addedUavTileMetadata,UavTileBatchMetadataPayload,UavTileBatchUploadResponse,UavTileUploadResultItem,UavTileUploadStatus,UavTileRejectReasons— placed in Common to keepTileDownloaderfrom depending on the API layer)SatelliteProvider.Common/Enums/RegionStatus.csSatelliteProvider.Common/Enums/RoutePointType.csSatelliteProvider.Common/Enums/TileSource.cs(added by AZ-484; backed by thetile-storagev1.0.0 contract)SatelliteProvider.Common/Enums/TileSourceConverter.cs(added by AZ-484; convertsTileSourceenum to/from the snake_case wire string used byTileEntity.Source)SatelliteProvider.Common/Exceptions/RateLimitException.csSatelliteProvider.Common/Interfaces/*.cs(all service interfaces)SatelliteProvider.Common/Utils/GeoUtils.csSatelliteProvider.Common/Utils/Uuidv5.cs(added by AZ-503; deterministic UUIDv5 generator + cross-repoTileNamespaceconstant pinned to5b8d0c2e-7f1a-4d3b-9c5e-1f3a8e7d2b6c)
- Internal: (none — all types are public, shared across components)
- Owns:
SatelliteProvider.Common/** - Imports from: (none)
- Consumed by: DataAccess, TileDownloader, RegionProcessing, RouteManagement, WebApi
Component: DataAccess
- Directory:
SatelliteProvider.DataAccess/ - Public API:
SatelliteProvider.DataAccess/Models/TileEntity.csSatelliteProvider.DataAccess/Models/RegionEntity.csSatelliteProvider.DataAccess/Models/RouteEntity.csSatelliteProvider.DataAccess/Models/RoutePointEntity.csSatelliteProvider.DataAccess/Repositories/ITileRepository.csSatelliteProvider.DataAccess/Repositories/IRegionRepository.csSatelliteProvider.DataAccess/Repositories/IRouteRepository.csSatelliteProvider.DataAccess/Repositories/TileRepository.csSatelliteProvider.DataAccess/Repositories/RegionRepository.csSatelliteProvider.DataAccess/Repositories/RouteRepository.csSatelliteProvider.DataAccess/DatabaseMigrator.cs
- Internal: (none — all repository types are public for DI registration)
- Owns:
SatelliteProvider.DataAccess/** - ProjectReferences:
SatelliteProvider.Common - Imports from:
SatelliteProvider.Common.Enums(6 sites:RegionRepository,IRegionRepository,Models/RegionEntity,Models/RoutePointEntity,TypeHandlers/EnumStringTypeHandler,Models/TileEntity— referencesTileSourceConverter.GoogleMapsWireValueconst for the AZ-484 default value);SatelliteProvider.Common.Configs(MapConfig.DefaultTileSizePixelsinTileRepository);SatelliteProvider.Common.Utils(GeoUtils.EarthEquatorialCircumferenceMeters,GeoUtils.MetersPerDegreeLatitudeinTileRepository). - Consumed by: TileDownloader, RegionProcessing, RouteManagement, WebApi
Component: TileDownloader
- Directory:
SatelliteProvider.Services.TileDownloader/ - csproj:
SatelliteProvider.Services.TileDownloader/SatelliteProvider.Services.TileDownloader.csproj - Public API:
SatelliteProvider.Services.TileDownloader/GoogleMapsDownloaderV2.cs(implementsISatelliteDownloader)SatelliteProvider.Services.TileDownloader/TileService.cs(implementsITileService)SatelliteProvider.Services.TileDownloader/UavTileQualityGate.cs+IUavTileQualityGate(added by AZ-488; 5-rule synchronous validator overReadOnlyMemory<byte>JPEGs, usesSixLabors.ImageSharp3.1.11 +TimeProvider)SatelliteProvider.Services.TileDownloader/UavTileUploadHandler.cs+IUavTileUploadHandler(added by AZ-488; orchestrates batch validation → file-first persistence →ITileRepository.InsertAsyncUPSERT; owns the UAV./tiles/uav/{z}/{x}/{y}.jpgpath layout)SatelliteProvider.Services.TileDownloader/TileDownloaderServiceCollectionExtensions.cs(DI:AddTileDownloader()— also registers the AZ-488 quality gate and upload handler as singletons)
- Internal: (none)
- Owns:
SatelliteProvider.Services.TileDownloader/** - ProjectReferences:
SatelliteProvider.Common,SatelliteProvider.DataAccess - PackageReferences (added by AZ-488):
SixLabors.ImageSharp3.1.11 (image identify /L8decode / downsample for the variance heuristic). - Imports from: Common, DataAccess
- Consumed by: RegionProcessing (via
ITileServicefrom Common; no direct ProjectReference), WebApi
Component: RegionProcessing
- Directory:
SatelliteProvider.Services.RegionProcessing/ - csproj:
SatelliteProvider.Services.RegionProcessing/SatelliteProvider.Services.RegionProcessing.csproj - Public API:
SatelliteProvider.Services.RegionProcessing/RegionService.cs(implementsIRegionService)SatelliteProvider.Services.RegionProcessing/RegionProcessingService.cs(background hosted service)SatelliteProvider.Services.RegionProcessing/RegionRequestQueue.cs(implementsIRegionRequestQueue)SatelliteProvider.Services.RegionProcessing/RegionProcessingServiceCollectionExtensions.cs(DI:AddRegionProcessing())
- Internal: (none)
- Owns:
SatelliteProvider.Services.RegionProcessing/** - ProjectReferences:
SatelliteProvider.Common,SatelliteProvider.DataAccess - Imports from: Common, DataAccess (uses
ITileServicefrom Common — no compile-time dependency on TileDownloader) - Consumed by: RouteManagement (via
IRegionServiceandIRegionRequestQueuefrom Common; no direct ProjectReference), WebApi
Component: RouteManagement
- Directory:
SatelliteProvider.Services.RouteManagement/ - csproj:
SatelliteProvider.Services.RouteManagement/SatelliteProvider.Services.RouteManagement.csproj - Public API:
SatelliteProvider.Services.RouteManagement/RouteService.cs(implementsIRouteService)SatelliteProvider.Services.RouteManagement/RouteProcessingService.cs(background hosted service)SatelliteProvider.Services.RouteManagement/RouteManagementServiceCollectionExtensions.cs(DI:AddRouteManagement())
- Internal: (none)
- Owns:
SatelliteProvider.Services.RouteManagement/** - ProjectReferences:
SatelliteProvider.Common,SatelliteProvider.DataAccess - Imports from: Common, DataAccess (uses
IRegionService/IRegionRequestQueuefrom Common — no compile-time dependency on RegionProcessing) - Consumed by: WebApi
Component: WebApi
- Directory:
SatelliteProvider.Api/ - Public API:
SatelliteProvider.Api/Program.cs(minimal API endpoints, DI setup, middleware chain —UseAuthentication+UseAuthorizationadded in AZ-487;/api/satellite/uploadrewired in AZ-488)SatelliteProvider.Api/Authentication/AuthenticationServiceCollectionExtensions.cs(added by AZ-487;AddSatelliteJwt(IConfiguration)registersJwtBearerwith the suite-wide HS256 contract fromsuite/_docs/10_auth.md; validatesJWT_SECRET≥ 32 bytes at startup)SatelliteProvider.Api/Authentication/PermissionsRequirement.cs+PermissionsAuthorizationHandler+SatellitePermissions(added by AZ-488; custom requirement that accepts apermissionsclaim shaped as either a single string or a JSON array; powers theUavUploadPolicyrequiring theGPSpermission)SatelliteProvider.Api/DTOs/UavTileBatchUploadRequest.cs(added by AZ-488; multipart form binding envelope — kept in WebApi because it depends onIFormFileCollection+[FromForm], both API-layer types)
- Internal: (none)
- Owns:
SatelliteProvider.Api/** - PackageReferences (added by AZ-487, bumped by AZ-496, then by AZ-500):
Microsoft.AspNetCore.Authentication.JwtBearer10.0.7 (pinned to the same minor patch asMicrosoft.AspNetCore.OpenApi10.0.7; AZ-496 bumped both packages from 8.0.21 → 8.0.25 in cycle 3 to close cycle-1 D1 + cycle-2 D3 supply-chain findings, then AZ-500 bumped both 8.0.25 → 10.0.7 in cycle 4 as part of the .NET 8 → .NET 10 migration; AZ-500 also bumpedSwashbuckle.AspNetCore6.6.2 → 10.1.7 here to land Microsoft.OpenApi 2.x compat required by ASP.NET Core 10). - Imports from: Common (incl. AZ-488 UAV DTOs +
UavQualityConfig), DataAccess, TileDownloader (incl. AZ-488IUavTileUploadHandler), RegionProcessing, RouteManagement - Consumed by: (none — top-level entry point)
Shared / Cross-Cutting
Common/Configs
- Directory:
SatelliteProvider.Common/Configs/ - Purpose: Strongly-typed configuration POCOs bound via
IOptions<T> - Consumed by: all components
Common/DTO
- Directory:
SatelliteProvider.Common/DTO/ - Purpose: Data transfer objects shared across layers (request/response models, value types)
- Consumed by: all components
Common/Interfaces
- Directory:
SatelliteProvider.Common/Interfaces/ - Purpose: Service contracts enabling DI and testability
- Consumed by: all components (services implement, API and consumers depend on)
Common/Utils
- Directory:
SatelliteProvider.Common/Utils/ - Purpose: Stateless utility functions — geospatial (
GeoUtils: coordinate math, distance, bearing) and identity (Uuidv5: deterministic UUIDv5 generator + cross-repoTileNamespaceconstant, added by AZ-503). - Consumed by: TileDownloader, RegionProcessing, RouteManagement, IntegrationTests (AZ-503 added a
ProjectReferencefromSatelliteProvider.IntegrationTeststoSatelliteProvider.Commonso test seeders can callUuidv5.Createdirectly instead of duplicating the algorithm)
Common/Enums
- Directory:
SatelliteProvider.Common/Enums/ - Purpose: Domain enums shared across layers (
RegionStatus,RoutePointType,TileSource) plus their explicit wire-value converters when persistence requires snake_case strings (TileSourceConverter). Converter classes belong here — not in DataAccess — because they encode a domain-level vocabulary that must be visible to every component. - Consumed by: DataAccess (entity defaults, type handler registration), TileDownloader (sets
TileEntity.SourceviaTileSourceConverter.ToWireValue), Tests - Important constraint: Dapper's
SqlMapper.TypeHandler<TEnum>is bypassed for enum reads (Dapper issue #259 — see_docs/LESSONS.mdL-001). For any new enum that must round-trip through a database column, prefer thestring-on-entity +Enum-at-API-boundary pattern with a converter class in this folder. Do NOT register aTypeHandler<TEnum>and assume it will be honored on reads.
TestSupport (added by AZ-491; extended by AZ-493)
- Directory:
SatelliteProvider.TestSupport/ - csproj:
SatelliteProvider.TestSupport/SatelliteProvider.TestSupport.csproj(class library, no test framework) - Purpose: Canonical home for cross-project test utilities. Currently holds
JwtTokenFactory(HS256 token minting + signature tampering) andIntegrationTestResetGuard(pure-string guard for the integration-test DB-reset hook). Replaces the cycle-2 duplicate that lived in bothSatelliteProvider.Tests/TestUtilities/JwtTokenFactory.csandSatelliteProvider.IntegrationTests/JwtTestHelpers.csand required parallel fixes. Future additions: shared image-fixture factories, shared deterministic clocks / test-data builders that need to be visible to both unit and integration projects. - Public API:
SatelliteProvider.TestSupport/JwtTokenFactory.cs(Create,CreateExpired,TamperSignature) — added by AZ-491.SatelliteProvider.TestSupport/IntegrationTestResetGuard.cs(EnsureGuardPassesOrThrow,AllowedHosts,EnvironmentEnvVar,TestingEnvironment) — added by AZ-493. Pure static class — no I/O, no DB calls. Consumed bySatelliteProvider.IntegrationTests/IntegrationTestDatabaseReset.cs(instance class that owns the Npgsql side effects) and unit-tested inSatelliteProvider.Tests/TestSupport/IntegrationTestResetGuardTests.cs.
- PackageReferences:
Microsoft.IdentityModel.Tokens7.0.3,System.IdentityModel.Tokens.Jwt7.0.3 (matches the integration tests' pre-AZ-491 explicit reference). The AZ-493 guard introduced no new package dependencies — it is pure string comparison over the BCL. - Consumed by:
SatelliteProvider.Tests,SatelliteProvider.IntegrationTests(both viaProjectReference). - Not consumed by: production projects (
Api,Common,DataAccess,Services.*). The TestSupport library is test-only by design; production code must NOT depend on it. - Runner-side concerns NOT in TestSupport:
SatelliteProvider.IntegrationTests/JwtTestHelpers.csretainsResolveSecretOrThrow,AttachDefaultAuthorization, and theDefaultSubject = "integration-tests"constant — these are runner-specific (env-var reads,HttpClientmutation, runner-identity subject) and intentionally not consolidated.SatelliteProvider.IntegrationTests/IntegrationTestDatabaseReset.cs(AZ-493) holds the Npgsql side effects of the reset — it sits in the integration-tests project (not TestSupport) so the Npgsql dependency doesn't leak into unit tests.SatelliteProvider.IntegrationTests/PerfBootstrap.cs(AZ-492) holds the--mint-only/--gen-uav-fixturesubcommands consumed byscripts/run-performance-tests.sh; it sits in IntegrationTests (not TestSupport) so the SixLabors.ImageSharp dependency stays out of unit tests, while the token-mint surface delegates toSatelliteProvider.TestSupport.JwtTokenFactory.Create— no third copy of the JWT logic.
Allowed Dependencies (layering)
| Layer | Components | May import from (compile-time ProjectReferences) |
|---|---|---|
| 4. API / Entry | WebApi | Common, DataAccess, TileDownloader, RegionProcessing, RouteManagement |
| 3. Application | TileDownloader, RegionProcessing, RouteManagement | Common, DataAccess only — siblings communicate through interfaces in Common, never through direct ProjectReferences |
| 1. Foundation | Common (leaf-most), DataAccess | Common: (none); DataAccess: Common only — Common MUST NOT import from DataAccess |
Key constraint enforced by the AZ-309 split: the three Layer-3 components are compile-time siblings. Any cross-sibling call (e.g. RegionProcessing invoking tile download) MUST go through an interface defined in SatelliteProvider.Common.Interfaces and resolved via DI — adding a ProjectReference between siblings is now structurally impossible without re-introducing the coupling the refactor removed.
Verification
- No detected cycles: The dependency graph is a clean DAG.
- No cross-sibling ProjectReferences: TileDownloader, RegionProcessing, and RouteManagement each reference only Common + DataAccess. Verified by inspecting all three csproj files.
- DataAccess layer placement: DataAccess sits at Layer 1 (Foundation) alongside Common because it is consumed uniformly by all service components. It is one half-step above Common because it depends on Common for shared enums and a small number of constants/configs.
- DataAccess→Common ProjectReference: confirmed present in
SatelliteProvider.DataAccess.csprojline 18 and used by 7 source sites (5 enum imports, 1MapConfig.DefaultTileSizePixelssite, 1GeoUtils.*site). The earlier compliance baseline F5 entry that claimed "DataAccess has no Common dependency" was inaccurate — bothmodule-layout.mdandarchitecture_compliance_baseline.mdwere corrected during the 03-code-quality-refactoring run (2026-05-11). The actual constraint that holds is one-way:CommonMUST NOT import fromDataAccess.