mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-21 11:31:14 +00:00
e3cd388577
Step 13 (Update Docs) for cycle 2. Most cross-cutting docs were already updated during Step 10 (architecture.md, glossary.md, components/03_tile_downloader, modules/api_program.md, data_model.md, contracts/api/uav-tile-upload.md). This commit completes the remaining module-level + module-layout updates and writes the cycle-2 ripple log. * modules/common_configs.md: + UavQualityConfig section and appsettings-section row (UavQuality). * modules/common_dtos.md: + UavTileMetadata, UavTileBatchMetadataPayload, UavTileBatchUploadResponse, UavTileUploadResultItem, UavTileUploadStatus, UavTileRejectReasons (closed enumeration v1.0.0). * module-layout.md: refresh Common (+ UavQualityConfig + UAV DTOs), TileDownloader (+ UavTileQualityGate, UavTileUploadHandler, + SixLabors.ImageSharp 3.1.11 PackageReference), and WebApi (+ Authentication/*, DTOs/UavTileBatchUploadRequest, + JwtBearer 8.0.21 PackageReference). Updates the "Last Updated" stamp to cycle 2. * modules/tests_unit.md: replace the obsolete "only a dummy test" description; add cycle-2 AZ-487 / AZ-488 test classes (AuthenticationServiceCollectionExtensionsTests, JwtTokenFactoryTests, UavTileQualityGateTests, UavTileUploadHandlerTests, UavTileFilePathTests, PermissionsRequirementTests) + new ProjectReference / package references. * modules/tests_integration.md: + JwtIntegrationTests, UavUploadTests (incl. wall-clock-seeded coordinate counter rationale from the Step 11 fix), and the StubAndErrorContractTests update for the removed 501 stub. * ripple_log_cycle2.md (new): cycle-2 reverse-dependency scan results showing every importer of the new symbols resolves inside the three already-updated components (WebApi, TileDownloader, Common). No unexpected ripple, no heuristic fallback needed. Co-authored-by: Cursor <cursoragent@cursor.com>
13 KiB
13 KiB
Module Layout
Status: derived-from-code
Language: csharp Layout Convention: custom (per-component .csproj per logical component) Root: ./ Last Updated: 2026-05-11 (cycle 2 — AZ-487 JWT validation baseline + AZ-488 UAV tile upload added; supersedes prior post-AZ-350 update)
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()).
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.cs
- 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):
Microsoft.AspNetCore.Authentication.JwtBearer8.0.21 (pinned to the same minor as the existing ASP.NET Core 8 packages). - 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 geospatial utility functions (coordinate math, distance, bearing)
- Consumed by: TileDownloader, RegionProcessing, RouteManagement
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.
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.