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>
6.1 KiB
Module: Tests/SatelliteProvider.Tests
Purpose
Unit test project for component-internal logic. Original AZ-2/AZ-3 era had only a placeholder dummy; the suite has since grown across the AZ-285..AZ-380 baseline + cycle 1 (AZ-484) + cycle 2 (AZ-487, AZ-488) tracks. The "dummy test only" note in older revisions of this file is obsolete — the project now hosts the full unit suite executed by scripts/run-tests.sh --unit-only and CI's 01-test.yml.
Public Interface (test classes)
Existing baseline (pre-cycle-2) test classes cover TileService, RegionService, RouteService, geo math, repositories, validators, idempotency, and migration helpers — not enumerated exhaustively here. Cycle-2 additions:
AZ-487 + AZ-494 — JWT validation baseline + iss/aud
Authentication/AuthenticationServiceCollectionExtensionsTests— coversAddSatelliteJwtregistration +TokenValidationParametersshape across both AZs:- AZ-487 baseline:
AddSatelliteJwt_RegistersJwtBearerScheme,AddSatelliteJwt_ThrowsOnMissingSecret,AddSatelliteJwt_ThrowsOnShortSecret. - AZ-494 extension:
AddSatelliteJwt_ThrowsOnMissingIssuer,_ThrowsOnEmptyIssuer,_ThrowsOnMissingAudience,_ThrowsOnEmptyAudience, plus updated_ConfiguresTokenValidationParameters_AsPerContractand_PrefersEnvironmentVariableOverConfigurationassertingValidateIssuer = true+ValidIssuer+ValidateAudience = true+ValidAudience.
- AZ-487 baseline:
Authentication/JwtTokenFactoryTests—Create_ProducesTokenValidatedByMatchingParameters,CreateExpired_TokenFailsValidationWithLifetimeException,Create_WithExtraClaims_PropagatesClaimsThroughValidation,TamperSignature_TokenFailsValidationWithSignatureException. The factory itself lives inSatelliteProvider.TestSupportafter AZ-491 (single source of truth); this project consumes it viaProjectReference.
AZ-488 — UAV tile upload
UavTileQualityGateTests— one happy path + ≥ 1 reject path per rule (Rule 1 INVALID_FORMAT × 2, Rule 2 SIZE_OUT_OF_BAND × 2, Rule 3 WRONG_DIMENSIONS × 1, Rule 4 CAPTURED_AT_FUTURE / _TOO_OLD × 2, Rule 5 IMAGE_TOO_UNIFORM × 1) + rule-ordering determinism. Uses aFixedTimeProviderfor Rule-4 isolation andUavTileImageFactoryfor deterministic JPEG fixtures.UavTileUploadHandlerTests— end-to-end with a mockedITileRepository. Cycle-2 baseline: 1-item happy path, 3-item mixed batch (file written +InsertAsynccalled only for accepted), per-source UPSERT pass-through. AZ-503 additions:HandleAsync_TwoFlightsSameCell_ProduceDistinctIdsAndPathsButSameLocationHash(multi-flight coexistence with sharedlocation_hash);HandleAsync_IdenticalUpload_ProducesIdenticalIdAndDeterministicContentSha(idempotent re-insert preserves deterministicid+content_sha256).Authentication/PermissionsRequirementTests—PermissionsAuthorizationHandlercorrectly accepts apermissionsclaim shaped as a single string OR as a JSON array, rejects when the requested permission is absent, and short-circuits when the principal has nopermissionsclaim at all.TestUtilities/UavTileImageFactory— programmatic JPEG factories used by the gate + handler tests:CreateValidJpeg(width, height, seed),CreateUniformJpeg,CreatePng(for Rule 1 negative path).
AZ-503 — Tile identity foundation
Uuidv5Tests— pure-C# UUIDv5 generator parity tests.Create_MatchesPythonReferenceVectors_AC1pins 10 reference vectors generated by Python'suuid.uuid5(TILE_NAMESPACE, name);Create_IsDeterministicasserts repeated runs return the sameGuid;Create_SetsVersionAndVariantBitsasserts the version nibble is5and the variant top-2-bits are10(RFC 9562 §5.5).UavTileFilePathTests(rewritten for AZ-503 from the cycle-2 placeholder) — coversBuildUavTileFilePath(Guid? flightId, int z, int x, int y)across three cases:BuildUavTileFilePath_AnonymousFlight_UsesNoneSegment(nullflightId→ literalnonesegment),BuildUavTileFilePath_PerFlight_UsesFlightIdDirectory(per-flight segment),BuildUavTileFilePath_DifferentFlights_ProduceDifferentPaths(path-distinctness across flights at the same cell). Integer-typed coordinates and theGuid? flightIdparameter together still preclude string-injection path traversal.
Internal Logic
- Tests follow Arrange / Act / Assert. Time-dependent paths inject a
FixedTimeProvider(cycle-2 addition) so Rule 4 has deterministic age windows. JwtSecurityTokenHandler.MapInboundClaims = falseis set explicitly in JWT tests so claims read by their original names (sub,permissions, …) rather than the framework-remapped names.
Dependencies
- Project references:
SatelliteProvider.Services.TileDownloader,SatelliteProvider.Services.RegionProcessing,SatelliteProvider.Services.RouteManagement,SatelliteProvider.Common,SatelliteProvider.DataAccess,SatelliteProvider.Api(for the Authentication tests — added in AZ-487),SatelliteProvider.TestSupport(added by AZ-491; provides the canonicalJwtTokenFactoryconsumed by both this project andSatelliteProvider.IntegrationTests). - NuGet: xUnit (2.5.3), Moq (4.20.72), FluentAssertions (8.8.0), coverlet.collector (6.0.0), Microsoft.NET.Test.Sdk (17.8.0), Microsoft.Extensions.* (Caching.Memory, Configuration, DI, Logging, Options, Http — all bumped from 9.0.10 → 10.0.7 by AZ-500 as a coordinated cycle-4 move),
Microsoft.AspNetCore.Authentication.JwtBearer10.0.7 (consumed transitively via theProjectReferencetoSatelliteProvider.Api; AZ-487 added the dependency at 8.0.21, AZ-496 bumped it to 8.0.25, AZ-500 bumped it to 10.0.7),SixLabors.ImageSharp3.1.11 (added by AZ-488 for the gate tests). appsettings.jsoncopied to output (used by Authentication tests for theJwtsection binding scenario).
Consumers
- CI pipeline (
01-test.yml) andscripts/run-tests.sh --unit-onlyrundotnet testagainst this project.
Tests
This IS the test module. Cycle-2 added ~25 unit tests on top of the existing baseline; cycle-5 (AZ-503) added 6 more (3 in Uuidv5Tests, 3 in UavTileFilePathTests) plus 2 new methods in UavTileUploadHandlerTests. The full project executes in seconds (no external services required).