From 208077fddf4e2f37aa86e5965d1ff8fc826e3037 Mon Sep 17 00:00:00 2001 From: donghyeon-ka Date: Thu, 24 Sep 2026 11:15:10 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=A6=AC=ED=8E=99=ED=86=A0?= =?UTF-8?q?=EB=A7=81=20=EC=A7=84=ED=96=89=EC=A4=91=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20gradle=EC=9D=80=20=EC=96=87=EA=B2=8C=20=EC=9C=A0?= =?UTF-8?q?=EC=A7=80,=20=EA=B0=81=20=EB=AA=A8=EB=93=88=EC=97=90=EC=84=9C?= =?UTF-8?q?=20=EC=B2=98=EB=A6=AC=ED=95=98=EA=B3=A0=20=EC=9E=88=EB=8A=94=20?= =?UTF-8?q?=EB=B6=80=EB=B6=84=EC=97=90=20=EB=8C=80=ED=95=B4=EC=84=9C=20?= =?UTF-8?q?=EB=A6=AC=ED=8E=99=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/CODEOWNERS | 1 - .github/workflows/ci-quality-gates.yml | 30 + .github/workflows/integration-main.yml | 35 +- docker-compose.yml | 7 +- docs/architecture/jpa-api-surface.txt | 29 +- docs/capability-status.md | 51 ++ docs/httpclient/env-fields.yaml | 2 + docs/notification/api-surface-snapshot.txt | 1 - docs/registries/env-keys.yaml | 14 + ...-23-techlead-review-application-closure.md | 739 ++++++++++++++++++ ...23-app-bootstrap-build-composition-plan.md | 272 +++++++ infra/redis-sdk/acl/README.md | 11 +- infra/redis-sdk/acl/admin-readonly.acl | 2 +- infra/redis-sdk/acl/application-advanced.acl | 2 +- infra/redis-sdk/acl/application.acl | 2 +- infra/redis-sdk/acl/raw-gateway.acl | 2 +- src/.env.example | 1 + src/Dockerfile | 4 + src/README.md | 15 +- src/adapter/inbound/graphql/build.gradle | 2 + .../BoundedPreparsedDocumentProvider.java | 14 +- src/adapter/inbound/grpc/build.gradle | 1 + .../inbound/web-fileserver/build.gradle | 42 + .../inbound/web-fileserver/gradle.lockfile | 192 +++++ .../admin/FileserverAdminController.java | 0 .../admin/ForceDeleteHttpRequest.java | 0 .../admin/OrphanReconcileHttpRequest.java | 0 .../config/BlockingTransferExecutor.java | 0 .../config/FileserverWebProperties.java | 0 .../MvcTransferExecutorConfiguration.java | 0 .../config/TransferExecutorProperties.java | 0 .../controller/FileDownloadController.java | 0 .../controller/FileUploadController.java | 0 .../fileserver/draft12/Draft12Headers.java | 0 .../draft12/Draft12OffsetProblem.java | 0 .../fileserver/draft12/Draft12Properties.java | 0 .../draft12/Draft12UploadController.java | 0 .../fileserver/draft12/ExperimentalApi.java | 0 .../dto/BatchUploadItemProblem.java | 0 .../fileserver/dto/BatchUploadItemResult.java | 0 .../fileserver/dto/BatchUploadResponse.java | 0 .../fileserver/dto/RelocateFileRequest.java | 0 .../fileserver/dto/UploadedFileResponse.java | 0 .../http/DefaultHttpRangeResolver.java | 0 .../http/HttpConditionalRequest.java | 0 .../http/HttpContentDispositionFactory.java | 0 .../fileserver/http/HttpDownloadDecision.java | 0 .../fileserver/http/HttpDownloadOutcome.java | 0 .../fileserver/http/HttpDownloadPlanner.java | 0 .../fileserver/http/HttpDownloadPolicy.java | 0 .../HttpRangeNotSatisfiableException.java | 0 .../web/fileserver/http/HttpRangePolicy.java | 0 .../fileserver/http/HttpRangeResolver.java | 0 .../fileserver/http/HttpResolvedRanges.java | 0 .../http/MvcConditionalRequestFactory.java | 0 .../http/MvcDownloadResponseWriter.java | 0 .../fileserver/http/ZeroCopyEligibility.java | 0 .../lifecycle/FileLifecycleController.java | 0 .../mapper/MultipartUploadRequestMapper.java | 0 .../mapper/RawUploadRequestMapper.java | 0 .../web/fileserver/mapper/UploadIntent.java | 0 .../nginx/DefaultNginxInternalUriMapper.java | 0 .../nginx/NginxDelegationProperties.java | 0 .../nginx/NginxDownloadStrategy.java | 0 .../nginx/NginxInternalUriMapper.java | 0 .../problem/FileserverExceptionHandler.java | 0 .../fileserver/problem/FileserverProblem.java | 0 .../problem/FileserverProblemFactory.java | 0 .../problem/FileserverProblemHeaders.java | 0 .../problem/FileserverProblemTitles.java | 0 .../reactive/DataBufferByteChannel.java | 0 .../reactive/FileDownloadHandler.java | 0 .../reactive/FileUploadHandler.java | 0 .../reactive/FileserverIoScheduler.java | 0 .../FileserverReactiveConfiguration.java | 0 .../reactive/FileserverRouterFactory.java | 0 .../reactive/PartEventUploadReader.java | 0 .../ReactiveDownloadResponseWriter.java | 0 .../ReactiveFileserverAttributes.java | 0 .../ReactiveUploadApplicationService.java | 0 .../FileserverRequestContextFactory.java | 0 .../fileserver/tus/TusChecksumVerifier.java | 0 .../web/fileserver/tus/TusController.java | 0 .../web/fileserver/tus/TusHeaders.java | 0 .../web/fileserver/tus/TusProperties.java | 0 .../web/fileserver/tus/TusRequestParser.java | 0 .../admin/FileserverAdminControllerTest.java | 0 .../MvcUploadExecutorSaturationTest.java | 0 .../FileDownloadControllerContractTest.java | 0 .../controller/FileUploadControllerTest.java | 0 .../draft12/Draft12ProtocolTest.java | 0 .../HttpContentDispositionFactoryTest.java | 0 .../http/HttpDownloadPlannerTest.java | 0 .../http/HttpRangeResolverTest.java | 0 .../http/ZeroCopyEligibilityTest.java | 0 .../nginx/NginxDownloadDelegationTest.java | 0 .../nginx/NginxInternalUriMapperTest.java | 0 .../FileserverProblemHeaderParityTest.java | 0 .../reactive/DataBufferReleaseTest.java | 0 .../reactive/PartEventUploadReaderTest.java | 0 .../ReactiveFileserverContractTest.java | 0 .../FileserverHardeningContractTest.java | 0 .../testkit/CountingDataBuffer.java | 0 .../testkit/CountingDataBufferFactory.java | 0 .../testkit/FileserverWebFixtures.java | 0 .../InMemoryUploadApplicationService.java | 0 .../testkit/RecordingAdminService.java | 0 .../testkit/RecordingFinalizeService.java | 0 .../testkit/RecordingUploadService.java | 0 .../testkit/StubDownloadService.java | 0 .../tus/TusProtocolContractTest.java | 0 src/adapter/inbound/web/build.gradle | 8 +- .../web/moduleboundary/WebBuildModel.java | 26 +- .../WebAutoConfigurationRegistrationTest.java | 103 +++ .../web/testkit/HttpFixtureTimeouts.java | 32 + .../web/testkit/budget/HttpBudgetFixture.java | 5 +- .../testkit/contract/WebContractFixture.java | 5 +- .../fault/HttpResponseLossFixture.java | 7 +- .../operation/HttpOperationFixture.java | 5 +- .../testkit/order/HttpPipelineFixture.java | 5 +- .../testkit/throttle/HttpThrottleFixture.java | 58 +- src/adapter/inbound/websocket/build.gradle | 1 + .../cache/redis/cache/CacheEnvelope.java | 9 +- .../redis/capability}/RedisCacheConfig.java | 2 +- .../capability}/RedisCapabilityConfig.java | 2 +- .../capability}/RedisCapabilitySettings.java | 13 +- .../capability}/RedisIdempotencyConfig.java | 2 +- .../cache/redis/capability}/RedisKeys.java | 10 +- .../redis/capability}/RedisLeaseConfig.java | 2 +- .../capability}/RedisRateLimitConfig.java | 12 +- .../RedisSemanticScriptAclProbe.java | 11 +- ...ot.autoconfigure.AutoConfiguration.imports | 1 + .../cache/redis/cache/CacheEnvelopeTest.java | 9 +- .../cache/RedisCacheRegionAdapterTest.java | 3 +- ...lityAutoConfigurationRegistrationTest.java | 104 +++ .../RedisCapabilityCompositionTest.java | 2 +- .../RedisSemanticScriptAclProbeTest.java | 6 +- .../RedisDistributedLeaseAdapterTest.java | 7 +- src/adapter/outbound/fileserver/build.gradle | 6 + ...FileserverCapabilityAutoConfiguration.java | 62 ++ ...eserverDownloadLifecycleConfiguration.java | 2 +- ...ileserverFingerprintConsumerCondition.java | 2 +- ...serverMaintenanceServiceConfiguration.java | 2 +- .../FileserverMetricsSupport.java | 6 +- .../FileserverObservabilityConfiguration.java | 6 +- .../FileserverPlatformSettings.java | 34 +- .../FileserverPlatformSettingsBinder.java | 2 +- .../FileserverSecurityConfiguration.java | 13 +- .../FileserverStartupCheck.java | 2 +- .../FileserverStartupValidator.java | 14 +- .../FileserverStartupViolations.java | 44 ++ ...FileserverStorageGatewayConfiguration.java | 2 +- ...eserverStorageOperationsConfiguration.java | 2 +- .../FileserverVerificationConfiguration.java | 2 +- .../RandomUploadIdentifierFactory.java | 2 +- ...ot.autoconfigure.AutoConfiguration.imports | 1 + ...lityAutoConfigurationRegistrationTest.java | 105 +++ .../FileserverStartupValidatorTest.java | 2 +- .../outbound/httpclient/gradle.lockfile | 14 +- .../Http2StreamSaturationTest.java | 3 +- .../apache/ApacheHttp2EvidenceReader.java | 49 ++ .../HttpClientPlatformSettings.java | 11 +- .../HttpClientProfileAutoConfiguration.java | 79 +- .../resilience/ProtocolEvidenceReader.java | 28 + .../restclient/BlockingAttemptExecutor.java | 11 +- .../restclient/BlockingExecutionSupport.java | 12 + .../apache/ApacheHttp2EvidenceReaderTest.java | 73 ++ ...ientAutoConfigurationRegistrationTest.java | 103 +++ .../HttpClientPlatformSettingsTest.java | 19 +- src/adapter/outbound/identifier/build.gradle | 4 +- ...afkaAutoConfigurationRegistrationTest.java | 103 +++ src/adapter/outbound/messaging/build.gradle | 2 + ...idgeAutoConfigurationRegistrationTest.java | 105 +++ src/adapter/outbound/notification/CLAUDE.md | 5 + .../outbound/notification/build.gradle | 1 + .../NotificationRoutesSettings.java | 14 +- .../core/FailOpenNotificationProvider.java | 2 +- .../core/NotificationProvider.java | 9 +- .../notification/core/RoutingNotifier.java | 11 +- .../email/google/GoogleEmailProvider.java | 13 +- .../NotificationPlatformDispatchConfig.java | 25 +- .../NotificationPlatformPolicyConfig.java | 11 +- .../NotificationPlatformProviderConfig.java | 6 +- .../NotificationPlatformRuntimeConfig.java | 3 +- .../NotificationPlatformWorkerConfig.java | 28 +- .../platform/template/TemplateSlotPolicy.java | 12 +- .../slack/webhook/SlackWebhookProvider.java | 2 +- .../core/NotificationAdapterTest.java | 2 +- .../core/RoutingNotifierTest.java | 8 +- .../NotificationPlatformReachabilityTest.java | 22 + .../outbound/objectstorage/build.gradle | 5 +- .../direct/DirectTransferCoordinator.java | 3 +- .../AwsS3DirectMutationPreconditionsTest.java | 40 + .../AwsS3DirectTransferQualificationTest.java | 24 - ...3ManagedCommonSubsetQualificationTest.java | 27 - .../AwsS3QualificationPreconditionsTest.java | 43 + .../AwsQualificationClaimHonestyTest.java | 80 ++ .../s3/S3SdkApiCharacterizationTest.java | 8 +- .../persistence-fileserver/build.gradle | 25 + .../persistence-fileserver/gradle.lockfile | 179 +++++ .../fileserver/FileEntityMapper.java | 0 .../FileserverJpaPersistenceConfig.java | 23 +- .../FileserverSchemaActivation.java | 0 .../fileserver/JpaCleanupQueue.java | 0 .../fileserver/JpaContentReferenceLedger.java | 0 .../fileserver/JpaFileMetadataStore.java | 0 .../fileserver/JpaFileQuotaService.java | 0 .../fileserver/JpaQuotaCommitGateway.java | 0 .../fileserver/JpaQuotaReclaimGateway.java | 0 .../fileserver/JpaRecoveryQueue.java | 0 .../fileserver/JpaStagingUploadLocator.java | 0 .../fileserver/JpaUploadSessionStore.java | 0 .../fileserver/entity/CleanupItemEntity.java | 0 .../fileserver/entity/FileEntity.java | 0 .../entity/QuotaReservationEntity.java | 0 .../fileserver/entity/RecoveryItemEntity.java | 0 .../entity/UploadSessionEntity.java | 0 .../entity/VerificationResultEntity.java | 0 .../repository/FileTransitionRepository.java | 0 .../FileserverCleanupRepository.java | 0 .../repository/FileserverQuotaRepository.java | 0 .../FileserverRecoveryRepository.java | 0 .../repository/JpaFileRepository.java | 0 .../JpaUploadSessionRepository.java | 0 .../repository/UploadLeaseRepository.java | 0 ...ot.autoconfigure.AutoConfiguration.imports | 1 + .../V1__create_fileserver_metadata.sql | 0 ...ileserver_recovery_and_staging_cleanup.sql | 0 .../V3__fileserver_fenced_cleanup_lease.sql | 0 .../V4__fileserver_upload_terminal_state.sql | 0 .../outbound/persistence-jpa/build.gradle | 14 +- .../PersistenceJpaAutoConfiguration.java | 2 - .../config/PersistenceJpaConfig.java | 9 +- .../envers/HibernateEnversHistoryReader.java | 3 +- .../idempotency/IdempotencyReaper.java | 4 +- .../idempotency/IdempotencyStoreAdapter.java | 4 +- .../AdminOperationResultPayloadCodec.java | 11 +- .../liveevent/LiveEventLogContractTest.java | 3 +- .../ProjectionFactDurabilityContractTest.java | 2 - .../RecipientClaimContractTest.java | 2 - ...ficationSchemaManifestIntegrationTest.java | 7 +- .../persistence/JpaModuleBoundaryTest.java | 6 +- .../PersistenceJpaAutoConfigurationTest.java | 39 +- .../PersistenceEntityScanCoverageTest.java | 18 +- .../SetConfigParameterBindingTest.java | 100 +++ .../testkit/arch/JpaAuditMechanismRule.java | 1 + .../outbound/persistence-mongo/build.gradle | 1 + .../MongoChangeStreamSubscription.java | 4 +- .../mongo/MongoPersistenceConfigTest.java | 4 +- .../MongoReactiveWiringTest.java | 3 +- .../RedisTopologyClientFactory.java | 132 +++- ...sSdkAutoConfigurationRegistrationTest.java | 102 +++ .../admin/LettuceRedisAdminOperations.java | 6 +- .../sdk/extensions/search/SearchQuery.java | 28 + .../LettuceReactiveRedisPubSubOperations.java | 23 +- ...eReactiveRedisShardedPubSubOperations.java | 15 +- .../LettuceRedisPubSubOperations.java | 18 +- .../LettuceRedisShardedPubSubOperations.java | 25 +- .../sdk/lettuce/operations/PubSubCodecs.java | 43 + .../lettuce/operations/SubscriptionFlux.java | 50 ++ .../operations/ValueOperationRequests.java | 15 +- src/adapter/outbound/support/build.gradle | 3 +- .../runtime/RuntimeProfileSnapshot.java | 4 +- .../runtime/RuntimeProfileSnapshotTest.java | 2 +- src/app-bootstrap/build.gradle | 79 +- .../ArchRuleDiscoveryContractTest.java | 7 +- .../ForbiddenApiArchitectureTest.java | 3 +- .../RuntimeProfileAccessArchitectureTest.java | 2 +- ...tartupFailureContractArchitectureTest.java | 9 +- .../FileserverCompositionIntegrationTest.java | 2 +- .../bootstrap/CaSkeletonApplication.java | 14 +- .../activation/AdapterActivationEndpoint.java | 2 +- .../CapabilityDependencyValidator.java | 17 +- .../RuntimeEnvironmentProfileValidator.java | 8 +- .../FileserverPlatformAutoConfiguration.java | 49 -- .../FileserverServiceConfiguration.java | 13 - .../FileserverStorageConfiguration.java | 14 - .../jpa/JpaDangerousConfigurationGuard.java | 2 +- .../redis/RedisActivationValidator.java | 3 +- .../autoconfigure/tracing/TracingConfig.java | 2 +- ...acingSamplingEnvironmentPostProcessor.java | 2 +- ...ResolvedProfileLoggingContextListener.java | 2 +- .../runtime/JpaSchemaSafetyValidator.java | 1 + .../PersistenceVendorProdSafetyValidator.java | 1 + .../PostgreSqlTransportSecurityValidator.java | 1 + .../runtime/SecretSourceValidator.java | 1 + .../runtime/StartupSafetyValidator.java | 5 +- .../startup/FlywayProdSafetyValidator.java | 2 +- ...web.ManagementContextConfiguration.imports | 1 - ...ot.autoconfigure.AutoConfiguration.imports | 2 - .../src/main/resources/config/httpclient.yml | 3 + ...strapCapabilityReachabilitySystemTest.java | 90 +-- .../DependencyErrorStartupContractTest.java | 15 +- .../FiveAdapterOffInventoryTest.java | 3 +- .../outbound/DisabledAdapterSentinelTest.java | 6 +- .../OptionalAdapterBeanGatingTest.java | 5 +- .../AdapterActivationReportShapeTest.java | 2 +- .../CapabilityDependencyValidatorTest.java | 30 +- ...eJpaRootAutoConfigurationOrderingTest.java | 4 +- ...icalTransportRequirementValidatorTest.java | 5 +- .../redis/RedisActivationValidatorTest.java | 3 +- ...lityAutoConfigurationReachabilityTest.java | 7 +- .../CapabilityStatusDocumentTest.java | 74 ++ ...nalTransportQualificationContractTest.java | 3 +- .../DeveloperExperienceContractTest.java | 23 + .../MongoShippedCompositionContractTest.java | 3 +- .../OperationalErrorRegistryContractTest.java | 143 ++++ .../PiiTokenBodyForbiddenContractTest.java | 2 - .../RedisOptionalityContractTest.java | 20 +- .../MessagingMembershipQualificationTest.java | 7 +- ...BootstrapStructuredRuntimeLoggingTest.java | 43 - .../startup/MigrationStartupRunnerTest.java | 3 +- src/application-core/build.gradle | 1 + .../buildlogic/ResolvedComponents.java | 47 ++ .../architecture/ArchitectureModuleRule.java | 19 - .../architecture/ArchitecturePlugin.java | 177 ++++- ...fyApplicationCoreDependencyPurityTask.java | 124 +-- ...rifyCleanArchitectureDependenciesTask.java | 79 +- .../VerifyModuleDependencyDirectionTask.java | 89 +++ .../bootstrap/DeveloperBootstrapPlugin.java | 65 +- .../dependency/DependencyPolicyCheck.java | 18 +- .../dependency/DependencyPolicyPlugin.java | 9 +- .../VerifyDependencyPolicyTask.java | 33 +- .../java/JavaConventionsPlugin.java | 13 +- .../runtime/RuntimeCompositionCheck.java | 13 - .../runtime/RuntimeMembershipPlugin.java | 35 +- ...erifyCompositionRuntimeMembershipTask.java | 78 ++ .../VerifyRuntimeModuleRegistryTask.java | 71 -- .../ExclusiveRealServerLaneService.java | 24 + .../strictlane/StrictTestLanePlugin.java | 14 + .../RuntimeMembershipFunctionalTest.java | 7 +- ...eveloperBootstrapPluginFunctionalTest.java | 52 +- .../config/ConfigContractPlugin.java | 20 +- .../VerifyOperationalErrorRegistryTask.java | 156 ---- .../buildtools/jpa/JpaEvidencePlugin.java | 19 - .../jpa/JpaQualificationPlugin.java | 8 + .../jpa/SetConfigParameterBindingResult.java | 9 - .../SetConfigParameterBindingVerifier.java | 45 -- .../VerifySetConfigParameterBindingTask.java | 31 - ...SetConfigParameterBindingVerifierTest.java | 54 -- src/build.gradle | 6 +- .../fileserver-platform/build.gradle | 53 ++ .../fileserver-platform/gradle.lockfile | 229 ++++++ ...erAdminManagementContextConfiguration.java | 2 +- .../FileserverAdminPlaneConfiguration.java | 3 +- .../FileserverCleanupConfiguration.java | 3 +- .../fileserver/FileserverCleanupWorker.java | 2 +- .../FileserverCorePolicyConfiguration.java | 3 +- .../FileserverHttpDownloadConfiguration.java | 3 +- ...leserverLocalStorageCoreConfiguration.java | 11 +- .../FileserverNginxConfiguration.java | 3 +- .../FileserverPlatformAutoConfiguration.java | 44 ++ .../FileserverProtocolConfiguration.java | 3 +- .../FileserverStartupConfiguration.java | 7 +- .../FileserverUploadServiceConfiguration.java | 6 +- .../FileserverWebAssemblyConfiguration.java | 3 +- ...web.ManagementContextConfiguration.imports | 1 + ...ot.autoconfigure.AutoConfiguration.imports | 1 + .../fileserver/FileserverAssemblyFixture.java | 2 +- ...FileserverCompositionArchitectureTest.java | 22 +- .../FileserverDocumentationCoverageTest.java | 5 +- ...leserverPlatformAutoConfigurationTest.java | 13 +- .../FileserverPlatformEnvRoundTripTest.java | 24 +- .../FileserverRuntimeAssemblyTest.java | 12 +- .../FileserverStructuredLoggingTest.java | 98 +++ src/config/architecture/modules.json | 46 +- src/config/jpa/readiness-cards.yaml | 1 - src/gradle.properties | 21 + .../reactor/ReactiveGrpcServerAdapter.java | 2 +- .../GrpcIntegrationBridgePolicyTest.java | 4 +- .../GrpcKotlinCompatibilityGateTest.java | 2 +- .../compat/GrpcReactorContextBridgeTest.java | 8 +- .../diagnostics/GrpcDiagnosticsRedactor.java | 18 + ...rpcDiagnosticsRedactorIdempotenceTest.java | 52 ++ .../resilience/GrpcHedgingEligibility.java | 2 +- .../GrpcHedgingEligibilityTest.java | 4 +- .../grpc/client/GrpcClientCallContext.java | 2 +- .../grpc/client/GrpcStubPolicyApplier.java | 4 +- .../client/GrpcClientMetadataPolicyTest.java | 4 +- .../grpc/client/GrpcTypedStubFactoryTest.java | 4 +- .../grpc/api/context/GrpcRequestContext.java | 4 +- .../grpc/api/policy/GrpcMethodPolicy.java | 2 +- .../api/context/GrpcMetadataBudgetTest.java | 4 +- .../policy/GrpcMethodPolicyCatalogTest.java | 2 +- .../observability/GrpcRpcObservation.java | 2 +- .../GrpcMetricCardinalityPolicyTest.java | 2 +- .../ledger/GrpcOperationLedgerEntity.java | 1 - .../grpc/ledger/JpaGrpcOperationLedger.java | 1 - .../GrpcOperationLedgerRepositoryTest.java | 7 +- .../grpc/context/GrpcContextSnapshot.java | 3 +- .../deadline/GrpcCancellationCoordinator.java | 1 - .../grpc/deadline/GrpcDeadlineCalculator.java | 3 +- .../deadline/GrpcDeadlinePolicyValidator.java | 4 +- .../grpc/error/GrpcErrorMapper.java | 1 - .../grpc/error/GrpcStatusMapping.java | 1 - .../GrpcIdempotencyInterceptor.java | 2 +- .../idempotency/GrpcOperationStatusQuery.java | 2 +- .../grpc/resilience/GrpcRetryCoordinator.java | 4 +- .../grpc/resilience/GrpcRetryEligibility.java | 4 +- .../GrpcRetryOwnershipValidator.java | 2 +- .../grpc/context/GrpcContextBinderTest.java | 11 +- .../GrpcCancellationCoordinatorTest.java | 3 +- .../deadline/GrpcDeadlineCalculatorTest.java | 7 +- .../grpc/error/GrpcErrorMapperTest.java | 5 +- .../GrpcIdempotencyInterceptorTest.java | 4 +- .../resilience/GrpcRetryEligibilityTest.java | 10 +- .../GrpcRetryOwnershipValidatorTest.java | 6 +- .../GrpcWaitForReadyValidatorTest.java | 4 +- .../grpc/server/GrpcServiceAdapter.java | 2 +- .../grpc/server/GrpcServiceAdapterTest.java | 8 +- .../boot/GrpcPlatformAutoConfiguration.java | 2 +- .../boot/GrpcPlatformStartupValidator.java | 6 +- .../GrpcPlatformStartupValidatorTest.java | 6 +- .../testkit/GrpcUnaryReliabilityContract.java | 2 +- .../grpc/testkit/GrpcUnaryScenario.java | 4 +- .../grpc/testkit/fault/GrpcFaultScenario.java | 2 +- .../GrpcTransportEvidenceClassifier.java | 2 +- .../testkit/netty/GrpcTlsTestMaterial.java | 3 +- .../testkit/GrpcPackageOwnershipTest.java | 3 +- .../GrpcTransportEvidenceClassifierTest.java | 4 +- .../GrpcUnaryReliabilityContractTest.java | 6 +- .../runtime/DestructiveMessagingAdmin.java | 2 +- .../gradle.lockfile | 9 - src/messaging/messaging-kafka/build.gradle | 4 +- src/messaging/messaging-kafka/gradle.lockfile | 9 - .../kafka/KafkaConsumerRegistrarTest.java | 1 - .../messaging/outbox/OutboxPostgresIT.java | 10 +- .../rabbit/RabbitTopologyAndBatchTest.java | 22 +- .../runtime/DefaultMessagePublisherTest.java | 3 +- .../gradle.lockfile | 2 - .../gradle.lockfile | 1 - .../MessagingProviderSelection.java | 23 + ...formAutoConfigurationRegistrationTest.java | 104 +++ src/optional-platforms/build.gradle | 19 + src/sample-portfolio/build.gradle | 7 + .../src/main/resources/application.yml | 7 + .../systemTest/resources/application-test.yml | 3 + src/shared-contract/build.gradle | 1 + 438 files changed, 5815 insertions(+), 1528 deletions(-) create mode 100644 docs/capability-status.md create mode 100644 docs/reviews/2026-09-23-techlead-review-application-closure.md create mode 100644 docs/superpowers/plans/2026-09-23-app-bootstrap-build-composition-plan.md create mode 100644 src/adapter/inbound/web-fileserver/build.gradle create mode 100644 src/adapter/inbound/web-fileserver/gradle.lockfile rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/FileserverAdminController.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/ForceDeleteHttpRequest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/OrphanReconcileHttpRequest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/BlockingTransferExecutor.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/FileserverWebProperties.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/MvcTransferExecutorConfiguration.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/TransferExecutorProperties.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileDownloadController.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileUploadController.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12Headers.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12OffsetProblem.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12Properties.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12UploadController.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/ExperimentalApi.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadItemProblem.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadItemResult.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadResponse.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/RelocateFileRequest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/UploadedFileResponse.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/DefaultHttpRangeResolver.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpConditionalRequest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpContentDispositionFactory.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadDecision.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadOutcome.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPlanner.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPolicy.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeNotSatisfiableException.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangePolicy.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeResolver.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpResolvedRanges.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/MvcConditionalRequestFactory.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/MvcDownloadResponseWriter.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/ZeroCopyEligibility.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/lifecycle/FileLifecycleController.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/MultipartUploadRequestMapper.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/RawUploadRequestMapper.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/UploadIntent.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/DefaultNginxInternalUriMapper.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDelegationProperties.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDownloadStrategy.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxInternalUriMapper.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverExceptionHandler.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblem.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemFactory.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemHeaders.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemTitles.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/DataBufferByteChannel.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileDownloadHandler.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileUploadHandler.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverIoScheduler.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverReactiveConfiguration.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverRouterFactory.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/PartEventUploadReader.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveDownloadResponseWriter.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveFileserverAttributes.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveUploadApplicationService.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/security/FileserverRequestContextFactory.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusChecksumVerifier.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusController.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusHeaders.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusProperties.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusRequestParser.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/FileserverAdminControllerTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/config/MvcUploadExecutorSaturationTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileDownloadControllerContractTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileUploadControllerTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12ProtocolTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpContentDispositionFactoryTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPlannerTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeResolverTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/ZeroCopyEligibilityTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDownloadDelegationTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxInternalUriMapperTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemHeaderParityTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/DataBufferReleaseTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/PartEventUploadReaderTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveFileserverContractTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/security/FileserverHardeningContractTest.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/CountingDataBuffer.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/CountingDataBufferFactory.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/FileserverWebFixtures.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/InMemoryUploadApplicationService.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingAdminService.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingFinalizeService.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingUploadService.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/StubDownloadService.java (100%) rename src/adapter/inbound/{web => web-fileserver}/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusProtocolContractTest.java (100%) create mode 100644 src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebAutoConfigurationRegistrationTest.java create mode 100644 src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/HttpFixtureTimeouts.java rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis => adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability}/RedisCacheConfig.java (97%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis => adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability}/RedisCapabilityConfig.java (98%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis => adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability}/RedisCapabilitySettings.java (96%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis => adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability}/RedisIdempotencyConfig.java (98%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis => adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability}/RedisKeys.java (92%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis => adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability}/RedisLeaseConfig.java (96%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis => adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability}/RedisRateLimitConfig.java (93%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis => adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability}/RedisSemanticScriptAclProbe.java (88%) create mode 100644 src/adapter/outbound/cache-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityAutoConfigurationRegistrationTest.java rename src/{app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/redis => adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability}/RedisCapabilityCompositionTest.java (99%) rename src/{app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/redis => adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability}/RedisSemanticScriptAclProbeTest.java (96%) create mode 100644 src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverCapabilityAutoConfiguration.java rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverDownloadLifecycleConfiguration.java (97%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverFingerprintConsumerCondition.java (93%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverMaintenanceServiceConfiguration.java (98%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverMetricsSupport.java (77%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverObservabilityConfiguration.java (91%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverPlatformSettings.java (91%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverPlatformSettingsBinder.java (93%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverSecurityConfiguration.java (90%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverStartupCheck.java (94%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverStartupValidator.java (88%) create mode 100644 src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStartupViolations.java rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverStorageGatewayConfiguration.java (97%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverStorageOperationsConfiguration.java (97%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverVerificationConfiguration.java (97%) rename src/adapter/outbound/{identifier/src/main/java/dev/caskeleton/adapter/outbound => fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform}/identifier/RandomUploadIdentifierFactory.java (93%) create mode 100644 src/adapter/outbound/fileserver/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 src/adapter/outbound/fileserver/src/test/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverCapabilityAutoConfigurationRegistrationTest.java rename src/{app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver => adapter/outbound/fileserver/src/test/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure}/FileserverStartupValidatorTest.java (98%) create mode 100644 src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/apache/ApacheHttp2EvidenceReader.java create mode 100644 src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/resilience/ProtocolEvidenceReader.java create mode 100644 src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/apache/ApacheHttp2EvidenceReaderTest.java create mode 100644 src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientAutoConfigurationRegistrationTest.java create mode 100644 src/adapter/outbound/messaging-kafka/src/test/java/dev/caskeleton/adapter/outbound/messaging/kafka/LegacyKafkaAutoConfigurationRegistrationTest.java create mode 100644 src/adapter/outbound/messaging/src/test/java/dev/caskeleton/adapter/outbound/messaging/autoconfigure/MessagingBridgeAutoConfigurationRegistrationTest.java create mode 100644 src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3DirectMutationPreconditionsTest.java delete mode 100644 src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3DirectTransferQualificationTest.java delete mode 100644 src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3ManagedCommonSubsetQualificationTest.java create mode 100644 src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3QualificationPreconditionsTest.java create mode 100644 src/adapter/outbound/objectstorage/src/test/java/dev/caskeleton/adapter/outbound/objectstorage/readiness/AwsQualificationClaimHonestyTest.java create mode 100644 src/adapter/outbound/persistence-fileserver/build.gradle create mode 100644 src/adapter/outbound/persistence-fileserver/gradle.lockfile rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileEntityMapper.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileserverJpaPersistenceConfig.java (66%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileserverSchemaActivation.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaCleanupQueue.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaContentReferenceLedger.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaFileMetadataStore.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaFileQuotaService.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaQuotaCommitGateway.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaQuotaReclaimGateway.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaRecoveryQueue.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaStagingUploadLocator.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaUploadSessionStore.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/CleanupItemEntity.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/FileEntity.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/QuotaReservationEntity.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/RecoveryItemEntity.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/UploadSessionEntity.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/VerificationResultEntity.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileTransitionRepository.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverCleanupRepository.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverQuotaRepository.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverRecoveryRepository.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/JpaFileRepository.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/JpaUploadSessionRepository.java (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/UploadLeaseRepository.java (100%) create mode 100644 src/adapter/outbound/persistence-fileserver/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/resources/db/migration/jpa/fileserver/V1__create_fileserver_metadata.sql (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/resources/db/migration/jpa/fileserver/V2__fileserver_recovery_and_staging_cleanup.sql (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/resources/db/migration/jpa/fileserver/V3__fileserver_fenced_cleanup_lease.sql (100%) rename src/adapter/outbound/{persistence-jpa => persistence-fileserver}/src/main/resources/db/migration/jpa/fileserver/V4__fileserver_upload_terminal_state.sql (100%) create mode 100644 src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/postgresql/SetConfigParameterBindingTest.java create mode 100644 src/adapter/outbound/redis-runtime/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/config/RedisSdkAutoConfigurationRegistrationTest.java create mode 100644 src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/PubSubCodecs.java rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap => adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support}/runtime/RuntimeProfileSnapshot.java (92%) rename src/{app-bootstrap/src/test/java/dev/caskeleton/bootstrap => adapter/outbound/support/src/test/java/dev/caskeleton/adapter/outbound/support}/runtime/RuntimeProfileSnapshotTest.java (97%) delete mode 100644 src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformAutoConfiguration.java delete mode 100644 src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverServiceConfiguration.java delete mode 100644 src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStorageConfiguration.java delete mode 100644 src/app-bootstrap/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports create mode 100644 src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/CapabilityStatusDocumentTest.java create mode 100644 src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/OperationalErrorRegistryContractTest.java create mode 100644 src/build-logic/src/main/java/dev/caskeleton/buildlogic/ResolvedComponents.java delete mode 100644 src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/ArchitectureModuleRule.java create mode 100644 src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/VerifyModuleDependencyDirectionTask.java delete mode 100644 src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/RuntimeCompositionCheck.java create mode 100644 src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/VerifyCompositionRuntimeMembershipTask.java delete mode 100644 src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/VerifyRuntimeModuleRegistryTask.java create mode 100644 src/build-logic/src/main/java/dev/caskeleton/buildlogic/strictlane/ExclusiveRealServerLaneService.java delete mode 100644 src/build-tools/src/main/java/dev/caskeleton/buildtools/config/VerifyOperationalErrorRegistryTask.java delete mode 100644 src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/SetConfigParameterBindingResult.java delete mode 100644 src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/SetConfigParameterBindingVerifier.java delete mode 100644 src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/VerifySetConfigParameterBindingTask.java delete mode 100644 src/build-tools/src/test/java/dev/caskeleton/buildtools/jpa/SetConfigParameterBindingVerifierTest.java create mode 100644 src/composition/fileserver-platform/build.gradle create mode 100644 src/composition/fileserver-platform/gradle.lockfile rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/main/java/dev/caskeleton/composition}/fileserver/FileserverAdminManagementContextConfiguration.java (96%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/main/java/dev/caskeleton/composition}/fileserver/FileserverAdminPlaneConfiguration.java (92%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/main/java/dev/caskeleton/composition}/fileserver/FileserverCleanupConfiguration.java (93%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/main/java/dev/caskeleton/composition}/fileserver/FileserverCleanupWorker.java (98%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/main/java/dev/caskeleton/composition}/fileserver/FileserverCorePolicyConfiguration.java (91%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/main/java/dev/caskeleton/composition}/fileserver/FileserverHttpDownloadConfiguration.java (95%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/main/java/dev/caskeleton/composition}/fileserver/FileserverLocalStorageCoreConfiguration.java (92%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/main/java/dev/caskeleton/composition}/fileserver/FileserverNginxConfiguration.java (90%) create mode 100644 src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverPlatformAutoConfiguration.java rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/main/java/dev/caskeleton/composition}/fileserver/FileserverProtocolConfiguration.java (94%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/main/java/dev/caskeleton/composition}/fileserver/FileserverStartupConfiguration.java (90%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/main/java/dev/caskeleton/composition}/fileserver/FileserverUploadServiceConfiguration.java (94%) rename src/{app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/main/java/dev/caskeleton/composition}/fileserver/FileserverWebAssemblyConfiguration.java (90%) create mode 100644 src/composition/fileserver-platform/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports create mode 100644 src/composition/fileserver-platform/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports rename src/{app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/test/java/dev/caskeleton/composition}/fileserver/FileserverAssemblyFixture.java (98%) rename src/{app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture => composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver}/FileserverCompositionArchitectureTest.java (64%) rename src/{app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/test/java/dev/caskeleton/composition}/fileserver/FileserverDocumentationCoverageTest.java (97%) rename src/{app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/test/java/dev/caskeleton/composition}/fileserver/FileserverPlatformAutoConfigurationTest.java (93%) rename src/{app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/test/java/dev/caskeleton/composition}/fileserver/FileserverPlatformEnvRoundTripTest.java (84%) rename src/{app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure => composition/fileserver-platform/src/test/java/dev/caskeleton/composition}/fileserver/FileserverRuntimeAssemblyTest.java (92%) create mode 100644 src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverStructuredLoggingTest.java create mode 100644 src/grpc-advanced/grpc-advanced-diagnostics/src/test/java/dev/caskeleton/grpc/advanced/diagnostics/GrpcDiagnosticsRedactorIdempotenceTest.java create mode 100644 src/messaging/messaging-spring-boot-starter/src/test/java/dev/caskeleton/messaging/autoconfigure/MessagingPlatformAutoConfigurationRegistrationTest.java diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index cd18f623..71d8983a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -4,7 +4,6 @@ /.trivyignore.yaml @DongHyeonka /.github/ @DongHyeonka /renovate.json @DongHyeonka -/flaky-quarantine.yaml @DongHyeonka # Public security and compatibility baselines require an explicit maintainer review. /docs/security/ @DongHyeonka diff --git a/.github/workflows/ci-quality-gates.yml b/.github/workflows/ci-quality-gates.yml index c6bf601a..eecd5698 100644 --- a/.github/workflows/ci-quality-gates.yml +++ b/.github/workflows/ci-quality-gates.yml @@ -129,10 +129,40 @@ jobs: run: ./gradlew -p optional-platforms ci --stacktrace configuration-cache: + # Two questions, and they are not the same question. + # + # The first is whether every task in the repository-wide gates can be *stored*. That is a + # property of the task graph, so `--dry-run` answers it for the whole of `ci`, + # `integrationCheck` and `releaseCheck` in seconds, and it is the question this job used to + # duck: it checked two leaves, because four tasks elsewhere held a live `Configuration` in + # their state and could not be serialised at all. They hold resolved root components now, so + # the honest scope is all three gates rather than two leaves. + # + # The second is whether a stored entry is actually *reused* and the build still executes its + # work. `--dry-run` cannot answer that, so the executing check stays — on the two core leaves, + # because doubling a full `ci` run to prove reuse would cost more than the guarantee is worth. runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2 - uses: ./.github/actions/setup-gradle-java + - name: Require every repository-wide gate to be storable + working-directory: src + shell: bash + run: | + set -euo pipefail + for gate in ci integrationCheck releaseCheck; do + echo "::group::${gate}" + ./gradlew "${gate}" --dry-run \ + --configuration-cache --configuration-cache-problems=fail --stacktrace + output="$({ ./gradlew "${gate}" --dry-run \ + --configuration-cache --configuration-cache-problems=fail --stacktrace; } 2>&1)" + printf '%s\n' "${output}" + echo '::endgroup::' + grep -Fq 'Reusing configuration cache.' <<<"${output}" || { + echo "::error::Gradle did not reuse the configuration cache for ${gate}." + exit 1 + } + done - name: Store configuration cache for the everyday core build working-directory: src run: >- diff --git a/.github/workflows/integration-main.yml b/.github/workflows/integration-main.yml index 8f07fab8..5a034181 100644 --- a/.github/workflows/integration-main.yml +++ b/.github/workflows/integration-main.yml @@ -290,8 +290,39 @@ jobs: working-directory: src run: ./gradlew :adapter:outbound:persistence-jpa:postgresqlLegacyOutboxRowLifecycleIntegrationTest --stacktrace - # Dynamic half of the compose-profile contract. All 15 blocking lanes run on main/nightly; a - # partial lane run is reproduction only and cannot satisfy this job. + # The optional gRPC platform build declares one strict INTEGRATION lane — + # `grpc-operation-ledger-jpa:integrationTest`, which certifies the atomic + # `INSERT ... ON CONFLICT DO NOTHING` claim that durable mutation idempotency rests on against a + # real PostgreSQL. It was registered in Gradle, listed in `strictTestLanes`, and invoked by + # nothing: `-p optional-platforms ci` reaches `checkAll`, `qualityCheck` and the dependency + # verifier, none of which runs a lane whose category is INTEGRATION, and release.yml's gRPC gate + # names only the three grpc-testkit lanes. + # + # Stage 2 rather than stage 1 for the same reason as every other job in this file: the lane starts + # a Testcontainers PostgreSQL, and the pull-request budget is minutes for the whole gate. + grpc-optional-platform-integration: + runs-on: ubuntu-latest + timeout-minutes: 45 + env: + TESTCONTAINERS_REUSE_ENABLE: "false" + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/checkout@v4.2.2 + - uses: ./.github/actions/setup-gradle-java + - name: Certify the gRPC operation ledger against real PostgreSQL + working-directory: src + run: ./gradlew -p optional-platforms integrationCheck --stacktrace + - name: Publish the optional-platform lane reports + if: always() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # actions/upload-artifact@v4.6.2 + with: + name: grpc-optional-platform-integration-reports + path: src/optional-platforms/**/build/reports/tests/ + if-no-files-found: warn + + # Dynamic half of the compose-profile contract. Every blocking lane the matrix declares runs on + # main and nightly; a partial lane run is reproduction only and cannot satisfy this job. The count + # is not written here on purpose — a number in prose drifts the moment a lane is added, and the + # matrix file is the thing this job reads. compose-runtime-smoke: runs-on: ubuntu-latest timeout-minutes: 180 diff --git a/docker-compose.yml b/docker-compose.yml index 3bb68628..06bcb473 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -84,9 +84,10 @@ services: stop_grace_period: 40s # ---- Health check ------------------------------------------------------- # Targets the actuator readiness probe on the management port (9001). - # CROSS-FEATURE COUPLING: /actuator/health/readiness is implemented by the - # parallel runtime-health + actuator branches. This healthcheck will report - # UNHEALTHY in this worktree until those branches are merged. + # The warning that used to stand here — that this probe would report UNHEALTHY until two + # parallel branches merged — outlived the branches. src/Dockerfile removed its copy and said + # why: "a stale warning about a healthcheck is the kind of comment that gets a real red + # container ignored." healthcheck: test: - "CMD" diff --git a/docs/architecture/jpa-api-surface.txt b/docs/architecture/jpa-api-surface.txt index 17a6f096..407d304d 100644 --- a/docs/architecture/jpa-api-surface.txt +++ b/docs/architecture/jpa-api-surface.txt @@ -5,7 +5,7 @@ # root yet. # Update only after review with: # ./gradlew :adapter:outbound:persistence-jpa:updateJpaApiSurface -PapproveJpaApiSurfaceChange -# types: 338 +# types: 311 dev.caskeleton.adapter.outbound.persistence.api.PersistenceOperationName dev.caskeleton.adapter.outbound.persistence.api.capability.CapabilitySupport dev.caskeleton.adapter.outbound.persistence.api.capability.JpaCapability @@ -58,9 +58,6 @@ dev.caskeleton.adapter.outbound.persistence.api.transaction.TransactionProfile dev.caskeleton.adapter.outbound.persistence.audit.AuditContextPort dev.caskeleton.adapter.outbound.persistence.audit.AuditableEntity dev.caskeleton.adapter.outbound.persistence.audit.DomainContextAuditContextPort -dev.caskeleton.adapter.outbound.persistence.auditing.AuditMetadata -dev.caskeleton.adapter.outbound.persistence.auditing.JpaAuditingConfiguration -dev.caskeleton.adapter.outbound.persistence.auditing.JpaAuditorProvider dev.caskeleton.adapter.outbound.persistence.cache.CacheConcurrencyStrategy dev.caskeleton.adapter.outbound.persistence.cache.CacheRegionCatalog dev.caskeleton.adapter.outbound.persistence.cache.HibernateCacheGuard @@ -107,30 +104,6 @@ dev.caskeleton.adapter.outbound.persistence.experimental.tenant.TenantId dev.caskeleton.adapter.outbound.persistence.failure.PersistenceExceptionTranslator dev.caskeleton.adapter.outbound.persistence.failure.SqlStateErrorMapping dev.caskeleton.adapter.outbound.persistence.failure.StandardSqlStateErrorMapping -dev.caskeleton.adapter.outbound.persistence.fileserver.FileserverJpaPersistenceConfig -dev.caskeleton.adapter.outbound.persistence.fileserver.FileserverSchemaActivation -dev.caskeleton.adapter.outbound.persistence.fileserver.JpaCleanupQueue -dev.caskeleton.adapter.outbound.persistence.fileserver.JpaContentReferenceLedger -dev.caskeleton.adapter.outbound.persistence.fileserver.JpaFileMetadataStore -dev.caskeleton.adapter.outbound.persistence.fileserver.JpaFileQuotaService -dev.caskeleton.adapter.outbound.persistence.fileserver.JpaQuotaCommitGateway -dev.caskeleton.adapter.outbound.persistence.fileserver.JpaQuotaReclaimGateway -dev.caskeleton.adapter.outbound.persistence.fileserver.JpaRecoveryQueue -dev.caskeleton.adapter.outbound.persistence.fileserver.JpaStagingUploadLocator -dev.caskeleton.adapter.outbound.persistence.fileserver.JpaUploadSessionStore -dev.caskeleton.adapter.outbound.persistence.fileserver.entity.CleanupItemEntity -dev.caskeleton.adapter.outbound.persistence.fileserver.entity.FileEntity -dev.caskeleton.adapter.outbound.persistence.fileserver.entity.QuotaReservationEntity -dev.caskeleton.adapter.outbound.persistence.fileserver.entity.RecoveryItemEntity -dev.caskeleton.adapter.outbound.persistence.fileserver.entity.UploadSessionEntity -dev.caskeleton.adapter.outbound.persistence.fileserver.entity.VerificationResultEntity -dev.caskeleton.adapter.outbound.persistence.fileserver.repository.FileTransitionRepository -dev.caskeleton.adapter.outbound.persistence.fileserver.repository.FileserverCleanupRepository -dev.caskeleton.adapter.outbound.persistence.fileserver.repository.FileserverQuotaRepository -dev.caskeleton.adapter.outbound.persistence.fileserver.repository.FileserverRecoveryRepository -dev.caskeleton.adapter.outbound.persistence.fileserver.repository.JpaFileRepository -dev.caskeleton.adapter.outbound.persistence.fileserver.repository.JpaUploadSessionRepository -dev.caskeleton.adapter.outbound.persistence.fileserver.repository.UploadLeaseRepository dev.caskeleton.adapter.outbound.persistence.h2.H2IdempotencyClaimRepository dev.caskeleton.adapter.outbound.persistence.h2.H2LocalTimeoutConfigurer dev.caskeleton.adapter.outbound.persistence.h2.H2OutboxClaimRepository diff --git a/docs/capability-status.md b/docs/capability-status.md new file mode 100644 index 00000000..9d5297b0 --- /dev/null +++ b/docs/capability-status.md @@ -0,0 +1,51 @@ +# Capability status — IMPLEMENTED / WIRED / QUALIFIED + +Three different questions get three different answers, and conflating them is what the +2026-09-18 techlead review found over and over: a capability with 12,000 lines and 482 green tests +that no running application assembled, and a provider with no wiring that was nonetheless live. +"There is code for it" is not "the shipped artifact builds it" is not "it has been proven against a +real provider." + +| Column | The question | Who decides it | +| --- | --- | --- | +| **IMPLEMENTED** | Does this repository contain the capability? | `src/config/architecture/modules.json` — the leaf is registered | +| **WIRED** | Does the shipped `app-bootstrap` artifact assemble it when its switch is on? | the leaf's `META-INF/spring/...AutoConfiguration.imports`, its edge in `app-bootstrap/build.gradle`, and a composition test that boots `CaSkeletonApplication` | +| **QUALIFIED** | Has it been proven against a real provider, by something CI runs? | a strict test lane against a real provider **and** a workflow that executes it | + +The third column is the one that rots quietly, because a lane can exist and be invoked by nothing. +Each row below names the lane *and* the workflow, so "qualified" can be checked rather than believed. + +## Status + +| Capability | Master switch | IMPLEMENTED | WIRED | QUALIFIED | Evidence | +| --- | --- | --- | --- | --- | --- | +| Relational persistence (JPA/PostgreSQL) | `APP_PERSISTENCE_JPA_ENABLED` | yes | yes | yes | six `postgresql*IntegrationTest` lanes, run by `integration-main.yml` → `jpa-provider-ownership-contracts` | +| Document persistence (MongoDB) | `APP_PERSISTENCE_MONGO_ENABLED` | yes | yes | yes | six container lanes (`mongoReplicaSetTest`, `mongoFailoverTest`, …), run by `integration-main.yml` → `mongo-container-lanes` | +| Messaging (broker-neutral core) | `APP_MESSAGING_ENABLED` | yes | yes | Kafka only | `messaging-kafka:messagingCertificationTest` behind `verifyMessagingCertificationEvidence`, run by `messaging-certification.yml`. **No broker starter ships**: a deployment composes `messaging-spring-boot-starter-kafka` or `-rabbit` itself, and selecting a broker it did not compose is refused at startup. Rabbit ships validators and no transport. | +| Redis capabilities (cache / rate-limit / lease / idempotency) | `APP_REDIS_ENABLED` | yes | yes | yes | `cache-redis:redisTopologyTest`, run by `redis-sdk-topology.yml` | +| Notification platform | `APP_NOTIFICATION_PLATFORM_ENABLED` | yes | yes | claim-scoped | `verifyNotificationEvidence` refuses a grade in `docs/notification/support-matrix.md` that no proven claim backs; run by `notification-platform.yml`. There is no real-SMTP lane, and the matrix says so rather than implying one. | +| File export publication (R2) | `APP_FILESERVER_ENABLED` | yes | yes | yes | A different capability from the platform row below, in its own namespace so the two cannot be switched on together by accident. Atomic publication and durability are proven by `adapter:outbound:fileserver`'s own lanes inside its `check`, which every PR runs. | +| File server platform | `APP_FILESERVER_PLATFORM_ENABLED` | yes | yes | yes | `app-bootstrap:integrationTest` → `FileserverCompositionIntegrationTest` (required by the strict lane, so it cannot silently disappear), run by `integration-main.yml` → `bootstrap-integration` | +| Outbound HTTP client | `APP_HTTPCLIENT_ENABLED` | yes | yes | yes | `httpclient:httpClientFailureInjectionTest` against a faulted upstream, run by `integration-main.yml` → `httpclient-fault-injection` | +| GraphQL transport | `APP_GRAPHQL_ENABLED` | yes | yes | compose-level | `local-graphql` and the three `off-*` lanes in `src/config/runtime/compose-profile-contracts.json`, run by `integration-main.yml` → `compose-runtime-smoke`. The route's absence when the switch is off is what those lanes prove. | +| Object storage | `app.object-storage.enabled` (no `MasterSwitch` entry) | yes | **no** | MinIO only | The leaf is **not** an `app-bootstrap` dependency — only `sample-portfolio` consumes it, and `app-bootstrap:integrationTest` assembles it test-only against digest-pinned MinIO. A fork that wants it adds the edge. | +| gRPC platform | — (build-level) | yes | **no** | yes | Absent from the main build entirely: `optional-platforms` is a separate Gradle build, so the switch is the `include`, not an environment variable. `-p optional-platforms ci` runs on every PR and `integrationCheck` certifies the operation ledger against real PostgreSQL. | +| WebSocket transport | — (build-level) | yes | **no** | — | Qualification-only edge in `app-bootstrap`; `ConditionalTransportBuildContractTest` asserts it has no production edge. | + +## Reading the "no" rows + +A **no** in WIRED is not a defect. It is the review's Build Composition principle working: the +repository holds more capabilities than any one derived service should ship, and a capability that +is absent from the artifact holds no beans, no connections and no threads whatever its configuration +says. The three **no** rows are the ones where that choice has been made and is enforced by a test. + +The rows that say **yes** are the ones where the choice is still "ship it and switch it off", which +is a weaker guarantee — correct, but it depends on the switch being honest rather than on the code +being absent. Moving more rows to **no** is what `app-bootstrap`'s composition-ownership work is for. + +## Keeping this honest + +`CapabilityStatusDocumentTest` derives the switch list from `MasterSwitch` and fails when a switch +has no row here. That is deliberately the only automated check: a table of facts that a parser +re-derives would be a second source of truth, and the columns above are judgements about evidence, +which is exactly the thing the review says a build must not pretend to compute. diff --git a/docs/httpclient/env-fields.yaml b/docs/httpclient/env-fields.yaml index 5b893d06..870b5eb9 100644 --- a/docs/httpclient/env-fields.yaml +++ b/docs/httpclient/env-fields.yaml @@ -27,6 +27,8 @@ fields: - field: enabled env: APP_HTTPCLIENT_ENABLED + - field: rotation-drain-timeout + env: APP_HTTPCLIENT_ROTATION_DRAIN_TIMEOUT - field: clients[N].name env: APP_HTTPCLIENT_CLIENTS_N_NAME - field: clients[N].mode diff --git a/docs/notification/api-surface-snapshot.txt b/docs/notification/api-surface-snapshot.txt index 5472b0df..d47d325c 100644 --- a/docs/notification/api-surface-snapshot.txt +++ b/docs/notification/api-surface-snapshot.txt @@ -150,7 +150,6 @@ dev.caskeleton.adapter.outbound.notification.slack.webhook.SlackWebhookProvider dev.caskeleton.application.notification.ApplyNotificationReceiptCommand dev.caskeleton.application.notification.ApplyNotificationReceiptResult dev.caskeleton.application.notification.ApplyNotificationReceiptUseCase -dev.caskeleton.application.notification.Channel dev.caskeleton.application.notification.ConsentCheckMode dev.caskeleton.application.notification.EmailRecipientReference dev.caskeleton.application.notification.InitializeNotificationWriterFencesCommand diff --git a/docs/registries/env-keys.yaml b/docs/registries/env-keys.yaml index c8372fa0..33c980ef 100644 --- a/docs/registries/env-keys.yaml +++ b/docs/registries/env-keys.yaml @@ -3436,6 +3436,20 @@ env_keys: compatibility_impact: additive required_test: httpclient-platform:off-state-zero-side-effects-and-env-manifest-parity + - name: APP_HTTPCLIENT_ROTATION_DRAIN_TIMEOUT + # How long a retired runtime generation may keep draining after a certificate rotation before + # its connection pool is closed underneath whatever is still in flight. Rotation replaces a + # generation rather than mutating material in place, because a pool holds sockets established + # under the previous identity; this value is how long the old identity is allowed to finish. + type: duration + default: 30s + classification: public-config + required: false + reload_policy: restart-only + owner_branch: httpclient-platform-activation-boundary + compatibility_impact: additive + required_test: httpclient-platform:off-state-zero-side-effects-and-env-manifest-parity + # === Fileserver HTTP platform (app.fileserver-platform.*) === # # A different capability from the app.fileserver R2 publication block above. Separate diff --git a/docs/reviews/2026-09-23-techlead-review-application-closure.md b/docs/reviews/2026-09-23-techlead-review-application-closure.md new file mode 100644 index 00000000..5291c463 --- /dev/null +++ b/docs/reviews/2026-09-23-techlead-review-application-closure.md @@ -0,0 +1,739 @@ +# Techlead review application — 2026-09-23 closure + +## Authority and scope + +Applies `docs/reviews/2026-09-18-techlead-review/` (`00-overview.md` §0-A "우선순위 교정" order) to the +working tree at `9da00eb7`. The overview's own ordering is followed: restore the red gates, then the +named blockers, then leaf findings. Where an area document's `0-B` revalidation disagrees with the +current tree, the tree was re-measured and the tree wins — several `0-B` observations were already +stale by the time this pass ran. + +Commit policy is unchanged: nothing here is staged, committed or pushed. + +## 1. Environment defect found before any review work could run + +Every Gradle invocation failed at `:build-logic:compileJava` with +`Unable to delete directory .../build-logic/build/classes/java/main`. 22,677 paths under the +repository — including 95 source files and every leaf's `build/` tree — were owned by `root`, +written by a Gradle daemon running outside this account. No verification of any kind was possible, +so ownership was normalised to the repository account before the review pass began. Root can still +write everything it could before; nothing else changed. + +## 2. The red gates the review named are green + +`00-overview.md` §0-A lists five failures across three tasks. Re-run against the current tree: + + ./gradlew verifyCleanArchitectureDependencies \ + :adapter:outbound:persistence-jpa:test \ + :app-bootstrap:test \ + :app-bootstrap:architectureTest --continue + # BUILD SUCCESSFUL in 2m 44s + +- `JpaModuleBoundaryTest` no longer requires the empty `auditing` package; the catalog and the tree + agree. +- The Redis composition test no longer reaches a live server: the ACL probe is supplied as a + composition-only bean. +- `UNAUTHENTICATED`, `INVALID_TOKEN` and `FORBIDDEN` each appear in a runbook's `error_codes` + frontmatter. +- `PersistenceJpaLeafReadyAutoConfiguration` no longer exists; the root names no leaf-internal type. + +Those four are recorded closed on evidence, not on the `0-B` text. + +## 3. Findings closed in this pass + +### 3.1 gRPC operation-ledger integration lane had no CI caller (11 §0-B, 13 §0-B, overview §0.2 P0) + +`grpc-operation-ledger-jpa` declared a Testcontainers PostgreSQL `integrationTest` that certifies the +atomic `INSERT ... ON CONFLICT DO NOTHING` claim durable idempotency rests on, and nothing ran it: +`-p optional-platforms ci` reaches `checkAll`, `qualityCheck` and the dependency verifier, none of +which runs a lane whose category is INTEGRATION. + +- `optional-platforms/build.gradle` gains an `integrationCheck` aggregate over every leaf's + `integrationTestLaneCheck`. `--dry-run` confirms it reaches + `:grpc:grpc-operation-ledger-jpa:integrationTest`. +- `integration-main.yml` gains a `grpc-optional-platform-integration` job that executes it. Stage 2, + because the lane starts a container. +- `DeveloperExperienceContractTest.everyOptionalPlatformIntegrationLaneHasAnExecutingWorkflowCaller` + pins both halves so the lane cannot become an orphan again. + +RED at `HEAD`: `git show HEAD:src/optional-platforms/build.gradle | grep -c integrationCheck` = 0, +and `integration-main.yml` named `optional-platforms` 0 times. GREEN after the change. + +### 3.2 A build-time source scanner moved back to its owner (13 §0.2 P1) + +`build-tools/jpa/SetConfigParameterBindingVerifier` scanned Java source text for +`set_config('...')` without a `?`. The contract is right and the placement was not: it needs no +dependency resolution and no task graph, and the review's Phase 6 target is a smaller `build-tools`. + +- Deleted `SetConfigParameterBindingVerifier`, `SetConfigParameterBindingResult`, + `VerifySetConfigParameterBindingTask`, their functional test, the `JpaEvidencePlugin` registration + and the `check` hook. +- Added `persistence-jpa`'s own `SetConfigParameterBindingTest`, which asserts the same invariant and + additionally asserts that the scan reaches a non-empty tree containing at least one subject — a + source scan that walks nothing otherwise passes for the wrong reason. +- `config/jpa/readiness-cards.yaml` no longer names the deleted task. + +`build-tools` shrinks by 4 files. `-p build-tools test` and `:adapter:outbound:persistence-jpa:check` +are green. + +### 3.3 `:adapter:outbound:persistence-jpa:check` was red at HEAD + +Two defects the previous commit left behind, neither of which `:test` alone could see: + +- `verifyJpaApiSurface` failed: the `auditing` capability's three public types were deleted without + recording the adopter API-surface change. Recorded through the sanctioned + `updateJpaApiSurface -PapproveJpaApiSurfaceChange` path. +- `PersistenceEntityScanCoverageTest` failed: `PersistenceJpaConfig` still listed + `...persistence.auditing` in both `@EntityScan` and `@EnableJpaRepositories`. "A scan for a package + that no longer exists is a scan of nothing" — the entries are gone. +- A Checkstyle violation (`invalidBase64` as a catch parameter) in + `AdminOperationResultPayloadCodec`. + +### 3.4 `verifyNotificationApiSurface` was red at HEAD + +`dev.caskeleton.application.notification.Channel` was deleted from `application-core` in the previous +commit — the type now lives at `...notification.platform.api.routing.Channel` in +`application-notification` — and the snapshot was not updated. Recorded through +`updateNotificationApiSurface -PapproveNotificationApiChange`; no source still names the old type. + +### 3.5 Redis pub/sub decoded with the wrong codec on three of six surfaces (07 M13) + +The blocking channel subscription fixed "one codec per channel" and left the three others on +`first.messageCodec()`, so the same two-channel subscription was correct through +`RedisPubSubOperations` and silently reinterpreted the second channel's payload under the first +channel's schema through the reactive and sharded ones — whenever the framings happened to be +compatible. + +- `LettuceRedisShardedPubSubOperations`, `LettuceReactiveRedisPubSubOperations` and + `LettuceReactiveRedisShardedPubSubOperations` now build a channel→codec map and refuse a channel + they never subscribed to. +- `SubscriptionFlux.createPerChannel` carries the per-channel rule into the reactive bridge. +- The reactive pattern subscription now refuses mixed codecs, which the blocking one already did; the + shared rule lives in `PubSubCodecs` so it cannot be fixed one implementation at a time again. + +### 3.6 One event-loop group per Redis account (07 M9) + +`RedisTopologyClientFactory.resources()` was called once per credential role, so an application + +advanced + pub/sub deployment built three `DefaultClientResources` — `max(2, cores)` IO threads, a +computation pool and a timer each. On an eight-core pod that is twenty-four IO threads to talk to one +Redis. The accounts differ in who they authenticate as, which is a property of the connection. + +One `SharedClientResources` is now built per `create()` and handed to every client; a hold count +stops the loops exactly once, after the last client releases, and a build that fails before any +client takes a hold still stops them. + +### 3.7 `spring-kafka` declared and never imported (10 M9) + +`messaging-kafka/build.gradle` declared `org.springframework.kafka:spring-kafka` and no source in the +repository imports `org.springframework.kafka` outside two forbidden-type catalogs. Removed, and the +four affected lockfiles regenerated. + +### 3.8 The shipped composition could not enable the outbox at all + +Found by running `:app-bootstrap:systemTest`, not by reading. After the broker starter split made the +core messaging starter broker-neutral, three rules combined into a contradiction: + +- `CapabilityDependencyValidator`: outbox on ⇒ messaging on. +- `MessagingProviderSelection`: messaging on ⇒ a broker id, and its client library present. +- The shipped composition deliberately ships neither broker starter. + +So the outbox had no reachable configuration, and selecting a broker produced Spring reporting a +missing `.class` file rather than a missing capability. Three changes: + +- `MessagingProviderSelection` now checks the provider *configuration* as well as the client library, + and names the starter the deployment did not compose. The client library and the broker starter are + two different build decisions and a deployment can hold the first transitively. +- The outbox↔messaging rule is scoped to the *relay*. An outbox with the relay off writes rows and + publishes nothing, which is the configuration an operator uses to park events until a transport + exists — exactly what `OutboxRelayBrokerRequirementValidator` documents as one of the two coherent + states. +- `BootstrapCapabilityReachabilitySystemTest` stops hand-registering no-op Kafka seams to assert a + composition this artifact cannot produce, and gains + `shippedCompositionRefusesABrokerItDidNotCompose`, which asks the build-composition question of the + artifact rather than of a build file. + +### 3.9 GraphQL single-flight had a real race (found by a failing test, not by the review) + +`BoundedPreparsedDocumentProviderTest.concurrentMissesOnOneKeyParseOnce` was red at HEAD. +`getDocument` looked the key up, then claimed it in `inFlight` — and between those two steps the +previous leader could finish parsing, store the document and release its slot, at which point the +late thread's `putIfAbsent` succeeded and it parsed a document that was already cached. The class +documents single-flight as a guarantee; the leader now re-reads the cache after taking the claim. + +### 3.10 HTTP client runtime certificate rotation had no entry point (08 L6) + +`TlsRuntimeRotationCoordinator` and the generation drain it drives were fully implemented and +published by nothing, so a renewed client certificate could only be picked up by a restart while the +leaf's documentation claimed runtime generations as a responsibility. + +- `ClientRuntimeFactory` is now a published bean that dispatches on the profile's API type, and the + registry builds its initial generation through it — a replacement generation built differently from + the one it replaces is not the same client with new material. +- `TlsRuntimeRotationCoordinator` is published, `@ConditionalOnMissingBean`. +- The drain budget is configuration rather than a constant: + `app.httpclient.rotation-drain-timeout`, registered in `docs/registries/env-keys.yaml`, + `src/.env.example`, `config/httpclient.yml` and `docs/httpclient/env-fields.yaml`. + +### 3.11 Redis SDK Low findings (07 L3, L4, L5) + +- **L3.** `ValueOperationRequests.decodeAll` clamped the key index to `keys.size() - 1`, so an MGET + reply of a different length than the request decoded every extra value with the last key's codec + and attributed it to that key. MGET replies positionally; a length mismatch means the positions no + longer line up, and it is now an error rather than a silent reinterpretation. +- **L4.** `SearchQuery.expression` reached `FT.SEARCH` unchecked. RESP argument framing is + length-prefixed, so the expression cannot become another command however it is spelled — but it + could still be unbounded or carry control characters. Both are rejected where the value is + constructed. +- **L5.** `Duration.ofNanos(Duration.ofMillis(v).toNanos() / 1_000L)` computed the right value and + read like a defect. SLOWLOG reports microseconds, so it now says so. + +### 3.12 Notification Low findings (09 L6, L9) + +- **L6.** `adapter:outbound:fileserver`'s guidance forbids fully-qualified inline type references and + this leaf's did not, so the same construct was a defect in one capability and ordinary style in the + next; the platform auto-configurations had accumulated twenty-two. They are now imports, and the + rule is written into `adapter/outbound/notification/CLAUDE.md` so the inconsistency cannot return. +- **L9.** The move from the composition root into the leaf dropped the assertion that every + `@Import`ed type is itself a configuration class. `@Import` accepts any class: one carrying neither + `@Configuration` nor `@AutoConfiguration` is imported as a plain bean, its `@Bean` methods are never + read, and the capability is simply absent with nothing failing. Restored. + +### 3.13 Governance plugins are no longer applied to every Java leaf (13 §0-B, Phase 6) + +`JavaConventionsPlugin` applied five special plugins to all 71 Java leaves. Three of them governed +nothing there: `ca.api-surface` is configured by three leaves, `ca.dependency-policy` by two and +`ca.strict-qualification` by nine, so the other leaves carried an extension apiece and a +`verifyDependencyPolicy` task that checked an empty policy. Those three are now declared by the +leaves that use them. + +`ca.strict-test-lane` and `ca.test-jvm-agents` stay global, and the reason is written into the +plugin: the first supplies the per-leaf `*TestLaneCheck` aggregates that the root's repository-wide +tasks depend on **by task path**, so a leaf without them breaks the root task graph rather than +losing a check; the second attaches the Mockito startup agent to every `Test` task, and a leaf that +quietly lost it would self-attach instead. + +Measured the way `13-build-dependency-ci.md` §0-B measures it — `src/main` only — `build-tools` went +from 102 files / 6,152 lines to 99 / 6,048, and `build-logic` from 82 / 5,671 to 82 / 5,678 (the +seven lines are the comment above). That is the first movement in the intended direction; the +review's point was that `build-tools` had been *growing* during the simplification phase. It is not +the reduction Phase 6 asks for, which is why §4 still lists it as open. + +### 3.14 Build/dependency/CI Low findings (13 L1-L8) + +- **L1.** `docker-compose.yml` still carried the healthcheck warning that `src/Dockerfile` had + already removed, and removed for a stated reason: "a stale warning about a healthcheck is the kind + of comment that gets a real red container ignored." One copy had been fixed; both are now. +- **L2.** `.github/CODEOWNERS` assigned an owner to `/flaky-quarantine.yaml`, deleted in `ef947e5b`. +- **L3.** `optional-platforms` did not apply `ca.release-provenance`, so every gRPC leaf's jar was + versioned `0.0.1-SNAPSHOT` while main-build jars carry `+`: one commit, two artifact + sets, one of them untraceable. The root now applies it. +- **L4.** `src/Dockerfile`'s dependency-resolution stage did not copy `gradle.properties`, so it ran + `verifyDependencyLocks` without the repository's memory, worker and caching settings. +- **L5.** The root `verifyDependencyLocks` aggregate excludes `:sample-portfolio` — correctly, since + the sample is outside production architecture and runtime-membership policy — and nothing else + verified its lock state, which had changed by hundreds of lines. Its own `check`, which CI runs as + a PR gate, now verifies it. +- **L6.** `src/README.md` named `src/.env` as the public-path SSOT; `PublicPathSnapshotPlugin` reads + `app-bootstrap/src/main/resources/config/security.yml`. The config split moved the file and the + documentation stayed. +- **L7.** `src/README.md` listed "Spotless, Checkstyle, Error Prone" without saying that Checkstyle's + scope here is naming plus a handful of logical rules, deliberately excluding everything the + formatter owns. The division of labour is now written where the list is. +- **L8.** `application.acl`, `application-advanced.acl`, `raw-gateway.acl` and `admin-readonly.acl` + still declared `nopass` long after `all-accounts.acl` — the file a deployment actually loads — had + been given fixture passwords, and `acl/README.md` claimed "none of these files carries one" while + its neighbour carried eight. The per-role files now carry the same fixture credentials and the + README says what they are and why they are written down. + +### 3.15 Object storage L10 + +`S3SdkApiCharacterizationTest` defined a private helper named `assertThatCode`, which is also an +AssertJ entry point, so `allSatisfy(builder -> assertThatCode(...))` read like an assertion while +building no assertion object at all. Renamed to `requireSdkMethod`, which is what it does. + +### 3.16 The review's central structural gap, narrowed (overview §4) + +The overview's single deepest finding is that Spring Boot needs two independent things before an +auto-configuration runs — the annotation on the class, and a line naming it in +`META-INF/spring/...AutoConfiguration.imports` — and that this repository tested the first +exhaustively and the second in three leaves out of eleven. Every assembly defect the review found +was in the other eight, and the mechanism is the same each time: a test that builds a context with +`AutoConfigurations.of(...)` supplies the registration itself, so it stays green for a capability +present in no running application. + +Six of the twelve leaves that ship a registration file now had a test reading it. The other six — +`adapter:inbound:web`, `adapter:outbound:httpclient`, `adapter:outbound:messaging`, +`adapter:outbound:messaging-kafka`, `adapter:outbound:redis-runtime` and +`messaging:messaging-spring-boot-starter` — now do too. Each asserts both directions: every root the +leaf means to publish is named in the file it ships, and every name in that file resolves to a class +carrying `@AutoConfiguration`. + +The file is read from the leaf's own source tree rather than from the classpath. The first draft +aggregated every `AutoConfiguration.imports` the class loader could see, which immediately failed on +springdoc's `SpringDocWebMvcConfiguration` and on a Boot health class the messaging bridge's test +runtime does not carry — it was testing other people's modules. Falsifiability was checked by adding +one non-auto-configuration line to the HTTP client's file: the test fails, and the file is byte-identical +to `HEAD` afterwards. + +That closes the mechanism for every leaf that publishes a registration file. It does not close the +review's wider point — that 16 of 1,899 test files start the real composition root — which is what +the composition contracts in §3.8 and the Phase 2 work in §4 are about. + +### 3.17 The sample's idempotency regression (carried in the master's residual queue) + +`SampleApplicationContextTest` was red for a reason the master recorded as a separate follow-up: +`SampleIdempotencyConfig.idempotencyExecutor` requires an `IdempotencyStorePort` and the only +implementation this composition can produce, `IdempotencyStoreAdapter`, is +`@ConditionalOnProperty(ca-skeleton.capabilities.idempotency.provider=jdbc)` — a key the sample never +set. The sample ships `persistence-jpa` and runs the production migration timeline, which owns +`idempotency_record`, so the provider is declared rather than the executor made optional: a sample +that demonstrates idempotency with no store is a worse reference than one that names its provider. + +### 3.18 Two auxiliary source sets did not compile at HEAD + +Neither is reachable from a leaf's `check`, which is why both survived: `check` compiles `main`, +`test` and `testFixtures`, and these lanes are compiled by `qualificationCheck`'s +`auxiliaryStyleCheck`, which only `ci` reaches. + +- `messaging-outbox-jdbc-postgresql`'s `OutboxPostgresIT` called `markAmbiguous(MessageId, ...)`, an + overload that no longer exists — a terminal write is now checked against the lease token, so the + method takes the lease that owns the row. The test claims through `claimBatch` and marks through + the returned lease. This lane is invoked by `integration-main.yml`, so it was a red CI job that no + local `check` could show. +- `httpclient`'s `Http2StreamSaturationTest` passed a fourth argument to + `ReactorHttpClientFactory.create`, which takes three. + +The same leaf's `testFixturesRuntimeClasspath` lock state was stale in the same way — seven Jetty +coordinates the configuration no longer resolves — so `verifyDependencyLocks`, which only the root +aggregate runs, was red at HEAD too. Regenerated. The optional gRPC build's Spotless check was red +for the same structural reason: `./gradlew spotlessApply` in the main build does not reach an +included build, so `-p optional-platforms` needed its own pass. + +### 3.19 The four commit-inclusion findings are now verifiable, and they hold + +`inbound-web C3`, `persistence-mongo H6`, `bootstrap/sample H5` and `build/CI H9` were open only +because the earlier sessions could not stage or commit, so "the moved trees are in the snapshot CI +consumes" could not be certified. `9da00eb7` committed them, so the question is answerable now: + + git ls-files src/adapter/outbound/httpclient/src/main/resources/META-INF # 1 + git ls-files src/adapter/outbound/notification/src/main/resources/META-INF # 1 + git ls-files src/adapter/outbound/persistence-jpa/src/main/resources/META-INF # 1 + git ls-files src/adapter/inbound/web/src/systemTest # 7 + git ls-files src/app-bootstrap/src/integrationTest # 5 + git ls-files src/sample-portfolio/src/systemTest # 2 + +The three `.imports` files are the ones H5 named as the dangerous half: a missing source set fails a +`strictTestLanes requires(...)` loudly, while a missing registration file leaves the class present +and the capability unassembled with nothing failing. All three are tracked. The registration tests +added in §3.16 now also make their absence a red test rather than a silent omission. + +### 3.20 Three optional capabilities lowered to `runtimeOnly` (overview §2.3) + +The review asks, once leaf ownership is settled, whether a capability the composition root does not +import can drop to `runtimeOnly` — while saying `runtimeOnly` is not itself the goal. Measuring the +root's own sources answers it for three of them today: + + app-bootstrap/src/main imports from persistence-mongo 0 + app-bootstrap/src/main imports from httpclient 0 + app-bootstrap/src/main imports from inbound:graphql 0 + +All three are now `runtimeOnly`. Nothing about the artifact changes — they still ship, and their +master switches still decide activation — but "the composition root has no compile-time business +with this capability" stops being a habit and becomes something the compiler keeps. It also makes +the set of capabilities a fork can drop by deleting one line visible in the build file, which is the +state the remaining nine packages have to reach. + +The four tests that name those leaves' types (the import filters, the deployment-mode enum, the HTTP +client settings) declare them as `testImplementation` rather than widening the main scope back, with +the Mongo reactive exclusions repeated because `MongoShippedCompositionContractTest` asserts the +shape of the classpath it runs on. + +For comparison, the capabilities that cannot move yet, and by how much: +`fileserver` 38 imports, `inbound:web` 29, `cache`/`redis` 25, `persistence` 13, `notification` 7, +`support` 3, `messaging` 3, `identifier` 2. + +### 3.21 The gRPC diagnostics redactor was not idempotent + +Surfaced only once the optional build's Spotless check stopped failing first — `-p optional-platforms +ci` runs without `--continue`, so one red task hid the next. + +`GrpcChannelDiagnosticsSnapshot` decides whether a peer address is masked by masking it and +comparing, because a masked address carries no marker to look for. That is the only test available +to it, and it works only if masking is idempotent. It was not: `maskAddress("10.4.x.x")` finds no +four numeric octets, falls through to the hash branch, and returns `masked:` — so a snapshot +assembled from correctly masked addresses was rejected as unmasked and the diagnostics endpoint +could not publish one. `maskAddress` now returns an already-masked value unchanged, and +`GrpcDiagnosticsRedactorIdempotenceTest` pins the property next to the function that has to hold it, +including the case of a value that merely ends in the mask's suffix. + +### 3.22 Smaller corrections + +- `AdapterActivationReportShapeTest` set `ca-skeleton.lock.multi-instance-enabled`, a key no + production code reads (the real one is `ca-skeleton.runtime.*`). The "widest possible shape" was + therefore missing that consumer. +- `integration-main.yml` no longer states a compose lane count in prose; the matrix file is what the + job reads, and the declared lanes have grown past the number the comment carried. + +## 3-B. What the first pass left open + +Written as a second section rather than folded above, because the first pass reported these as open +and the record should show what changed rather than quietly reading as if they never were. It +started at six; §3-B.7 is the seventh, which the first pass had put in §4 as blocked. + +### 3-B.1 Build/CI M6 — `org.gradle.parallel=true` is on + +The flag had been tried and reverted: three root tasks reached into other projects and resolved +their configurations, which Gradle refuses once project execution is parallel — +"Resolution of the configuration ':application-core:runtimeClasspath' was attempted without an +exclusive lock". The fix the review names is to make the verification project-owned, and that is +what happened: + +- `verifyCleanArchitectureDependencies` keeps the two repository-wide questions — is the registry + self-consistent, and does the set of governed modules match the set of declared leaves — and + depends on one `verifyModuleDependencyDirection` per module, registered in the module. +- `verifyApplicationCoreDependencyPurity` became one `verifyModuleDependencyPurity` per + `application-*` module, in that module. +- `verifyRuntimeModuleRegistry` became one `verifyCompositionRuntimeMembership` per composition + root, in that root. + +`architectureCheck` and the full `ci` pass with the flag on. What the move also did — and this was +not the goal — is close most of the configuration-cache half of M6; §3-B.7 records that, because the +reason it was open turned out not to be the reason the review gives. + +Turning the flag on then found something the review could not have: `adapter:inbound:web`'s +real-server lanes fail together and pass alone. Three of them start an embedded Tomcat, Jetty or +Reactor Netty and assert on timing — a permit released at the wrong moment, a capacity refusal that +has to arrive inside a five-second read timeout — and running them concurrently makes the machine, +not the code, decide. `ReactiveWebThrottleIT` failed three tests on socket timeouts and passed on +its own. + +Ordering them inside `adapter:inbound:web` was tried first and was not enough: the next run failed +`ReactiveWebThrottleIT` again and added `TomcatWebSocketAbuseIT`, because the contention is across +leaves rather than within one. So the lanes share one slot build-wide — +`ExclusiveRealServerLaneService`, a Gradle build service with `maxParallelUsages = 1`, attached by +`StrictTestLanePlugin` to every strict lane whose category is not `TEST`. That is precisely the set +that starts a server or a container; the hermetic unit lanes, which are the bulk of the build and +the whole reason to run in parallel, are untouched. + +The exclusive slot was necessary and not sufficient, and the next full run said so: with every +real-server lane taking turns among themselves, `webFluxContractTest` still failed twice — +`ReactiveContractRecordingIT`'s `unsupported-media-415` probe and `ReactiveWebThrottleIT`'s capacity +refusal, both `SocketTimeoutException` — while SpotBugs was analysing a dozen leaves. The contention +is not lane-against-lane at all. It is lane-against-the-whole-build, and no build service can +express that, because the thing the lane needs is the machine. + +So the second half of the fix is in the fixtures rather than the build. Every socket budget in the +web testkit was a small number chosen for an idle machine — five-second connects, ten-second reads — +and none of those suites asserts latency. They assert the status, headers, problem code and body +that came back. A timeout below the worst scheduling delay of a loaded host is therefore not a +safety net; it is a second, invisible assertion about how busy the host is, and it is the one that +failed. `HttpFixtureTimeouts` now holds one connect and one read budget for all six fixtures, with +the reason written where the number is rather than in six places. Two suites keep their own numbers +and say why: the fault lanes, where the client read budget *is* the contract, and the performance +lanes, where the measurement is the point. + +This is the cost the review's own K7 argument predicts — "a measurement on a shared CI runner +wobbles, and a wobbling gate gets switched off" — met by taking turns and by removing the hidden +latency assertion, rather than by switching anything off. It is also the one part of M6 the review +could not have known about, because the flag had never stayed on long enough to find it. + +### 3-B.2 HTTP-client L5 — the HTTP/2 promotion is reachable + +`Http2EvidenceMapper` knew how to turn a refused stream into "the peer did not process this", and +`BlockingAttemptExecutor` passed `ProtocolEvidence.none()` at every call, so the promotion existed +only in five unit tests. A `ProtocolEvidenceReader` seam now sits between the engine and the +classifier, and `ApacheHttp2EvidenceReader` walks the cause chain for HC5's +`H2StreamResetException`. + +Only `REFUSED_STREAM` is reported, and the limit is the finding's other half. RFC 9113 §8.7 makes +that code a fact about non-processing; GOAWAY needs the frame's last-stream-id compared against the +attempt's stream id, and HC5 surfaces neither. Reporting GOAWAY without them would mean treating +every connection that went away as proof the request was never processed — and the requests that +*had* been processed are exactly the ones a false NOT_SENT would duplicate. The reader says nothing +there, which leaves the ordinary classification in place. + +### 3-B.3 Phase 7 — the launcher and the capability status + +- `./gradlew bootstrap` takes `-PbootstrapProfile=` and selects the compose overlay by it, + defaulting to `local`. A profile naming no overlay is refused with the list read off the + directory. No `scripts/run` wrapper: the ordered four-stage lifecycle already lives in the plugin, + and a shell copy would either duplicate it or drift from it. +- `docs/capability-status.md` separates IMPLEMENTED, WIRED and QUALIFIED per capability and names + what decides each column — the registry, the registration file plus the composition edge, and a + real-provider lane **plus the workflow that runs it**. `CapabilityStatusDocumentTest` fails when a + `MasterSwitch` has no row, which is how the document stays complete; it deliberately does not + re-derive the cells, because those are judgements about evidence and a parser that computed them + would be the very thing the review says to stop adding. Writing it immediately found a capability + nobody had classified: `APP_FILESERVER_ENABLED`, the R2 publication block, distinct from the + fileserver platform switch. +- The compose gaps the review measured were already closed by earlier work and are recorded as such: + 18 declared lanes, redis/fileserver/httpclient present, a redis service in + `docker-compose.infra.yml`, static contract on PRs and the dynamic matrix on main/nightly. + +### 3-B.4 Phase 6 — more verification moved out of `build-tools` + +`verifyOperationalErrorRegistry` compared `OperationalError` with `docs/registries/error-codes.yaml` +using a hand-written YAML line scanner inside an included build. It needs no dependency resolution +and no task graph, so it is `OperationalErrorRegistryContractTest` in `app-bootstrap` now — reading +the registry with a real parser, which the scanner's line-prefix matching could not do. `build-tools` +is 98 files / 5,880 lines, from 102 / 6,152 at the review's own measurement. + +What remains is the JPA evidence platform (47 files, 2,830 lines) and the notification/messaging/mongo +evidence verifiers. Those are **not** moved, and deliberately: each is invoked by a release or +qualification workflow (`jpa-release.yml`, `jpa-r2-evidence.yml`, `ci-quality-gates.yml`, +`messaging-certification.yml`, `notification-platform.yml`), so deleting them removes release gates. +The review's K5 says `build-tools` may remain physically; what it asks is that verification needing +no build move out, and that is the rule being applied one verifier at a time rather than by +deleting a platform with live callers. + +### 3-B.5 Phase 2 — the Redis and Fileserver capabilities now own their own assembly + +The prerequisite turned out not to be a startup-SPI extraction. `12-bootstrap-sample.md` §3.4 already +names the answer and marks it Keep: `adapter/outbound/support`'s +`CapabilityStartupValidationException` lets a leaf fail closed without depending on app-bootstrap, +and `StartupFailureExceptionReporter` recognises it and emits the repository's standard +`STARTUP_VALIDATION_FAILED` log. All fourteen bootstrap-coupled call sites in the Redis package were +`StartupFailures.envValidation(...)` — a configuration error, which is exactly what that exception +is. + +So eight of the ten classes moved to `adapter:outbound:cache-redis`, which already allowed the +support edge in the registry: the capability root, the cache/rate-limit/lease/idempotency wiring, the +key policy, the settings and the ACL probe. The leaf ships its own +`AutoConfiguration.imports` and its own registration test; `app-bootstrap`'s no longer names it. + +Two stayed, and not for want of trying: `RedisReadinessGroupPostProcessor` appends to the +application-wide readiness group and `RedisActivationValidator` reads the bootstrap-owned secret +policy. Both are cross-capability by the review's own ownership rule — "application-wide common +infrastructure → bootstrap" — so moving them would have been the wrong direction, not progress. + +`CaSkeletonApplication` needed two changes, and both were demanded by a test rather than guessed: + +- the scan exclusion gained the new package — the parity test failed with the four imported children + by name; +- `@ConfigurationPropertiesScan` was narrowed from `dev.caskeleton.adapter.outbound.cache.redis` to + `...cache.redis.sdk`. The wider base package now contained `RedisCapabilitySettings`, so the + properties scan bound it while every switch was off — the exact thing the off-state contract + forbids, caught by the shipped-composition test naming the bean. + +The move also exposed an older fragility that had nothing to do with Redis: +`PersistenceJpaAutoConfigurationTest` read its registration file through +`getResourceAsStream`, which answers with the first match on the classpath. It had been correct only +because no other leaf on that classpath shipped one; the moment `cache-redis` did, it read someone +else's file. It reads its own file now, the way the registration tests added in §3.16 do. + +**Fileserver.** The first pass called this one blocked on a design decision — a new starter leaf, +because the assembly's imports span `adapter:outbound:fileserver`, `adapter:inbound:web` and +`application-fileserver`. That reading was wrong, and the way it was wrong is the useful part: the +28 classes were not one assembly with three owners. They were two assemblies that had been merged +into one package, and the merge was what made the ownership look undecidable. + +Splitting on the actual question — *does this class need anything outside the fileserver leaf?* — +divides them cleanly: + +- **13 moved** to `adapter:outbound:fileserver`, under `platform/autoconfigure`: the settings and + their binder, the startup check and validator, and the storage-gateway, storage-operations, + verification, security, download-lifecycle, maintenance and observability wiring. A new + `FileserverCapabilityAutoConfiguration` is the leaf's root — the master switch, the settings bean, + and `@Import` of the seven — and the leaf ships its own `AutoConfiguration.imports` and its own + registration test. +- **13 stayed** in `app-bootstrap`, and each for a named reason rather than inertia. Nine are the + HTTP surface — core policy, web assembly, HTTP download, nginx delegation, protocol, the admin + plane and its management context, and the startup configuration that composes the whole platform — + which is `adapter:inbound:web`'s business and belongs to the composition root by the review's own + ownership rule. Four are cross-adapter and were moved *back* after they failed to compile in the + leaf: `FileserverLocalStorageCoreConfiguration` needs + `adapter:outbound:persistence-fileserver` and spring-jdbc, `FileserverUploadServiceConfiguration` + needs `adapter:outbound:identifier`, and `FileserverCleanupConfiguration` with its worker needs + logstash's `kv(...)` encoder. A leaf that reaches a sibling adapter is the composition root's job + by definition. +- **2 were deleted.** `FileserverStorageConfiguration` and `FileserverServiceConfiguration` were + pure `@Import` aggregators, and each aggregated across that split — leaf-internal wiring in the + same list as a sibling-adapter dependency. Keeping them would have meant an aggregator that has to + live in bootstrap in order to name classes that live in the leaf, which is the coupling the move + is for. The imports they held are now on the two roots that can actually own them. + +The leaf gained one registry edge, `adapter-outbound-support`, for the same reason Redis already had +it: `FileserverStartupViolations` collects every violation and throws +`CapabilityStartupValidationException`, so the leaf fails closed with the repository's standard +`STARTUP_VALIDATION_FAILED` report and without depending on `app-bootstrap`. `modules.json`, the +leaf's `build.gradle` and its `gradle.lockfile` were updated together. + +`CaSkeletonApplication` needed the same two changes as Redis, and again a test named them: the scan +exclusion gained `...fileserver.platform.autoconfigure.*`, and +`dev.caskeleton.bootstrap.autoconfigure.fileserver` came out of `@ConfigurationPropertiesScan` +because the moved `FileserverPlatformSettings` is now bound by the leaf's own root. + +### 3-B.6 Object Storage M7 — the claim is closed, the qualification is not + +The AWS lane's two tests were called `...QualificationTest` and asserted that four environment +variables were set. Nothing in them touches S3, builds this leaf's provider or moves a byte, so a +green run meant "somebody exported the right variables" while the name said "the AWS provider is +qualified". They are `AwsS3QualificationPreconditionsTest` and +`AwsS3DirectMutationPreconditionsTest` now, with the distinction written into the class. + +The qualification itself stays open and cannot be closed here: it needs credentials and an +authorised sandbox, and manufacturing evidence for it is the one thing worse than not having it. +What is closable is the claim — `AwsQualificationClaimHonestyTest` fails if any card in +`docs/registries/object-storage-readiness.yaml` names an AWS provider while the preconditions lane +is the only AWS evidence there is. Today no card does, so the registry is honest; the test is what +has to be deleted before anyone can make it dishonest. + +### 3-B.7 Build/CI M6, the other half — the configuration cache + +M6 names five call sites as what blocks the configuration cache — +`notCompatibleWithConfigurationCache` in `JavaConventionsPlugin`, `getTaskGraph().whenReady` and +`addTestListener` in `StrictTestLanePlugin`, and `projectsEvaluated` in `ArchiveHygienePlugin`, +`ArchitecturePlugin` and `RuntimeMembershipPlugin` — and the first pass repeated that list into +`gradle.properties` and into §4. Repeating it was the mistake: none of it had been measured, and +`./gradlew ci --dry-run --configuration-cache` takes eight seconds. + +Measured, four of the five are not problems at all. `projectsEvaluated` and `whenReady` both run +during configuration, which is the phase the cache stores. The `addTestListener` registrations *are* +in the `integrationCheck` graph and still produce nothing: `StrictLaneExecutionTracker` is a plain +class holding two `AtomicLong`s and a set, which is all the cache asks of a listener. The real +blockers were four tasks — three of them written *in this pass*, in §3-B.1, when the root-owned +checks were split into project-owned ones — each holding a live `Configuration` in its task state: + + :application-core:verifyModuleDependencyPurity VerifyApplicationCoreDependencyPurityTask + ::verifyModuleDependencyDirection VerifyModuleDependencyDirectionTask + :app-bootstrap:verifyCompositionRuntimeMembership VerifyCompositionRuntimeMembershipTask + :adapter:outbound:{messaging,notification}:verifyDependencyPolicy VerifyDependencyPolicyTask + +A `Configuration` cannot be serialised, so storing failed outright rather than degrading — and the +failure is fatal, which is why the first measurement reported one problem and hid the other eight +behind it. All four now take a `Provider` from +`getIncoming().getResolutionResult().getRootComponent()`, the supported carrier, plus the declared +dependencies as strings. The graph is resolved while the owning project is still configuring instead +of at execution time from whichever project happens to run the action, which is the same ownership +correction §3-B.1 made for the parallel flag — the two defects had one cause. + +Three smaller things fell out of it. `getAllComponents()` has no equivalent on a root component, so +`ResolvedComponents.reachableFrom` walks the graph with a visited set — not an optimisation, because +a cycle there is an infinite loop rather than a diagnosis. `DependencyPolicyCheck` had to become +public: the cache rebuilds a record through its canonical constructor, and a package-private record +has a package-private one, which surfaced as `NoSuchMethodException` on the *second* run only. +And `VerifyApplicationCoreDependencyPurityTask` called `getProject()` in its action for a log line; +it carries the module path as an input now. + +Result, measured rather than argued: + + ./gradlew ci --dry-run --configuration-cache --configuration-cache-problems=fail # stored, reused + ./gradlew integrationCheck --dry-run --configuration-cache --configuration-cache-problems=fail # stored, reused + ./gradlew releaseCheck --dry-run --configuration-cache --configuration-cache-problems=fail # stored, reused + ./gradlew architectureCheck :adapter:outbound:{messaging,notification}:verifyDependencyPolicy \ + --configuration-cache --configuration-cache-problems=fail # executes, reused + +The rewrite was checked for having neutered the checks rather than fixed them: emptying +`application-core`'s `allowed_dependencies` in the registry still fails +`:application-core:verifyModuleDependencyDirection` with the forbidden edge named, under the +configuration cache. + +One opt-out remains and is deliberate: `ResolveConfigurationsTask` — `verifyDependencyLocks` and +`resolveAndLockAll`. Resolving every configuration at execution time is not an implementation detail +of that task, it *is* the task, because STRICT lock validation happens during resolution; moving it +behind a provider would move lock verification into every build's configuration phase. Since the +pull-request gate runs `:ci` and `:verifyDependencyLocks` in one invocation, the flag is still off +repository-wide — enabling it is a change to how CI is split, not a property, and +`gradle.properties` now says that instead of the five call sites. + +What did change is the review's other complaint about this job: `ci-quality-gates.yml`'s +`configuration-cache` job checked two leaves. It now requires all three repository-wide gates to +store *and* reuse, via `--dry-run` — which answers the storability question for the entire task +graph in seconds — and keeps the executing two-leaf check, because `--dry-run` cannot prove that a +reused entry still does the work. + +## 4. What remains, and why + +One item, and it is blocked on something this session cannot supply rather than on effort. + +- **Object Storage AWS qualification.** Needs credentials and an authorised sandbox. The claim is + guarded (§3-B.6) — `AwsQualificationClaimHonestyTest` fails if any readiness card names an AWS + provider while the preconditions lane is the only AWS evidence — but the evidence itself cannot be + manufactured, and manufacturing it is the one outcome worse than not having it. + +Two things that earlier drafts of this document listed here are *not* remaining work, and saying why +matters more than the line item: + +- **Phase 2's fileserver capability** was called blocked on a new starter leaf. It was not; the + package held two assemblies rather than one, and splitting it on ownership needed no new module + (§3-B.5). +- **Configuration cache** was called blocked on five plugin call sites, copied from the review + without measuring. Four of the five were never problems; the actual blockers were four tasks this + work itself had introduced, and they are fixed (§3-B.7). What is left is one deliberate opt-out on + lock verification, which is a property of what that task does. + +Everything else the first pass listed here — Phase 6's governance reduction, Phase 7, Build/CI M6, +HTTP-client L5 — is closed in §3-B. + +## 5. Verification + +The repository-wide gate had not been run against this tree before this pass; running it is what +found most of §3. Final state: + + ./gradlew ci verifyDependencyLocks verifyPublicPathSnapshot --continue # exit 0 + ./gradlew -p optional-platforms ci --continue # exit 0 + ./gradlew -p build-logic test # exit 0 + ./gradlew -p build-tools test # exit 0 + +Zero failing tasks. Run with `org.gradle.parallel=true`, which is itself part of what is being +verified: the same four commands failed eight tasks before the verification moved into the owning +projects, two more after the real-server lanes got their exclusive slot, and none once the web +testkit's socket budgets stopped asserting machine load (§3-B.1). + +The configuration cache is verified separately, because it is a property of the task graph rather +than of a run: + + ./gradlew {ci,integrationCheck,releaseCheck} --dry-run \ + --configuration-cache --configuration-cache-problems=fail # each: stored, then reused + +Both invocations of each gate pass with problems set to `fail`, so this is not a count of warnings — +it is the absence of any. `verifyDependencyLocks` is outside that set by design (§3-B.7). + +`ci` is leaf checks + `architectureCheck` + `qualityCheck` + `configContractCheck` + +`qualificationCheck` + `sampleWebContractCheck`, so it covers SpotBugs/FindSecBugs, the environment +contract, the auxiliary source sets that no leaf `check` compiles, and the app-bootstrap +`systemTest` and `architectureTest` lanes. + +Container-backed lanes are not included: `integrationCheck` and the compose runtime matrix are +stage-2 CI jobs by design, and the review's Keep list says so. The one such lane this pass touched — +`messaging-outbox-jdbc-postgresql:integrationTest` — was verified to compile, which is what was +broken; its execution belongs to `integration-main.yml`. + +One observation was first recorded here as a flake and turned out not to be one, which is the reason +it is worth keeping in the record. `adapter:inbound:web:webFluxContractTest` failed with a +`SocketTimeoutException` in one full run, passed in the next, and then failed again in a third — two +tests that time, in two different suites. Re-running would have "cleared" it twice. What it actually +was is described in §3-B.1: the web testkit's socket budgets were small enough to expire on a healthy +server under a parallel build, so every one of those suites carried an unstated assertion about +machine load. The three runs are the evidence that a lane starting real servers under contention is +exactly the kind of gate that gets turned off after being mistaken for a defect — and that calling +the first failure a flake was the beginning of doing that. + +Falsifiability was checked where a new test could pass vacuously: the registration contract fails +when one non-auto-configuration line is added to a leaf's `.imports` file (and the file is +byte-identical to `HEAD` afterwards), and the gRPC operation-ledger aggregate was confirmed by +`--dry-run` to reach `:grpc:grpc-operation-ledger-jpa:integrationTest`. + +Nothing is committed or pushed, and nothing is staged. + +That last clause needed correcting rather than stating. The capability moves were made with +`git mv`, which stages, so 31 renames sat in the index — contrary to the repository's `human-only` +commit policy, and put there by this work rather than by anyone. The index is restored to `HEAD`. +Only the index was touched: the working tree's checksum is byte-identical before and after, and no +file was rewritten to achieve it. + +Restoring it also makes the review's H5 warning sharper rather than softer, which is the reason to +say so precisely. The tree now stands at 252 modified files, **36 deleted** and **54 untracked**, +and the deletions and the additions are two halves of the same moves: + +| Move | Old paths, now deleted | New paths, now untracked | +| --- | --- | --- | +| Redis capability → `cache-redis` | 8 main + 2 test | the same 10, plus a leaf `.imports` and a registration test | +| Fileserver capability → `fileserver` | 13 main + 1 test | 13 main + 2 new roots, plus a leaf `.imports` and 2 tests | +| Object storage qualification rename | 2 | 2 | +| `build-logic`/`build-tools` verification moves | 8 | 4, plus the tests that replaced them | + +So `git commit -a` would record every deletion and none of the additions, and the result would +compile against nothing: `RedisCapabilityConfig` would be gone from `app-bootstrap` and absent from +`cache-redis` in the same commit. **`git add -A` is required**, and a `git status` that shows zero +untracked paths afterwards is the check that it worked. diff --git a/docs/superpowers/plans/2026-09-23-app-bootstrap-build-composition-plan.md b/docs/superpowers/plans/2026-09-23-app-bootstrap-build-composition-plan.md new file mode 100644 index 00000000..33520ffa --- /dev/null +++ b/docs/superpowers/plans/2026-09-23-app-bootstrap-build-composition-plan.md @@ -0,0 +1,272 @@ +# App Bootstrap Build Composition — implementation plan + +Design authority: the 2026-09-23 "App Bootstrap Build Composition 설계 작업 문서". +Review authority: `docs/reviews/2026-09-18-techlead-review/` §00, §12, §13 and +`docs/reviews/2026-09-23-techlead-review-application-closure.md`. + +This plan is the §17 deliverable. It settles the three decisions the design document deliberately +left open — what "selection" *is* mechanically, where the contract is enforced, and what a +composition module is allowed to be — and then splits the work into the task units §17 names. It +does not restate the design. + +## 0. Measured baseline + +Re-measured on the current tree rather than quoted (design §15 forbids reusing an old log). + +The design document's named gate is green: + + ./gradlew verifyCleanArchitectureDependencies :adapter:outbound:persistence-jpa:test \ + :app-bootstrap:test :app-bootstrap:architectureTest --continue # exit 0, 0 FAILED + +`:app-bootstrap:runtimeClasspath` resolves **33 project edges**. Every optional capability is among +them, including the three the earlier pass lowered to `runtimeOnly`: + + graphql httpclient persistence-mongo <- runtimeOnly, still on the classpath + fileserver notification cache-redis redis-runtime + messaging-spring-boot-starter + 16 further messaging leaves + +This is the design document's §2.3 claim, confirmed: `runtimeOnly` moved these off the *compile* +classpath and left them in the artifact. Nothing about the shipped jar changed. + +## 1. Decision — selection is a Gradle edge, and the repository already has one + +The design document asks for a mechanism without naming one. It does not need a new one: **object +storage is already in the target state**, and `docs/capability-status.md` already documents it that +way — WIRED **no**, "The leaf is not an `app-bootstrap` dependency … A fork that wants it adds the +edge", with `integrationTestImplementation project(':adapter:outbound:objectstorage')` supplying it +to the lane that proves it assembles. + +So the work is not to invent Build Composition. It is to move the other capabilities to the shape +one capability already has. + +**Selection = the presence of a project dependency in `app-bootstrap/build.gradle`.** Not a Gradle +property, not a feature variant, not a capability DSL. Reasons, in the order design §9 ranks them: + +- it is the existing Gradle model, and it is already how object storage works; +- a property would make the shipped artifact depend on how the build was invoked, so two builds of + the same commit could ship different jars — the opposite of what a composition contract is for; +- the thing a fork edits is one line in one file, which is what a template should ask of an adopter. + +Rejected alternative, recorded because it is the obvious one: `-PcaCapabilities=fileserver,...`. It +reads well and it is worse — it moves the answer to "does this build ship Fileserver?" out of the +repository and into the invocation, and no test can pin an invocation. + +## 2. Decision — the contract is enforced by the verifier that already exists + +Design §7.1 requires a RED test proving an unselected capability is absent from +`runtimeClasspath`, and design §9 forbids adding a bespoke verifier for it. + +Both are satisfiable at once. `ca.dependency-policy` already resolves a named configuration and +fails on forbidden or missing coordinates (`dependencyPolicy { absent … required … }`, +`VerifyDependencyPolicyTask`, wired into `check`). A project dependency resolves to a real +`ModuleVersionIdentifier` — `dev.caskeleton:` — so an absence on `runtimeClasspath` is +expressible today, with no new task, no new source set and no string scanning. + + // app-bootstrap/build.gradle + dependencyPolicy { + absent 'dev.caskeleton:fileserver', + 'Fileserver is an optional capability; the minimal composition does not ship it.' + } + +That is the Phase 1 RED: it fails on the current tree, because the edge is there. + +Two things this deliberately does **not** replace: + +- the Runtime Activation tests. Design §3.1 is the whole point — `absent` answers "is it in the + artifact", the existing OFF-state guards answer "is it assembled". Neither is evidence for the + other, and the plan keeps them in different files so they cannot be confused. +- the boot artifact evidence design §7.5 asks for. `runtimeClasspath` is what `bootJar` packages, so + the two agree by construction — but "by construction" is an argument, not a measurement. One + `bootJar` content assertion is added once, in Step 7, as a check *of the argument*, not per + capability. + +## 3. Decision — what a composition module may contain + +A `composition:` module exists only when a capability genuinely spans adapters that must +not depend on each other. It contains cross-adapter wiring and nothing else: no business rule, no +transport surface, no settings that a single leaf could own. If a capability turns out to be +self-contained after the leaf-ownership pass, **no composition module is created for it** — the leaf +is selected directly, exactly as object storage is. + +This matters because the fileserver work in the 2026-09-23 closure §3-B.5 already found that the +package which looked like one cross-adapter assembly was two assemblies merged. The same question is +asked before each composition module is created, not after. + +Registry: each new module gets a `modules.json` entry with explicit `allowed_dependencies`. +`settings.gradle` includes registered projects automatically, so registration *is* inclusion. A +composition module is **not** a composition root: it composes a capability, it does not run. + +## 4. Task units + +Ordered. A unit is done when its own focused command is green; no unit starts before the previous +one is. + +| # | Unit | Done when | +| --- | --- | --- | +| 1 | Fileserver Build Composition RED test | `:app-bootstrap:verifyDependencyPolicy` fails naming `dev.caskeleton:fileserver`, and the failure text is the contract | +| 2 | Fileserver composition extraction | the 4 cross-adapter configurations left in bootstrap by closure §3-B.5 move to `composition:fileserver`; bootstrap's fileserver edges are gone; unit 1 is green | +| 3 | Fileserver ON/OFF regression | OFF-state and ON-state tests unchanged in meaning and green, from the source set that selects the composition | +| 4 | Notification composition extraction | same shape, same three units collapsed into one because the pattern is proven | +| 5 | Persistence/JPA ownership review | per-file verdict against design §11 Q1–Q4, recorded; only files that answer Q1 or Q2 move | +| 6 | Messaging / Redis residual ownership | broker selection becomes a build edge; Redis keeps only the two application-wide files closure §3-B.5 already justified | +| 7 | Mongo / HTTP client / GraphQL actual optionalization | `runtimeOnly` → absent; one `bootJar` assertion proves the classpath argument | +| 8 | Minimal + full composition certification | minimal = `:app-bootstrap` main; full = the app-bootstrap `systemTest` source set selecting every capability. No new application module unless a source set proves insufficient | +| 9 | Registry / docs / comment alignment | `modules.json`, `capability-status.md` WIRED column, and the "shipped so an operator can enable it" comments in `app-bootstrap/build.gradle` all say the same thing | +| 10 | Focused → repository-wide gates | design §15 command, then `ci`, dependency locks, public-path snapshot, optional-platforms | + +Unit 8 uses a source set rather than a new module because `app-bootstrap:integrationTest` already +does exactly this for object storage. Design §6.2 warns against forcing `sample-portfolio` to carry +every capability, and this avoids it without adding a module. + +## 5. What this plan does not do + +Taken from design §10, repeated here because a plan that omits them invites them: + +- no mechanical removal of every `dev.caskeleton.adapter.*` import; ownership is argued per file +- no new platform layer, no new build DSL, no per-capability verifier +- no change to provider behaviour, no feature work, no unrelated test cleanup +- no staging, commit or push — repository policy is `human-only` +- no working-tree cleanup; the tree carries 36 tracked deletions and 54 untracked additions from the + previous pass, and closure §5 records how they must be committed + +## 6. Regression guard + +Design §14's list is the non-negotiable set. Each unit's focused command includes whichever of these +it can break: + + JPA boundary gate :adapter:outbound:persistence-jpa:test + Redis composition unit isolation :adapter:outbound:cache-redis:test + app-bootstrap architecture test :app-bootstrap:architectureTest + runtime activation OFF guards :app-bootstrap:test, :app-bootstrap:systemTest + configuration cache ci/integrationCheck/releaseCheck --dry-run --configuration-cache + gRPC operation-ledger CI caller -p optional-platforms integrationCheck + +Leaf ownership already moved for Redis and Fileserver (closure §3-B.5) is a floor, not a starting +point: this work extends it and must not walk it back. + +## 7. Progress — units 1 and 2 + +### Unit 1 is done + +`app-bootstrap/build.gradle` declares the contract as a `dependencyPolicy` absence on +`runtimeClasspath`. It was checked for vacuity before it was trusted: a temporary `required` on the +same coordinate passed, which is what proves `dev.caskeleton:fileserver` is the shape a project +dependency actually resolves to. Without that probe an `absent` rule with a misspelled coordinate +would have been green from the first day and meant nothing. + +### Unit 2 is done except for one measured blocker + +Moved, in this order, because each step unblocked the next: + +1. **`RuntimeProfileSnapshot` → `adapter:outbound:support`.** It was the real coupling. A capability + configuration that has a production-only rule had to ask app-bootstrap what the profile was, so + the configuration could not leave app-bootstrap. BOOT-002 said "one composition-root owner"; it + now says one owner for the repository, which is strictly stronger and is what lets a composition + module ask the question at all. +2. **`composition:fileserver-platform` created and registered.** Named for the capability rather + than the directory: `:composition:fileserver` resolves to `dev.caskeleton:fileserver`, the same + coordinate as `adapter:outbound:fileserver`, and Gradle silently substituted the module for + itself. The messaging family already prefixes its leaves for this reason. +3. **The 13 cross-adapter configurations moved**, with the auto-configuration and management-context + registration files that name them. `StartupFailures` became + `CapabilityStartupValidationException`, the same seam the Redis and Fileserver leaf moves used. +4. **app-bootstrap's fileserver edges removed**; the lanes that verify the capability select it. +5. **BOOT-007 moved to the module it governs**, with `allowEmptyShould(false)`. Left where it was it + would have analysed an empty package and passed for having nothing to check — and BOOT-012 caught + the rule leaving the pinned set, which is that guard working rather than an obstacle. + +Result: `adapter:outbound:fileserver` is off the minimal runtime classpath. Project edges on +`:app-bootstrap:runtimeClasspath` went from 33 to 32. + +**The blocker, measured rather than estimated.** `application-fileserver` is still there, and not +through the composition. It arrives through three leaves every application needs, because the +capability's code is inside them: + +| leaf | fileserver files | +| --- | --- | +| `adapter:inbound:web` (`web.fileserver.*`) | 62 | +| `adapter:outbound:persistence-jpa` (`persistence.fileserver.*`) | 25 | +| `adapter:outbound:identifier` | 1 | + +So Fileserver was never only "assembled by the composition root". It is embedded in required leaves, +and no composition module can express selecting it out until those 88 files move to leaves of their +own. The coupling was measured and is one-directional and small — `web.fileserver` reaches +`web.{core, observability, auth}` nine times, and exactly one non-fileserver web class +(`WebModuleBoundary`) reaches back — so the split is tractable. It is unit 2b, and it is the next +thing to do. + +The contract line stays RED. Softening it to make the gate green would record the opposite of what +was measured, and design §7.1 asks for this test to be RED before the structure changes, not after +it is convenient. + +### Verification at this point + + ./gradlew verifyCleanArchitectureDependencies :adapter:outbound:persistence-jpa:test \ + :app-bootstrap:test :app-bootstrap:architectureTest \ + :composition:fileserver-platform:check :adapter:outbound:support:test --continue # green + + ./gradlew ci --continue # 1,276 tasks, exactly one failure: + # :app-bootstrap:verifyDependencyPolicy, the intended RED + +One failing task out of 1,276, and it is the one this unit deliberately left failing. Nothing else +in the repository regressed. + +## 8. Unit 2 is complete — the Fileserver vertical slice + +The blocker recorded above was right about the cause and wrong about the size. `application-fileserver` +arrived through three required leaves, and all three turned out to be clean extractions: + +| Extracted | Into | Why it was clean | +| --- | --- | --- | +| 1 file — the upload identifier factory | `adapter:outbound:fileserver` | It implements one Fileserver port and nothing else. One class is why every application that needed an identifier also resolved the Fileserver use cases. | +| 25 files + 4 migrations | `adapter:outbound:persistence-fileserver` (new leaf) | The package imported `application.fileserver`, JPA, Hibernate, Spring Data and JDBC — and not one type from any other `persistence.*` package. No seam was needed. | +| 62 files | `adapter:inbound:web-fileserver` (new leaf) | `web.fileserver` imports `web.{core, auth, observability}` nine times; exactly one non-fileserver class referenced it back, and only in a javadoc sentence. | + +The web platform's module map did **not** move. `WebStableModule` still declares the twelve fileserver +modules and their edges, and `WebBuildModel.platformSourceRoots()` now returns two roots — which is +what that method's plural has meant since it was written. A second copy of the map in the second leaf +would have been a second answer to "is this edge declared", and the map is the one thing a platform +must not have two of. + +Result: `:app-bootstrap:runtimeClasspath` went from **33 project edges to 31**, and the contract now +names the whole capability rather than the part that was easy to remove: + + absent 'dev.caskeleton:fileserver' + absent 'dev.caskeleton:application-fileserver' + absent 'dev.caskeleton:web-fileserver' + absent 'dev.caskeleton:persistence-fileserver' + +### What the repository's own guards caught + +Every move was stopped first by a guard already in the tree, and every one was the same shape — a +rule still pointing at something that had moved: + +- `JpaModuleBoundaryTest`: *"a rule about a package that does not exist passes by finding nothing"* +- `ArchRuleDiscoveryContractTest` (BOOT-012): a rule leaving the pinned set is a decision, not a deletion +- `verifyJpaApiSurface` / `verifyJpaAdopterApiSurface`: surface change promoted to a review decision +- `PersistenceEntityScanCoverageTest`: an opt-in package that is no longer opt-in because it is no longer here + +`verifyJpaAdopterApiSurface` was **not** widened by allowlist (design §28). Its scan excludes the +directory that *owns* the implementation; there are two such leaves now, so the exclusion was +corrected, and the baseline file still governs every other module's imports. + +### One regression this introduced and then removed + +The new web leaf first declared `spring-boot-starter-webflux`. The web leaf's own build file says in +a comment why it declares `spring-webflux` instead: the starter puts reactor-netty — a second +embedded server — on the runtime classpath of an application that already has Tomcat. The new leaf +now matches, and the lock files record the difference. + +### Verification + + ./gradlew ci verifyDependencyLocks --continue # exit 0, 0 FAILED + +Repository-wide, everything green, including `:app-bootstrap:verifyDependencyPolicy` — the RED that +opened this unit. + +### Next + +Unit 4, the Notification composition. Unit 3's ON/OFF regressions are covered by the tests that moved +with the code (`FileserverRuntimeAssemblyTest`, `FileserverPlatformAutoConfigurationTest` in the +composition module, `FileserverCompositionIntegrationTest` in app-bootstrap's integration lane) and +all are green in the run above. diff --git a/infra/redis-sdk/acl/README.md b/infra/redis-sdk/acl/README.md index 5cf198ec..9c418ea6 100644 --- a/infra/redis-sdk/acl/README.md +++ b/infra/redis-sdk/acl/README.md @@ -5,8 +5,15 @@ the account is the last enforcement boundary and a permit issued inside the proc so a mistake in the SDK is still refused by the server. A Redis ACL file accepts nothing but complete `user` lines — no comments and no line continuations — -which is why the rationale lives here instead of inline. Password material is supplied at deploy -time; none of these files carries one. +which is why the rationale lives here instead of inline. + +Every account here carries a **fixture** password (`fixture-*`). None of them is a deployment +credential and none is read by anything but the local lanes; a deployment replaces the whole file +with one whose passwords come from its secret store. They are written down rather than left as +`nopass` because an account that accepts any password makes every assertion about authentication +pass for the same reason a typo would have — and because these files are what a fork copies. The +four per-role files carried `nopass` long after `all-accounts.acl`, the file a deployment actually +loads, had been fixed; a fork that copied one of them got an open account and a green lane. | File | Account | Grants | | --- | --- | --- | diff --git a/infra/redis-sdk/acl/admin-readonly.acl b/infra/redis-sdk/acl/admin-readonly.acl index 068208b1..0ff025ee 100644 --- a/infra/redis-sdk/acl/admin-readonly.acl +++ b/infra/redis-sdk/acl/admin-readonly.acl @@ -1 +1 @@ -user ca-skeleton-admin-readonly on nopass ~* resetchannels -@all +info +dbsize +time +lastsave +memory|usage +memory|stats +slowlog|get +slowlog|len +latency|latest +latency|history +client|list +client|info +command|info +command|docs +command|count +command|getkeysandflags +config|get +acl|dryrun +acl|whoami +cluster|info +cluster|slots +cluster|shards +cluster|nodes +object|encoding +object|freq +object|idletime +pubsub|channels +pubsub|numsub +pubsub|shardchannels +xinfo|stream +xinfo|groups +xinfo|consumers +function|list +function|stats +cluster|keyslot +user ca-skeleton-admin-readonly on >fixture-admin ~* resetchannels -@all +info +dbsize +time +lastsave +memory|usage +memory|stats +slowlog|get +slowlog|len +latency|latest +latency|history +client|list +client|info +command|info +command|docs +command|count +command|getkeysandflags +config|get +acl|dryrun +acl|whoami +cluster|info +cluster|slots +cluster|shards +cluster|nodes +object|encoding +object|freq +object|idletime +pubsub|channels +pubsub|numsub +pubsub|shardchannels +xinfo|stream +xinfo|groups +xinfo|consumers +function|list +function|stats +cluster|keyslot diff --git a/infra/redis-sdk/acl/application-advanced.acl b/infra/redis-sdk/acl/application-advanced.acl index 9f1962d3..44a2ead3 100644 --- a/infra/redis-sdk/acl/application-advanced.acl +++ b/infra/redis-sdk/acl/application-advanced.acl @@ -1 +1 @@ -user ca-skeleton-application-advanced on nopass sanitize-payload ~prod:* resetchannels &prod:* -@all +@read +@write +@string +@hash +@list +@set +@sortedset +@bitmap +@hyperloglog +@geo +@stream +@pubsub +@transaction +evalsha +evalsha_ro +script|load +script|exists +fcall +fcall_ro -keys -flushdb -flushall -shutdown -debug -eval -eval_ro -smembers -sort -sort_ro -randomkey -migrate -swapdb -select +user ca-skeleton-application-advanced on >fixture-advanced sanitize-payload ~prod:* resetchannels &prod:* -@all +@read +@write +@string +@hash +@list +@set +@sortedset +@bitmap +@hyperloglog +@geo +@stream +@pubsub +@transaction +evalsha +evalsha_ro +script|load +script|exists +fcall +fcall_ro -keys -flushdb -flushall -shutdown -debug -eval -eval_ro -smembers -sort -sort_ro -randomkey -migrate -swapdb -select diff --git a/infra/redis-sdk/acl/application.acl b/infra/redis-sdk/acl/application.acl index e24e48b4..47fd4065 100644 --- a/infra/redis-sdk/acl/application.acl +++ b/infra/redis-sdk/acl/application.acl @@ -1 +1 @@ -user ca-skeleton-application on nopass sanitize-payload ~prod:* resetchannels &prod:* -@all +@connection +@pubsub +@transaction +@read +@write +@string +@hash +@list +@set +@sortedset +@bitmap +@hyperloglog +@geo +@stream -keys -flushdb -flushall -shutdown -debug -sort -sort_ro -smembers -randomkey -migrate -swapdb -select +user ca-skeleton-application on >fixture-application sanitize-payload ~prod:* resetchannels &prod:* -@all +@connection +@pubsub +@transaction +@read +@write +@string +@hash +@list +@set +@sortedset +@bitmap +@hyperloglog +@geo +@stream -keys -flushdb -flushall -shutdown -debug -sort -sort_ro -smembers -randomkey -migrate -swapdb -select diff --git a/infra/redis-sdk/acl/raw-gateway.acl b/infra/redis-sdk/acl/raw-gateway.acl index 83d15d51..98c6a088 100644 --- a/infra/redis-sdk/acl/raw-gateway.acl +++ b/infra/redis-sdk/acl/raw-gateway.acl @@ -1 +1 @@ -user ca-skeleton-raw-gateway on nopass sanitize-payload ~prod:* resetchannels -@all +smembers +sort +sort_ro +user ca-skeleton-raw-gateway on >fixture-raw sanitize-payload ~prod:* resetchannels -@all +smembers +sort +sort_ro diff --git a/src/.env.example b/src/.env.example index aab7ed1d..fab71e86 100644 --- a/src/.env.example +++ b/src/.env.example @@ -235,6 +235,7 @@ APP_FILESERVER_LOCAL_EXPECTED_FILE_STORE_TYPE= APP_FILESERVER_LOCAL_MOUNT_SENTINEL_SHA256= APP_FILESERVER_LOCAL_EXPECTED_OWNER= APP_HTTPCLIENT_ENABLED=false +APP_HTTPCLIENT_ROTATION_DRAIN_TIMEOUT=30s APP_FILESERVER_PLATFORM_ENABLED=false APP_FILESERVER_PLATFORM_INSTANCE_ID=local-node APP_FILESERVER_PLATFORM_DEFAULT_NAMESPACE=default diff --git a/src/Dockerfile b/src/Dockerfile index 40666069..00f4087f 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -38,6 +38,10 @@ WORKDIR /build/src # (Requires the labs Dockerfile frontend — see the `# syntax` directive at the top of this file.) COPY gradlew ./ COPY gradle/ gradle/ +# The repository's Gradle memory, worker and caching settings. Without it the dependency-resolution +# stage below resolves every module's locked configuration on Gradle's defaults rather than the +# -Xmx1g / workers.max / caching-on this build is tuned for. +COPY gradle.properties ./ COPY config/ ./config/ COPY --parents settings.gradle build.gradle **/build.gradle **/gradle.lockfile ./ # The convention plugins, whole. The glob above copies files named build.gradle and gradle.lockfile, diff --git a/src/README.md b/src/README.md index ada3d7e0..3e32317d 100644 --- a/src/README.md +++ b/src/README.md @@ -15,6 +15,11 @@ 테스트, Spotless, Checkstyle, Error Prone만 담당합니다. 저장소 전체 정책은 이름이 드러나는 루트 task로 실행하며, CI가 이를 집계합니다. +이 셋의 역할은 겹치지 않습니다. Spotless(google-java-format)가 포맷과 import 순서를 소유하고, +Checkstyle은 **포매터가 표현할 수 없는 것만** — 네이밍과 몇 가지 논리/설계 규칙만 — 봅니다 +(`config/checkstyle/checkstyle.xml`). 줄 길이·들여쓰기·import 순서 모듈이 여기에 없는 것은 누락이 +아니라 포매터와 싸우지 않기 위한 선택입니다. Error Prone은 컴파일 시점 버그 패턴을 담당합니다. + | 게이트 | 하는 일 | | --- | --- | | `architectureCheck` | Clean Architecture 의존 방향, runtime membership, application-core purity, Git에 실리지 않는 source package를 검사 | @@ -142,9 +147,13 @@ Checkstyle은 파싱된 파일에 같은 질문을 하고, leaf 단위로 돕니 - **하는 일.** deny-by-default public path 표면이 승인 없이 바뀌면 빌드를 실패시킵니다. - **배경.** 이 앱은 deny-by-default 입니다. 즉 `SECURITY_PUBLIC_PATHS` 가 먹이는 명시적 `permitAll()` - 경로를 **제외한** 모든 요청은 인증을 요구합니다(`src/.env` → `SecuritySettings.publicPaths()` → - `SecurityConfig`). 이 public 표면이 바뀌는 순간이 곧 보호되던 엔드포인트가 조용히 공개로 노출되는 - 지점입니다. 그래서 그 표면을 snapshot 으로 떠 두고, 미승인 변경에 빌드를 실패시킵니다. + 경로를 **제외한** 모든 요청은 인증을 요구합니다 + (`app-bootstrap/src/main/resources/config/security.yml` → `SecuritySettings.publicPaths()` → + `SecurityConfig`). 설정 분할 이전에는 이 SSOT 가 `src/.env` 였고 문서만 그대로 남아 있었습니다. + 스냅샷 플러그인이 실제로 읽는 파일은 `config/security.yml` 입니다 + (`build-logic/.../publicpath/PublicPathSnapshotPlugin.java`). + 이 public 표면이 바뀌는 순간이 곧 보호되던 엔드포인트가 조용히 공개로 노출되는 지점입니다. + 그래서 그 표면을 snapshot 으로 떠 두고, 미승인 변경에 빌드를 실패시킵니다. - **승인 방법.** `verifyPublicPathSnapshot` 은 항상 읽기 전용입니다. reviewer 가 변경을 승인한 뒤 `./gradlew updatePublicPathSnapshot -PapprovePublicPathChange` 로 snapshot 을 명시적으로 다시 생성합니다. 공개 경로 변경은 보안 리뷰 대상으로 보고 재생성된 snapshot 을 함께 커밋합니다. diff --git a/src/adapter/inbound/graphql/build.gradle b/src/adapter/inbound/graphql/build.gradle index 5cb93971..4e28bb5d 100644 --- a/src/adapter/inbound/graphql/build.gradle +++ b/src/adapter/inbound/graphql/build.gradle @@ -4,6 +4,8 @@ plugins { id 'java-test-fixtures' id 'ca.auxiliary-source-set' id 'ca.graphql-platform' + id 'ca.api-surface' + id 'ca.strict-qualification' } // Driving adapter: GraphQL API (skeleton machinery, transport-only). diff --git a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/execution/BoundedPreparsedDocumentProvider.java b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/execution/BoundedPreparsedDocumentProvider.java index b2bc4995..2cf084dd 100644 --- a/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/execution/BoundedPreparsedDocumentProvider.java +++ b/src/adapter/inbound/graphql/src/main/java/dev/caskeleton/adapter/inbound/graphql/execution/BoundedPreparsedDocumentProvider.java @@ -86,8 +86,20 @@ public final class BoundedPreparsedDocumentProvider { return await(leader); } - metrics.recordMiss(); try { + // Claiming the key is not the same instant as missing it. Between this thread's lookup and + // its claim, the previous leader can finish parsing, store the document and release its + // in-flight slot — and then this thread's putIfAbsent succeeds and it parses a document that + // is already cached. The single-flight guarantee this class documents is only true if the + // leader re-reads the cache after it has the claim. + D parsedWhileClaiming = lookup(key, clock.instant()); + if (parsedWhileClaiming != null) { + metrics.recordHit(); + mine.complete(parsedWhileClaiming); + return parsedWhileClaiming; + } + + metrics.recordMiss(); D document = parseAndValidate.apply(key); store(key, document, documentWeight, clock.instant()); mine.complete(document); diff --git a/src/adapter/inbound/grpc/build.gradle b/src/adapter/inbound/grpc/build.gradle index 1eacd965..956a7c4f 100644 --- a/src/adapter/inbound/grpc/build.gradle +++ b/src/adapter/inbound/grpc/build.gradle @@ -1,6 +1,7 @@ plugins { id 'ca.spring-library' id 'ca.spring-config' + id 'ca.strict-qualification' } String grpcVersion = libs.versions.grpc.get() diff --git a/src/adapter/inbound/web-fileserver/build.gradle b/src/adapter/inbound/web-fileserver/build.gradle new file mode 100644 index 00000000..9c16517a --- /dev/null +++ b/src/adapter/inbound/web-fileserver/build.gradle @@ -0,0 +1,42 @@ +plugins { + id 'ca.spring-library' + id 'ca.spring-config' +} + +// The Fileserver capability's HTTP surface. +// +// It was the `web.fileserver` package inside `adapter:inbound:web`, and that is the last reason +// every application resolved `application-fileserver`: the capability's controllers, DTOs, mappers, +// range and nginx helpers, tus and draft-12 upload surfaces and its HTTP authorization all compiled +// into the leaf that any application with an HTTP API depends on. +// +// The package keeps its name. It is still part of the web platform's module map — `WebStableModule` +// declares its twelve modules and their edges, and `WebBuildModel.platformSourceRoots()` scans this +// source root alongside the web leaf's, which is what that method's plural has always been for. A +// second copy of the map here would be a second answer to "is this edge declared", and the map is +// the one thing the platform must not have two of. +// +// It depends on `adapter:inbound:web` rather than the reverse: the fileserver modules import `core`, +// `auth` and `observability`, nine times in total, and nothing outside them imports fileserver. +dependencies { + implementation project(':adapter:inbound:web') + implementation project(':application-core') + implementation project(':application-fileserver') + implementation project(':shared-contract') + + implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-security' + implementation 'org.springframework.boot:spring-boot-starter-validation' + // `spring-webflux`, not `spring-boot-starter-webflux`, for the reason the web leaf states in + // its own build file: the starter puts reactor-netty — a second embedded server — on the + // runtime classpath of an application that already has Tomcat. The reactive fileserver surface + // needs the types, not another server. + implementation 'org.springframework:spring-webflux' + implementation 'io.projectreactor:reactor-core' + + testImplementation project(':adapter:inbound:web') + testImplementation testFixtures(project(':adapter:inbound:web')) + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'org.springframework.security:spring-security-test' + testImplementation 'io.projectreactor:reactor-test' +} diff --git a/src/adapter/inbound/web-fileserver/gradle.lockfile b/src/adapter/inbound/web-fileserver/gradle.lockfile new file mode 100644 index 00000000..eea7f85d --- /dev/null +++ b/src/adapter/inbound/web-fileserver/gradle.lockfile @@ -0,0 +1,192 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +biz.aQute.bnd:biz.aQute.bnd.annotation:7.1.0=compileClasspath,testCompileClasspath +ch.qos.logback:logback-classic:1.5.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +ch.qos.logback:logback-core:1.5.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.21=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.21.5=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.21.5=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.21.5=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.21.5=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson:jackson-bom:2.21.5=runtimeClasspath,testRuntimeClasspath +com.fasterxml:classmate:1.7.3=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.github.ben-manes.caffeine:caffeine:3.2.4=annotationProcessor,testAnnotationProcessor +com.github.kevinstern:software-and-algorithms:1.0=annotationProcessor,testAnnotationProcessor +com.github.spotbugs:spotbugs-annotations:4.10.2=spotbugs +com.github.spotbugs:spotbugs:4.10.2=spotbugs +com.github.stephenc.jcip:jcip-annotations:1.0-1=spotbugs +com.google.auto.service:auto-service-annotations:1.0.1=annotationProcessor,testAnnotationProcessor +com.google.auto.value:auto-value-annotations:1.9=annotationProcessor,testAnnotationProcessor +com.google.auto:auto-common:1.2.2=annotationProcessor,testAnnotationProcessor +com.google.code.findbugs:jsr305:3.0.2=checkstyle,spotbugs +com.google.code.gson:gson:2.13.2=spotbugs +com.google.errorprone:error_prone_annotation:2.49.0=annotationProcessor,testAnnotationProcessor +com.google.errorprone:error_prone_annotations:2.38.0=compileClasspath,testCompileClasspath +com.google.errorprone:error_prone_annotations:2.41.0=spotbugs +com.google.errorprone:error_prone_annotations:2.47.0=checkstyle +com.google.errorprone:error_prone_annotations:2.49.0=annotationProcessor,testAnnotationProcessor +com.google.errorprone:error_prone_check_api:2.49.0=annotationProcessor,testAnnotationProcessor +com.google.errorprone:error_prone_core:2.49.0=annotationProcessor,testAnnotationProcessor +com.google.googlejavaformat:google-java-format:1.35.0=annotationProcessor,testAnnotationProcessor +com.google.guava:failureaccess:1.0.3=annotationProcessor,checkstyle,testAnnotationProcessor +com.google.guava:guava:33.5.0-jre=annotationProcessor,testAnnotationProcessor +com.google.guava:guava:33.6.0-jre=checkstyle +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,checkstyle,testAnnotationProcessor +com.google.j2objc:j2objc-annotations:3.1=annotationProcessor,checkstyle,testAnnotationProcessor +com.google.protobuf:protobuf-java:4.33.2=annotationProcessor,testAnnotationProcessor +com.h3xstream.findsecbugs:findsecbugs-plugin:1.14.0=spotbugsPlugins +com.jayway.jsonpath:json-path:2.10.0=testCompileClasspath,testRuntimeClasspath +com.nimbusds:nimbus-jose-jwt:10.4=runtimeClasspath,testRuntimeClasspath +com.puppycrawl.tools:checkstyle:13.5.0=checkstyle +com.tngtech.archunit:archunit-junit5-api:1.3.0=testRuntimeClasspath +com.tngtech.archunit:archunit-junit5-engine-api:1.3.0=testRuntimeClasspath +com.tngtech.archunit:archunit-junit5-engine:1.3.0=testRuntimeClasspath +com.tngtech.archunit:archunit-junit5:1.3.0=testRuntimeClasspath +com.tngtech.archunit:archunit:1.3.0=testRuntimeClasspath +com.vaadin.external.google:android-json:0.0.20131108.vaadin1=testCompileClasspath,testRuntimeClasspath +commons-beanutils:commons-beanutils:1.11.0=checkstyle +commons-collections:commons-collections:3.2.2=checkstyle +commons-io:commons-io:2.21.0=spotbugs +commons-logging:commons-logging:1.3.6=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +info.picocli:picocli:4.7.7=checkstyle +io.github.eisop:dataflow-errorprone:3.41.0-eisop1=annotationProcessor,testAnnotationProcessor +io.github.java-diff-utils:java-diff-utils:4.12=annotationProcessor,testAnnotationProcessor +io.micrometer:micrometer-commons:1.16.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.micrometer:micrometer-observation:1.16.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.projectreactor:reactor-core:3.8.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.projectreactor:reactor-test:3.8.7=testCompileClasspath,testRuntimeClasspath +io.swagger.core.v3:swagger-annotations-jakarta:2.2.38=runtimeClasspath,testRuntimeClasspath +io.swagger.core.v3:swagger-core-jakarta:2.2.38=runtimeClasspath,testRuntimeClasspath +io.swagger.core.v3:swagger-models-jakarta:2.2.38=runtimeClasspath,testRuntimeClasspath +jakarta.activation:jakarta.activation-api:2.1.4=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.annotation:jakarta.annotation-api:3.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.servlet:jakarta.servlet-api:6.1.0=testRuntimeClasspath +jakarta.validation:jakarta.validation-api:3.1.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.xml.bind:jakarta.xml.bind-api:4.0.5=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.inject:javax.inject:1=annotationProcessor,testAnnotationProcessor +jaxen:jaxen:2.0.6=spotbugs +net.bytebuddy:byte-buddy-agent:1.17.8=testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy:1.17.8=testCompileClasspath,testRuntimeClasspath +net.minidev:accessors-smart:2.6.0=testCompileClasspath,testRuntimeClasspath +net.minidev:json-smart:2.6.0=testCompileClasspath,testRuntimeClasspath +net.sf.saxon:Saxon-HE:12.9=checkstyle,spotbugs +org.antlr:antlr4-runtime:4.13.2=checkstyle +org.apache.bcel:bcel:6.12.0=spotbugs +org.apache.commons:commons-lang3:3.20.0=checkstyle,runtimeClasspath,spotbugs,testRuntimeClasspath +org.apache.commons:commons-text:1.15.0=spotbugs +org.apache.commons:commons-text:1.3=checkstyle +org.apache.httpcomponents:httpclient:4.5.13=checkstyle +org.apache.httpcomponents:httpcore:4.4.16=checkstyle +org.apache.logging.log4j:log4j-api:2.25.5=compileClasspath,runtimeClasspath,spotbugs,testCompileClasspath,testRuntimeClasspath +org.apache.logging.log4j:log4j-core:2.25.5=spotbugs +org.apache.logging.log4j:log4j-to-slf4j:2.25.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.maven.doxia:doxia-core:1.12.0=checkstyle +org.apache.maven.doxia:doxia-logging-api:1.12.0=checkstyle +org.apache.maven.doxia:doxia-module-xdoc:1.12.0=checkstyle +org.apache.maven.doxia:doxia-sink-api:1.12.0=checkstyle +org.apache.tomcat.embed:tomcat-embed-core:11.0.24=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.tomcat.embed:tomcat-embed-el:11.0.24=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.tomcat.embed:tomcat-embed-websocket:11.0.24=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.xbean:xbean-reflect:3.7=checkstyle +org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath +org.assertj:assertj-core:3.27.7=testCompileClasspath,testRuntimeClasspath +org.awaitility:awaitility:4.3.0=testCompileClasspath,testRuntimeClasspath +org.codehaus.plexus:plexus-classworlds:2.6.0=checkstyle +org.codehaus.plexus:plexus-component-annotations:2.1.0=checkstyle +org.codehaus.plexus:plexus-container-default:2.1.0=checkstyle +org.codehaus.plexus:plexus-utils:3.3.0=checkstyle +org.dom4j:dom4j:2.2.0=spotbugs +org.hamcrest:hamcrest:3.0=testCompileClasspath,testRuntimeClasspath +org.hibernate.validator:hibernate-validator:9.0.1.Final=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.javassist:javassist:3.28.0-GA=checkstyle +org.jboss.logging:jboss-logging:3.6.3.Final=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.jspecify:jspecify:1.0.1=annotationProcessor,checkstyle,compileClasspath,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-api:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-engine:6.0.3=testRuntimeClasspath +org.junit.jupiter:junit-jupiter-params:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-commons:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-engine:6.0.3=testRuntimeClasspath +org.junit.platform:junit-platform-launcher:6.0.3=testRuntimeClasspath +org.junit:junit-bom:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit:junit-bom:6.1.0=spotbugs +org.mockito:mockito-core:5.20.0=mockitoAgent,testCompileClasspath,testRuntimeClasspath +org.mockito:mockito-junit-jupiter:5.20.0=testCompileClasspath,testRuntimeClasspath +org.objenesis:objenesis:3.3=testRuntimeClasspath +org.openapitools:jackson-databind-nullable:0.2.6=runtimeClasspath,testRuntimeClasspath +org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testRuntimeClasspath +org.osgi:org.osgi.annotation.bundle:2.0.0=compileClasspath,testCompileClasspath +org.osgi:org.osgi.annotation.versioning:1.1.2=compileClasspath,testCompileClasspath +org.osgi:org.osgi.resource:1.0.0=compileClasspath,testCompileClasspath +org.osgi:org.osgi.service.serviceloader:1.0.0=compileClasspath,testCompileClasspath +org.ow2.asm:asm-analysis:9.10.1=spotbugs +org.ow2.asm:asm-commons:9.10.1=spotbugs +org.ow2.asm:asm-tree:9.10.1=spotbugs +org.ow2.asm:asm-util:9.10.1=spotbugs +org.ow2.asm:asm:9.10.1=spotbugs +org.ow2.asm:asm:9.7.1=testCompileClasspath,testRuntimeClasspath +org.pcollections:pcollections:4.0.1=annotationProcessor,testAnnotationProcessor +org.reactivestreams:reactive-streams:1.0.4=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.reflections:reflections:0.10.2=checkstyle +org.skyscreamer:jsonassert:1.5.3=testCompileClasspath,testRuntimeClasspath +org.slf4j:jul-to-slf4j:2.0.18=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:2.0.18=compileClasspath,runtimeClasspath,spotbugs,spotbugsSlf4j,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-simple:2.0.17=spotbugsSlf4j +org.slf4j:slf4j-simple:2.0.18=checkstyle +org.springdoc:springdoc-openapi-starter-common:3.0.0=runtimeClasspath,testRuntimeClasspath +org.springdoc:springdoc-openapi-starter-webmvc-api:3.0.0=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-autoconfigure:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-configuration-processor:4.0.8=annotationProcessor +org.springframework.boot:spring-boot-http-converter:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-jackson:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-resttestclient:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-security-oauth2-resource-server:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-security:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-servlet:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-jackson-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-jackson:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-logging:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-oauth2-resource-server:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-security:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-tomcat-runtime:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-tomcat:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-validation:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-web:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-webmvc-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-webmvc:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-test-autoconfigure:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-tomcat:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-validation:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-web-server:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-webmvc-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-webmvc:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.security:spring-security-config:7.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.security:spring-security-core:7.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.security:spring-security-crypto:7.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.security:spring-security-oauth2-core:7.0.7=runtimeClasspath,testRuntimeClasspath +org.springframework.security:spring-security-oauth2-jose:7.0.7=runtimeClasspath,testRuntimeClasspath +org.springframework.security:spring-security-oauth2-resource-server:7.0.7=runtimeClasspath,testRuntimeClasspath +org.springframework.security:spring-security-test:7.0.7=testCompileClasspath,testRuntimeClasspath +org.springframework.security:spring-security-web:7.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.session:spring-session-core:4.0.5=runtimeClasspath,testRuntimeClasspath +org.springframework:spring-aop:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-beans:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-context:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-core:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-expression:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-test:7.0.9=testCompileClasspath,testRuntimeClasspath +org.springframework:spring-web:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-webflux:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-webmvc:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.xmlresolver:xmlresolver:5.3.3=checkstyle,spotbugs +org.xmlunit:xmlunit-core:2.10.4=testCompileClasspath,testRuntimeClasspath +org.yaml:snakeyaml:2.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +tools.jackson.core:jackson-core:3.1.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +tools.jackson.core:jackson-databind:3.1.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +tools.jackson:jackson-bom:3.1.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +empty= diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/FileserverAdminController.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/FileserverAdminController.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/FileserverAdminController.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/FileserverAdminController.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/ForceDeleteHttpRequest.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/ForceDeleteHttpRequest.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/ForceDeleteHttpRequest.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/ForceDeleteHttpRequest.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/OrphanReconcileHttpRequest.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/OrphanReconcileHttpRequest.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/OrphanReconcileHttpRequest.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/OrphanReconcileHttpRequest.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/BlockingTransferExecutor.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/BlockingTransferExecutor.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/BlockingTransferExecutor.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/BlockingTransferExecutor.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/FileserverWebProperties.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/FileserverWebProperties.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/FileserverWebProperties.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/FileserverWebProperties.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/MvcTransferExecutorConfiguration.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/MvcTransferExecutorConfiguration.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/MvcTransferExecutorConfiguration.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/MvcTransferExecutorConfiguration.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/TransferExecutorProperties.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/TransferExecutorProperties.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/TransferExecutorProperties.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/config/TransferExecutorProperties.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileDownloadController.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileDownloadController.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileDownloadController.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileDownloadController.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileUploadController.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileUploadController.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileUploadController.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileUploadController.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12Headers.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12Headers.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12Headers.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12Headers.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12OffsetProblem.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12OffsetProblem.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12OffsetProblem.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12OffsetProblem.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12Properties.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12Properties.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12Properties.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12Properties.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12UploadController.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12UploadController.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12UploadController.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12UploadController.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/ExperimentalApi.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/ExperimentalApi.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/ExperimentalApi.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/ExperimentalApi.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadItemProblem.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadItemProblem.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadItemProblem.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadItemProblem.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadItemResult.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadItemResult.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadItemResult.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadItemResult.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadResponse.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadResponse.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadResponse.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/BatchUploadResponse.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/RelocateFileRequest.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/RelocateFileRequest.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/RelocateFileRequest.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/RelocateFileRequest.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/UploadedFileResponse.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/UploadedFileResponse.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/UploadedFileResponse.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/dto/UploadedFileResponse.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/DefaultHttpRangeResolver.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/DefaultHttpRangeResolver.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/DefaultHttpRangeResolver.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/DefaultHttpRangeResolver.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpConditionalRequest.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpConditionalRequest.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpConditionalRequest.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpConditionalRequest.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpContentDispositionFactory.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpContentDispositionFactory.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpContentDispositionFactory.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpContentDispositionFactory.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadDecision.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadDecision.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadDecision.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadDecision.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadOutcome.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadOutcome.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadOutcome.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadOutcome.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPlanner.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPlanner.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPlanner.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPlanner.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPolicy.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPolicy.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPolicy.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPolicy.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeNotSatisfiableException.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeNotSatisfiableException.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeNotSatisfiableException.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeNotSatisfiableException.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangePolicy.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangePolicy.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangePolicy.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangePolicy.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeResolver.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeResolver.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeResolver.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeResolver.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpResolvedRanges.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpResolvedRanges.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpResolvedRanges.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpResolvedRanges.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/MvcConditionalRequestFactory.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/MvcConditionalRequestFactory.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/MvcConditionalRequestFactory.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/MvcConditionalRequestFactory.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/MvcDownloadResponseWriter.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/MvcDownloadResponseWriter.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/MvcDownloadResponseWriter.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/MvcDownloadResponseWriter.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/ZeroCopyEligibility.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/ZeroCopyEligibility.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/ZeroCopyEligibility.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/http/ZeroCopyEligibility.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/lifecycle/FileLifecycleController.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/lifecycle/FileLifecycleController.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/lifecycle/FileLifecycleController.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/lifecycle/FileLifecycleController.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/MultipartUploadRequestMapper.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/MultipartUploadRequestMapper.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/MultipartUploadRequestMapper.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/MultipartUploadRequestMapper.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/RawUploadRequestMapper.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/RawUploadRequestMapper.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/RawUploadRequestMapper.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/RawUploadRequestMapper.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/UploadIntent.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/UploadIntent.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/UploadIntent.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/mapper/UploadIntent.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/DefaultNginxInternalUriMapper.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/DefaultNginxInternalUriMapper.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/DefaultNginxInternalUriMapper.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/DefaultNginxInternalUriMapper.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDelegationProperties.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDelegationProperties.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDelegationProperties.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDelegationProperties.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDownloadStrategy.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDownloadStrategy.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDownloadStrategy.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDownloadStrategy.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxInternalUriMapper.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxInternalUriMapper.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxInternalUriMapper.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxInternalUriMapper.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverExceptionHandler.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverExceptionHandler.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverExceptionHandler.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverExceptionHandler.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblem.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblem.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblem.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblem.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemFactory.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemFactory.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemFactory.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemFactory.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemHeaders.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemHeaders.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemHeaders.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemHeaders.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemTitles.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemTitles.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemTitles.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemTitles.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/DataBufferByteChannel.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/DataBufferByteChannel.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/DataBufferByteChannel.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/DataBufferByteChannel.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileDownloadHandler.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileDownloadHandler.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileDownloadHandler.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileDownloadHandler.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileUploadHandler.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileUploadHandler.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileUploadHandler.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileUploadHandler.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverIoScheduler.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverIoScheduler.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverIoScheduler.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverIoScheduler.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverReactiveConfiguration.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverReactiveConfiguration.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverReactiveConfiguration.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverReactiveConfiguration.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverRouterFactory.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverRouterFactory.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverRouterFactory.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/FileserverRouterFactory.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/PartEventUploadReader.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/PartEventUploadReader.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/PartEventUploadReader.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/PartEventUploadReader.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveDownloadResponseWriter.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveDownloadResponseWriter.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveDownloadResponseWriter.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveDownloadResponseWriter.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveFileserverAttributes.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveFileserverAttributes.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveFileserverAttributes.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveFileserverAttributes.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveUploadApplicationService.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveUploadApplicationService.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveUploadApplicationService.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveUploadApplicationService.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/security/FileserverRequestContextFactory.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/security/FileserverRequestContextFactory.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/security/FileserverRequestContextFactory.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/security/FileserverRequestContextFactory.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusChecksumVerifier.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusChecksumVerifier.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusChecksumVerifier.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusChecksumVerifier.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusController.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusController.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusController.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusController.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusHeaders.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusHeaders.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusHeaders.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusHeaders.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusProperties.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusProperties.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusProperties.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusProperties.java diff --git a/src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusRequestParser.java b/src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusRequestParser.java similarity index 100% rename from src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusRequestParser.java rename to src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusRequestParser.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/FileserverAdminControllerTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/FileserverAdminControllerTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/FileserverAdminControllerTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/admin/FileserverAdminControllerTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/config/MvcUploadExecutorSaturationTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/config/MvcUploadExecutorSaturationTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/config/MvcUploadExecutorSaturationTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/config/MvcUploadExecutorSaturationTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileDownloadControllerContractTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileDownloadControllerContractTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileDownloadControllerContractTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileDownloadControllerContractTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileUploadControllerTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileUploadControllerTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileUploadControllerTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/controller/FileUploadControllerTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12ProtocolTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12ProtocolTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12ProtocolTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/draft12/Draft12ProtocolTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpContentDispositionFactoryTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpContentDispositionFactoryTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpContentDispositionFactoryTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpContentDispositionFactoryTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPlannerTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPlannerTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPlannerTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpDownloadPlannerTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeResolverTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeResolverTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeResolverTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/HttpRangeResolverTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/ZeroCopyEligibilityTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/ZeroCopyEligibilityTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/ZeroCopyEligibilityTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/http/ZeroCopyEligibilityTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDownloadDelegationTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDownloadDelegationTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDownloadDelegationTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxDownloadDelegationTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxInternalUriMapperTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxInternalUriMapperTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxInternalUriMapperTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/nginx/NginxInternalUriMapperTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemHeaderParityTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemHeaderParityTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemHeaderParityTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/problem/FileserverProblemHeaderParityTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/DataBufferReleaseTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/DataBufferReleaseTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/DataBufferReleaseTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/DataBufferReleaseTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/PartEventUploadReaderTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/PartEventUploadReaderTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/PartEventUploadReaderTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/PartEventUploadReaderTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveFileserverContractTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveFileserverContractTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveFileserverContractTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/reactive/ReactiveFileserverContractTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/security/FileserverHardeningContractTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/security/FileserverHardeningContractTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/security/FileserverHardeningContractTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/security/FileserverHardeningContractTest.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/CountingDataBuffer.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/CountingDataBuffer.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/CountingDataBuffer.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/CountingDataBuffer.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/CountingDataBufferFactory.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/CountingDataBufferFactory.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/CountingDataBufferFactory.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/CountingDataBufferFactory.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/FileserverWebFixtures.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/FileserverWebFixtures.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/FileserverWebFixtures.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/FileserverWebFixtures.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/InMemoryUploadApplicationService.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/InMemoryUploadApplicationService.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/InMemoryUploadApplicationService.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/InMemoryUploadApplicationService.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingAdminService.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingAdminService.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingAdminService.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingAdminService.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingFinalizeService.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingFinalizeService.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingFinalizeService.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingFinalizeService.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingUploadService.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingUploadService.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingUploadService.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/RecordingUploadService.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/StubDownloadService.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/StubDownloadService.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/StubDownloadService.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/testkit/StubDownloadService.java diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusProtocolContractTest.java b/src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusProtocolContractTest.java similarity index 100% rename from src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusProtocolContractTest.java rename to src/adapter/inbound/web-fileserver/src/test/java/dev/caskeleton/adapter/inbound/web/fileserver/tus/TusProtocolContractTest.java diff --git a/src/adapter/inbound/web/build.gradle b/src/adapter/inbound/web/build.gradle index 317388a0..bfa19d16 100644 --- a/src/adapter/inbound/web/build.gradle +++ b/src/adapter/inbound/web/build.gradle @@ -16,7 +16,12 @@ plugins { dependencies { implementation project(':application-core') implementation project(':application-notification') - implementation project(':application-fileserver') + // `PresentationWebConfigTest` names the capability controllers as the examples of an absolute + // platform route the presentation prefix must not touch. Test scope only: the production graph + // has no edge to the capability, which is the whole point of the split. + testImplementation project(':adapter:inbound:web-fileserver') + // No `application-fileserver`. The capability's HTTP surface is + // `adapter:inbound:web-fileserver`, which depends on this leaf rather than living inside it. implementation project(':shared-contract') implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-security' @@ -307,3 +312,4 @@ strictTestLanes { tasks.named('check') { dependsOn tasks.named('webSecurityBoundaryTest') } + diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/moduleboundary/WebBuildModel.java b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/moduleboundary/WebBuildModel.java index 715702f5..bb02637a 100644 --- a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/moduleboundary/WebBuildModel.java +++ b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/moduleboundary/WebBuildModel.java @@ -184,9 +184,31 @@ public final class WebBuildModel { return List.copyOf(violations); } - /** Every source root the module map governs. */ + /** + * Every source root the module map governs. + * + *

Two, since the Fileserver capability's HTTP surface became `adapter:inbound:web-fileserver`. + * The module map did not move with it: `WebStableModule` still declares the twelve fileserver + * modules and their edges, because a second copy of the map in the second leaf would be a second + * answer to "is this edge declared", and one map with two source roots is what this method's + * plural has meant since it was written. + * + *

The sibling root is optional rather than required. A checkout that does not have it is a + * checkout where that leaf is absent, and the rules then govern what is present — the empty-scan + * guard in {@link #scan(List)} is what refuses a scan that found nothing at all. + */ public static List platformSourceRoots() { - return List.of(mainSourceRoot()); + Path own = mainSourceRoot(); + Path sibling = + own.getParent() + .getParent() + .getParent() + .getParent() + .resolve("web-fileserver") + .resolve("src") + .resolve("main") + .resolve("java"); + return Files.isDirectory(sibling) ? List.of(own, sibling) : List.of(own); } /** diff --git a/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebAutoConfigurationRegistrationTest.java b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebAutoConfigurationRegistrationTest.java new file mode 100644 index 00000000..82652599 --- /dev/null +++ b/src/adapter/inbound/web/src/test/java/dev/caskeleton/adapter/inbound/web/mvc/autoconfigure/WebAutoConfigurationRegistrationTest.java @@ -0,0 +1,103 @@ +package dev.caskeleton.adapter.inbound.web.mvc.autoconfigure; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.core.annotation.AnnotatedElementUtils; + +/** + * This leaf's auto-configurations are registered, not merely annotated. + * + *

Spring Boot needs two independent things before an auto-configuration runs: the annotation on + * the class, and a line naming it in {@code META-INF/spring/...AutoConfiguration.imports}. Tests + * that build a context with {@code AutoConfigurations.of(...)} supply the second one themselves, so + * they stay green for a capability that is present in no running application — which is exactly how + * several capabilities in this repository came to be assembled by nothing. + * + *

So this reads the registration file the jar actually ships and asserts both directions: every + * class this leaf means to register is named in it, and every name in it resolves to a class that + * carries {@code @AutoConfiguration}. A rename, a move or a deleted line fails here rather than in + * a deployment that starts and quietly does less than it says. + */ +class WebAutoConfigurationRegistrationTest { + + private static final String IMPORTS_RESOURCE = + "META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports"; + + /** The auto-configurations this leaf publishes. */ + private static final List PUBLISHED_ROOTS = + List.of( + "dev.caskeleton.adapter.inbound.web.mvc.autoconfigure.WebMvcPlatformAutoConfiguration", + "dev.caskeleton.adapter.inbound.web.webflux.autoconfigure.WebFluxPlatformAutoConfiguration"); + + @Test + @DisplayName("the shipped registration file names every root this leaf publishes") + void theShippedRegistrationFileNamesEveryRoot() { + assertThat(registeredNames()) + .as("the registration lines this leaf's own jar ships") + .containsAll(PUBLISHED_ROOTS); + } + + @Test + @DisplayName("every registered name resolves to a real Boot auto-configuration") + void everyRegisteredNameResolvesToAnAutoConfiguration() { + for (String name : registeredNames()) { + Class registered; + try { + registered = + Class.forName(name, false, WebAutoConfigurationRegistrationTest.class.getClassLoader()); + } catch (ClassNotFoundException missing) { + throw new AssertionError( + IMPORTS_RESOURCE + " registers " + name + ", which does not exist", missing); + } + assertThat(AnnotatedElementUtils.hasAnnotation(registered, AutoConfiguration.class)) + .as("%s is registered but is not annotated @AutoConfiguration", name) + .isTrue(); + } + } + + /** + * The registration lines this leaf's own resource declares. + * + *

Read from this leaf's source tree rather than from the classpath. {@code + * ClassLoader#getResources} returns every registration file on the test runtime classpath — + * Spring Boot's, springdoc's, and every dependency leaf's — so asserting over that set tests + * other people's modules and fails on their conditional classes. The file below is the one this + * leaf packages, which is the thing this contract is about. + */ + private static List registeredNames() { + Path resource = leafRoot().resolve("src/main/resources/" + IMPORTS_RESOURCE); + assertThat(Files.isRegularFile(resource)).as("%s", resource).isTrue(); + List names; + try { + names = + Files.readAllLines(resource, StandardCharsets.UTF_8).stream() + .map(String::strip) + .filter(line -> !line.isEmpty() && !line.startsWith("#")) + .toList(); + } catch (IOException failure) { + throw new UncheckedIOException("cannot read " + resource, failure); + } + assertThat(names).as("%s registers nothing", resource).isNotEmpty(); + return names; + } + + /** The nearest directory above the test's working directory that ships a registration file. */ + private static Path leafRoot() { + for (Path path = Path.of("").toAbsolutePath(); path != null; path = path.getParent()) { + if (Files.isRegularFile(path.resolve("src/main/resources/" + IMPORTS_RESOURCE))) { + return path; + } + } + throw new IllegalStateException( + "no leaf shipping " + IMPORTS_RESOURCE + " found above " + Path.of("").toAbsolutePath()); + } +} diff --git a/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/HttpFixtureTimeouts.java b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/HttpFixtureTimeouts.java new file mode 100644 index 00000000..3a73b6a1 --- /dev/null +++ b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/HttpFixtureTimeouts.java @@ -0,0 +1,32 @@ +package dev.caskeleton.adapter.inbound.web.testkit; + +/** + * Socket budgets for the fixtures that drive a real server over a real socket. + * + *

One place, because the number is not a per-fixture judgement. None of these suites asserts + * latency — they assert the status, headers, problem code and body that came back — so the only + * requirement on a timeout is that it exceed the worst scheduling delay a healthy server can suffer + * on a loaded machine. Below that threshold the timeout stops being a safety net and becomes a + * second, invisible assertion about how busy the build host is. + * + *

That is not hypothetical here. With {@code org.gradle.parallel=true} these lanes run while + * SpotBugs analyses a dozen leaves, and at five-second connects and ten-second reads {@code + * ReactiveContractRecordingIT} and {@code ReactiveWebThrottleIT} failed a full {@code ci} run with + * {@code SocketTimeoutException} and passed when run alone. A lane that starts real servers and + * fails under load is the kind of gate people learn to re-run, and a gate people re-run is not a + * gate. + * + *

A suite whose subject *is* a timeout — the fault lanes' client read budget, the performance + * lanes' load measurements — does not use these. There the number is the contract, and it belongs + * next to the contract. + */ +public final class HttpFixtureTimeouts { + + /** How long to wait for the connection itself. */ + public static final int CONNECT_MILLIS = 15_000; + + /** How long to wait for a response whose latency nothing asserts. */ + public static final int READ_MILLIS = 30_000; + + private HttpFixtureTimeouts() {} +} diff --git a/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/budget/HttpBudgetFixture.java b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/budget/HttpBudgetFixture.java index 76d53062..1db4fe0f 100644 --- a/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/budget/HttpBudgetFixture.java +++ b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/budget/HttpBudgetFixture.java @@ -1,5 +1,6 @@ package dev.caskeleton.adapter.inbound.web.testkit.budget; +import dev.caskeleton.adapter.inbound.web.testkit.HttpFixtureTimeouts; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -124,8 +125,8 @@ public final class HttpBudgetFixture { HttpURLConnection connection = (HttpURLConnection) URI.create(baseUrl + path).toURL().openConnection(); connection.setRequestMethod(method); - connection.setConnectTimeout(5_000); - connection.setReadTimeout(10_000); + connection.setConnectTimeout(HttpFixtureTimeouts.CONNECT_MILLIS); + connection.setReadTimeout(HttpFixtureTimeouts.READ_MILLIS); return connection; } diff --git a/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/contract/WebContractFixture.java b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/contract/WebContractFixture.java index 37c53893..32f06835 100644 --- a/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/contract/WebContractFixture.java +++ b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/contract/WebContractFixture.java @@ -1,5 +1,6 @@ package dev.caskeleton.adapter.inbound.web.testkit.contract; +import dev.caskeleton.adapter.inbound.web.testkit.HttpFixtureTimeouts; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -86,8 +87,8 @@ public final class WebContractFixture { HttpURLConnection connection = (HttpURLConnection) URI.create(baseUrl + probe.path()).toURL().openConnection(); connection.setRequestMethod(probe.method()); - connection.setConnectTimeout(5_000); - connection.setReadTimeout(15_000); + connection.setConnectTimeout(HttpFixtureTimeouts.CONNECT_MILLIS); + connection.setReadTimeout(HttpFixtureTimeouts.READ_MILLIS); probe.headers().forEach(connection::setRequestProperty); if (probe.body() != null) { connection.setDoOutput(true); diff --git a/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/fault/HttpResponseLossFixture.java b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/fault/HttpResponseLossFixture.java index b7601011..fe9fecbe 100644 --- a/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/fault/HttpResponseLossFixture.java +++ b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/fault/HttpResponseLossFixture.java @@ -1,5 +1,6 @@ package dev.caskeleton.adapter.inbound.web.testkit.fault; +import dev.caskeleton.adapter.inbound.web.testkit.HttpFixtureTimeouts; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; @@ -51,7 +52,7 @@ public final class HttpResponseLossFixture implements ResponseLossFixture { HttpURLConnection connection = (HttpURLConnection) URI.create(baseUrl + path).toURL().openConnection(); connection.setRequestMethod(method); - connection.setConnectTimeout(5_000); + connection.setConnectTimeout(HttpFixtureTimeouts.CONNECT_MILLIS); connection.setReadTimeout((int) FaultFixtureProtocol.CLIENT_READ_TIMEOUT.toMillis()); return connection; } @@ -86,7 +87,7 @@ public final class HttpResponseLossFixture implements ResponseLossFixture { public int sideEffectCount() { try { HttpURLConnection connection = open(FaultFixtureProtocol.SIDE_EFFECTS_PATH, "GET"); - connection.setReadTimeout(5_000); + connection.setReadTimeout(HttpFixtureTimeouts.READ_MILLIS); try (InputStream body = connection.getInputStream()) { return Integer.parseInt(new String(body.readAllBytes(), StandardCharsets.UTF_8).trim()); } finally { @@ -100,7 +101,7 @@ public final class HttpResponseLossFixture implements ResponseLossFixture { private Replay post(WebFaultPoint armed) throws IOException { HttpURLConnection connection = open(FaultFixtureProtocol.CREATE_PATH, "POST"); if (armed == null) { - connection.setReadTimeout(10_000); + connection.setReadTimeout(HttpFixtureTimeouts.READ_MILLIS); } connection.setDoOutput(true); connection.setRequestProperty("Content-Type", "application/json"); diff --git a/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/operation/HttpOperationFixture.java b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/operation/HttpOperationFixture.java index 519c6eb0..9445a2e8 100644 --- a/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/operation/HttpOperationFixture.java +++ b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/operation/HttpOperationFixture.java @@ -1,5 +1,6 @@ package dev.caskeleton.adapter.inbound.web.testkit.operation; +import dev.caskeleton.adapter.inbound.web.testkit.HttpFixtureTimeouts; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; @@ -85,8 +86,8 @@ public final class HttpOperationFixture { HttpURLConnection connection = (HttpURLConnection) URI.create(baseUrl + path).toURL().openConnection(); connection.setRequestMethod(method); - connection.setConnectTimeout(5_000); - connection.setReadTimeout(10_000); + connection.setConnectTimeout(HttpFixtureTimeouts.CONNECT_MILLIS); + connection.setReadTimeout(HttpFixtureTimeouts.READ_MILLIS); if ("POST".equals(method)) { connection.setDoOutput(true); connection.getOutputStream().close(); diff --git a/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/order/HttpPipelineFixture.java b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/order/HttpPipelineFixture.java index 20507f10..4677e005 100644 --- a/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/order/HttpPipelineFixture.java +++ b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/order/HttpPipelineFixture.java @@ -1,5 +1,6 @@ package dev.caskeleton.adapter.inbound.web.testkit.order; +import dev.caskeleton.adapter.inbound.web.testkit.HttpFixtureTimeouts; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; @@ -57,8 +58,8 @@ public final class HttpPipelineFixture { HttpURLConnection connection = (HttpURLConnection) URI.create(baseUrl + path).toURL().openConnection(); connection.setRequestMethod(method); - connection.setConnectTimeout(5_000); - connection.setReadTimeout(10_000); + connection.setConnectTimeout(HttpFixtureTimeouts.CONNECT_MILLIS); + connection.setReadTimeout(HttpFixtureTimeouts.READ_MILLIS); if (body != null) { connection.setDoOutput(true); connection.setRequestProperty("Content-Type", "application/json"); diff --git a/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/throttle/HttpThrottleFixture.java b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/throttle/HttpThrottleFixture.java index 1dab476d..10dc8b7b 100644 --- a/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/throttle/HttpThrottleFixture.java +++ b/src/adapter/inbound/web/src/testFixtures/java/dev/caskeleton/adapter/inbound/web/testkit/throttle/HttpThrottleFixture.java @@ -1,5 +1,6 @@ package dev.caskeleton.adapter.inbound.web.testkit.throttle; +import dev.caskeleton.adapter.inbound.web.testkit.HttpFixtureTimeouts; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; @@ -41,6 +42,24 @@ public final class HttpThrottleFixture implements AutoCloseable { } } + /** + * How long {@link #awaitSlotTaken} waits for the holder to occupy the single write slot. + * + *

A liveness guard, not an assertion: if the slot is never taken the scenario cannot run, and + * failing is better than hanging. Ten seconds was short enough that a loaded machine could trip + * it before the holder was scheduled. + */ + private static final long SLOT_TAKEN_DEADLINE_SECONDS = 40; + + /** + * How long the holding request is allowed to hold the slot. + * + *

Must stay comfortably above {@link #SLOT_TAKEN_DEADLINE_SECONDS}: if the holder gave up + * first, the slot would be free again while the scenario was still waiting to observe it taken, + * and the failure would name capacity rather than the fixture. + */ + private static final int HOLDER_TIMEOUT_MILLIS = 120_000; + private final String baseUrl; private final ExecutorService holders = Executors.newCachedThreadPool(); @@ -55,17 +74,20 @@ public final class HttpThrottleFixture implements AutoCloseable { /** Refills the quota and releases any held slot. */ public void reset() { - send("POST", ThrottleFixtureProtocol.RESET_PATH, 5_000); + send("POST", ThrottleFixtureProtocol.RESET_PATH, HttpFixtureTimeouts.READ_MILLIS); } /** Refills the quota, then makes the limiter's store unreachable. */ public void breakLimiterStore() { - send("POST", ThrottleFixtureProtocol.RESET_PATH + "?breakStore=true", 5_000); + send( + "POST", + ThrottleFixtureProtocol.RESET_PATH + "?breakStore=true", + HttpFixtureTimeouts.READ_MILLIS); } /** One call against the quota route. */ public Response callQuotaRoute() { - return send("GET", ThrottleFixtureProtocol.QUOTA_PATH, 5_000); + return send("GET", ThrottleFixtureProtocol.QUOTA_PATH, HttpFixtureTimeouts.READ_MILLIS); } /** Spends the whole quota, then calls once more. */ @@ -78,7 +100,7 @@ public final class HttpThrottleFixture implements AutoCloseable { /** One call against the write route. */ public Response callWriteRoute() { - return send("POST", ThrottleFixtureProtocol.WRITE_PATH, 10_000); + return send("POST", ThrottleFixtureProtocol.WRITE_PATH, HttpFixtureTimeouts.READ_MILLIS); } /** @@ -88,21 +110,29 @@ public final class HttpThrottleFixture implements AutoCloseable { * refusal is caused by the slot being taken rather than by whichever request happened to win. */ public Response saturateAndCallWrite() { - send("POST", ThrottleFixtureProtocol.RESET_PATH + "?arm=true", 5_000); + send("POST", ThrottleFixtureProtocol.RESET_PATH + "?arm=true", HttpFixtureTimeouts.READ_MILLIS); CompletableFuture holder = CompletableFuture.supplyAsync( - () -> send("POST", ThrottleFixtureProtocol.WRITE_PATH + "?hold=true", 40_000), holders); + () -> + send( + "POST", + ThrottleFixtureProtocol.WRITE_PATH + "?hold=true", + HOLDER_TIMEOUT_MILLIS), + holders); try { awaitSlotTaken(holder); // Refill the quota without letting go of the slot. Confirming the slot was taken cost // several quota-charged probes, and the filter charges quota before it asks for capacity — // so without this the next call is refused 429 and the 503 case never runs. - send("POST", ThrottleFixtureProtocol.RESET_PATH + "?releaseHold=false", 5_000); + send( + "POST", + ThrottleFixtureProtocol.RESET_PATH + "?releaseHold=false", + HttpFixtureTimeouts.READ_MILLIS); return callWriteRoute(); } finally { reset(); try { - holder.get(30, TimeUnit.SECONDS); + holder.get(SLOT_TAKEN_DEADLINE_SECONDS + 30, TimeUnit.SECONDS); } catch (InterruptedException interrupted) { Thread.currentThread().interrupt(); } catch (ExecutionException | TimeoutException ignored) { @@ -114,7 +144,7 @@ public final class HttpThrottleFixture implements AutoCloseable { private void awaitSlotTaken(CompletableFuture holder) { // Polled rather than slept: a fixed sleep is either too short on a loaded machine or wasted // time on an idle one, and the first is a flaky failure nobody can reproduce. - long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(10); + long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(SLOT_TAKEN_DEADLINE_SECONDS); while (System.nanoTime() < deadline) { if (holder.isDone()) { throw new IllegalStateException("the holding request returned before the slot was taken"); @@ -124,8 +154,12 @@ public final class HttpThrottleFixture implements AutoCloseable { // holder takes a while to occupy the slot, the quota runs out first and every remaining // probe answers 429. The loop then never sees its 503 and fails on the deadline, which // reads as a capacity bug and is a fixture bug. - send("POST", ThrottleFixtureProtocol.RESET_PATH + "?releaseHold=false", 5_000); - Response probe = send("POST", ThrottleFixtureProtocol.WRITE_PATH, 5_000); + send( + "POST", + ThrottleFixtureProtocol.RESET_PATH + "?releaseHold=false", + HttpFixtureTimeouts.READ_MILLIS); + Response probe = + send("POST", ThrottleFixtureProtocol.WRITE_PATH, HttpFixtureTimeouts.READ_MILLIS); if (probe.status() == 503) { return; } @@ -148,7 +182,7 @@ public final class HttpThrottleFixture implements AutoCloseable { HttpURLConnection connection = (HttpURLConnection) URI.create(baseUrl + path).toURL().openConnection(); connection.setRequestMethod(method); - connection.setConnectTimeout(5_000); + connection.setConnectTimeout(HttpFixtureTimeouts.CONNECT_MILLIS); connection.setReadTimeout(readTimeoutMillis); if ("POST".equals(method)) { connection.setDoOutput(true); diff --git a/src/adapter/inbound/websocket/build.gradle b/src/adapter/inbound/websocket/build.gradle index 7144cc07..9694a84d 100644 --- a/src/adapter/inbound/websocket/build.gradle +++ b/src/adapter/inbound/websocket/build.gradle @@ -3,6 +3,7 @@ plugins { id 'ca.spring-config' id 'java-test-fixtures' id 'ca.auxiliary-source-set' + id 'ca.strict-qualification' } // Shared test code as a Gradle test-fixtures variant — ADR-BUILD-001. diff --git a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/cache/CacheEnvelope.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/cache/CacheEnvelope.java index d42fa171..292c44d3 100644 --- a/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/cache/CacheEnvelope.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/cache/CacheEnvelope.java @@ -143,14 +143,12 @@ final class CacheEnvelope { if (stored == null || stored.length == 0) { throw new CacheEnvelopeException(CacheEnvelopeException.Category.CORRUPT, "empty entry"); } - if (stored.length <= DIGEST_PREFIX_LENGTH - || stored[SHA256_HEX_LENGTH] != (byte) SEPARATOR) { + if (stored.length <= DIGEST_PREFIX_LENGTH || stored[SHA256_HEX_LENGTH] != (byte) SEPARATOR) { throw new CacheEnvelopeException( CacheEnvelopeException.Category.UNKNOWN, "the entry does not carry a digest prefix"); } - String expectedDigest = - new String(stored, 0, SHA256_HEX_LENGTH, StandardCharsets.US_ASCII); + String expectedDigest = new String(stored, 0, SHA256_HEX_LENGTH, StandardCharsets.US_ASCII); if (!expectedDigest.matches("[0-9a-f]{64}")) { throw new CacheEnvelopeException( CacheEnvelopeException.Category.UNKNOWN, "the entry does not carry a SHA-256 digest"); @@ -159,8 +157,7 @@ final class CacheEnvelope { byte[] body = new byte[stored.length - DIGEST_PREFIX_LENGTH]; System.arraycopy(stored, DIGEST_PREFIX_LENGTH, body, 0, body.length); byte[] actualDigest = HEX.formatHex(sha256(body)).getBytes(StandardCharsets.US_ASCII); - if (!MessageDigest.isEqual( - expectedDigest.getBytes(StandardCharsets.US_ASCII), actualDigest)) { + if (!MessageDigest.isEqual(expectedDigest.getBytes(StandardCharsets.US_ASCII), actualDigest)) { throw new CacheEnvelopeException( CacheEnvelopeException.Category.CORRUPT, "the envelope integrity digest does not match"); } diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisCacheConfig.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCacheConfig.java similarity index 97% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisCacheConfig.java rename to src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCacheConfig.java index 91c9108b..8bd179fe 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisCacheConfig.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCacheConfig.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.redis; +package dev.caskeleton.adapter.outbound.cache.redis.capability; import dev.caskeleton.adapter.outbound.cache.redis.cache.RedisCacheRegionAdapter; import dev.caskeleton.adapter.outbound.cache.redis.sdk.config.RedisSdkSettings; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisCapabilityConfig.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityConfig.java similarity index 98% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisCapabilityConfig.java rename to src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityConfig.java index 84d54fde..ee53a2f9 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisCapabilityConfig.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityConfig.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.redis; +package dev.caskeleton.adapter.outbound.cache.redis.capability; import dev.caskeleton.adapter.outbound.cache.redis.sdk.config.RedisSdkAutoConfiguration; import dev.caskeleton.adapter.outbound.cache.redis.sdk.config.RedisSdkSettings; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisCapabilitySettings.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilitySettings.java similarity index 96% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisCapabilitySettings.java rename to src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilitySettings.java index 457f3103..c0899a50 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisCapabilitySettings.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilitySettings.java @@ -1,6 +1,6 @@ -package dev.caskeleton.bootstrap.autoconfigure.redis; +package dev.caskeleton.adapter.outbound.cache.redis.capability; -import dev.caskeleton.bootstrap.runtime.startup.StartupFailures; +import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; import java.time.Duration; import java.util.LinkedHashMap; import java.util.Map; @@ -70,7 +70,7 @@ public class RedisCapabilitySettings { void validate() { if (positiveSoftTtl.compareTo(positiveHardTtl) > 0) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "the cache soft TTL must not exceed the hard TTL: an entry cannot stop being fresh" + " after it has stopped being usable"); } @@ -78,17 +78,18 @@ public class RedisCapabilitySettings { // The floor exists so an operator cannot configure a cache whose entries expire faster // than the round trip that wrote them, which costs a Redis write per read and returns a // miss every time. - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "the cache hard TTL of " + positiveHardTtl + " is below the configured minimum of " + minimumHardTtl); } if (commandTimeout.isZero() || commandTimeout.isNegative()) { - throw StartupFailures.envValidation("the cache command timeout must be positive"); + throw new CapabilityStartupValidationException( + "the cache command timeout must be positive"); } if (keyVersion < 1) { - throw StartupFailures.envValidation("the cache key version must be positive"); + throw new CapabilityStartupValidationException("the cache key version must be positive"); } } diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisIdempotencyConfig.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisIdempotencyConfig.java similarity index 98% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisIdempotencyConfig.java rename to src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisIdempotencyConfig.java index f94def89..81296082 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisIdempotencyConfig.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisIdempotencyConfig.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.redis; +package dev.caskeleton.adapter.outbound.cache.redis.capability; import dev.caskeleton.adapter.outbound.cache.redis.idempotency.IdempotencyScripts; import dev.caskeleton.adapter.outbound.cache.redis.idempotency.RedisIdempotencyStoreAdapter; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisKeys.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisKeys.java similarity index 92% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisKeys.java rename to src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisKeys.java index bdca27f4..f5fdf11f 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisKeys.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisKeys.java @@ -1,9 +1,9 @@ -package dev.caskeleton.bootstrap.autoconfigure.redis; +package dev.caskeleton.adapter.outbound.cache.redis.capability; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.key.RedisNamespace; import dev.caskeleton.adapter.outbound.cache.redis.sdk.config.RedisSdkSettings; +import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; import dev.caskeleton.application.outbound.SecretSourcePort; -import dev.caskeleton.bootstrap.runtime.startup.StartupFailures; import java.nio.charset.StandardCharsets; /** @@ -44,7 +44,7 @@ final class RedisKeys { .resolve(name) .orElseThrow( () -> - StartupFailures.envValidation( + new CapabilityStartupValidationException( "the Redis " + capability + " key-digest secret '" @@ -75,12 +75,12 @@ final class RedisKeys { private static String secretName(String reference, String capability) { if (reference == null || reference.isBlank()) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "the Redis " + capability + " capability needs a key-digest secret reference"); } int separator = reference.lastIndexOf('/'); if (!reference.startsWith("secret://") || separator < 0) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "the Redis " + capability + " key-digest reference '" diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisLeaseConfig.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisLeaseConfig.java similarity index 96% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisLeaseConfig.java rename to src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisLeaseConfig.java index a3f22457..fda61003 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisLeaseConfig.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisLeaseConfig.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.redis; +package dev.caskeleton.adapter.outbound.cache.redis.capability; import dev.caskeleton.adapter.outbound.cache.redis.lease.LeaseScripts; import dev.caskeleton.adapter.outbound.cache.redis.lease.RedisDistributedLeaseAdapter; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisRateLimitConfig.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisRateLimitConfig.java similarity index 93% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisRateLimitConfig.java rename to src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisRateLimitConfig.java index a801c63f..c05c8ac0 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisRateLimitConfig.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisRateLimitConfig.java @@ -1,11 +1,11 @@ -package dev.caskeleton.bootstrap.autoconfigure.redis; +package dev.caskeleton.adapter.outbound.cache.redis.capability; import dev.caskeleton.adapter.outbound.cache.redis.ratelimit.RateLimitKeys; import dev.caskeleton.adapter.outbound.cache.redis.ratelimit.RateLimitScripts; import dev.caskeleton.adapter.outbound.cache.redis.ratelimit.RedisEdgeRateLimitAdapter; import dev.caskeleton.adapter.outbound.cache.redis.sdk.config.RedisSdkSettings; import dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.connection.RedisRuntimeOwner; -import dev.caskeleton.bootstrap.runtime.startup.StartupFailures; +import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; import dev.caskeleton.shared.ratelimit.EdgeRateLimitPort; import dev.caskeleton.shared.ratelimit.RateLimitAlgorithm; import dev.caskeleton.shared.ratelimit.RateLimitFailurePolicy; @@ -64,7 +64,7 @@ class RedisRateLimitConfig { if (rateLimit.getPolicies().isEmpty()) { // An enabled limiter with no policy would answer every request "unknown policy", which the // port reports as a deployment error on every call rather than once at startup. - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "the Redis rate limiter is selected but no policy is configured under" + " ca-skeleton.capabilities.rate-limit.policies"); } @@ -73,7 +73,7 @@ class RedisRateLimitConfig { .getPolicies() .forEach((id, policy) -> policies.put(id, policyOf(id, policy, rateLimit))); if (!policies.containsKey(rateLimit.getDefaultPolicyId())) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "the default rate-limit policy '" + rateLimit.getDefaultPolicyId() + "' is not among the configured policies " @@ -92,7 +92,7 @@ class RedisRateLimitConfig { case "sliding-counter" -> RateLimitAlgorithm.SLIDING_COUNTER; case "token-bucket" -> RateLimitAlgorithm.TOKEN_BUCKET; default -> - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "unsupported rate-limit algorithm '" + policy.getAlgorithm() + "' for " + id); }; RateParameters parameters = @@ -115,7 +115,7 @@ class RedisRateLimitConfig { if (!"fail-closed".equalsIgnoreCase(rateLimit.getFailurePolicy())) { // The port only implements fail-closed, so a deployment that configured anything else has a // limit it believes is permissive and is not. - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "only fail-closed is supported for the Redis rate limiter, but" + " ca-skeleton.capabilities.rate-limit.failure-policy is '" + rateLimit.getFailurePolicy() diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisSemanticScriptAclProbe.java b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisSemanticScriptAclProbe.java similarity index 88% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisSemanticScriptAclProbe.java rename to src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisSemanticScriptAclProbe.java index a2c11f4b..c9c4a3f5 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisSemanticScriptAclProbe.java +++ b/src/adapter/outbound/cache-redis/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisSemanticScriptAclProbe.java @@ -1,9 +1,9 @@ -package dev.caskeleton.bootstrap.autoconfigure.redis; +package dev.caskeleton.adapter.outbound.cache.redis.capability; import dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.connection.RedisConnectionKind; import dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.connection.RedisLease; import dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.connection.RedisRuntimeOwner; -import dev.caskeleton.bootstrap.runtime.startup.StartupFailures; +import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.List; @@ -56,15 +56,16 @@ final class RedisSemanticScriptAclProbe implements SmartInitializingSingleton { if (reply.size() != 1 || !(reply.get(0) instanceof Number number) || number.longValue() != 1L) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "Redis semantic SCRIPT capability is selected but the SCRIPT ACL probe returned an " + "unexpected reply"); } } catch (InterruptedException interrupted) { Thread.currentThread().interrupt(); - throw StartupFailures.envValidation("Redis SCRIPT ACL probe was interrupted", interrupted); + throw new CapabilityStartupValidationException( + "Redis SCRIPT ACL probe was interrupted", interrupted); } catch (Exception failure) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "Redis semantic SCRIPT capability is selected but SCRIPT LOAD/EVALSHA is unavailable; " + "configure the ADVANCED Redis credential role or grant the effective account the " + "required script permissions", diff --git a/src/adapter/outbound/cache-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/src/adapter/outbound/cache-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..3850e523 --- /dev/null +++ b/src/adapter/outbound/cache-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +dev.caskeleton.adapter.outbound.cache.redis.capability.RedisCapabilityConfig diff --git a/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/cache/CacheEnvelopeTest.java b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/cache/CacheEnvelopeTest.java index 370fa742..1d416b39 100644 --- a/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/cache/CacheEnvelopeTest.java +++ b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/cache/CacheEnvelopeTest.java @@ -74,14 +74,7 @@ class CacheEnvelopeTest { @Test void aDigestValidVersionOneEnvelopeIsExplicitlyRetired() { byte[] encoded = - new CacheEnvelope( - 1, - "rev-old", - 1, - SOFT, - HARD, - "", - "old".getBytes(StandardCharsets.UTF_8)) + new CacheEnvelope(1, "rev-old", 1, SOFT, HARD, "", "old".getBytes(StandardCharsets.UTF_8)) .encode(); assertThatThrownBy(() -> CacheEnvelope.decode(encoded)) diff --git a/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/cache/RedisCacheRegionAdapterTest.java b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/cache/RedisCacheRegionAdapterTest.java index f60ac990..6263386c 100644 --- a/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/cache/RedisCacheRegionAdapterTest.java +++ b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/cache/RedisCacheRegionAdapterTest.java @@ -172,7 +172,8 @@ class RedisCacheRegionAdapterTest { } @Test - @DisplayName("an unknown negative-cache reason is corrupt schema rather than Redis unavailability") + @DisplayName( + "an unknown negative-cache reason is corrupt schema rather than Redis unavailability") void anUnknownNegativeReasonIsCorrupt() { writeRaw( "order-1", diff --git a/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityAutoConfigurationRegistrationTest.java b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityAutoConfigurationRegistrationTest.java new file mode 100644 index 00000000..d6ea3829 --- /dev/null +++ b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityAutoConfigurationRegistrationTest.java @@ -0,0 +1,104 @@ +package dev.caskeleton.adapter.outbound.cache.redis.capability; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.core.annotation.AnnotatedElementUtils; + +/** + * This leaf's auto-configurations are registered, not merely annotated. + * + *

Spring Boot needs two independent things before an auto-configuration runs: the annotation on + * the class, and a line naming it in {@code META-INF/spring/...AutoConfiguration.imports}. Tests + * that build a context with {@code AutoConfigurations.of(...)} supply the second one themselves, so + * they stay green for a capability that is present in no running application — which is exactly how + * several capabilities in this repository came to be assembled by nothing. + * + *

So this reads the registration file the jar actually ships and asserts both directions: every + * class this leaf means to register is named in it, and every name in it resolves to a class that + * carries {@code @AutoConfiguration}. A rename, a move or a deleted line fails here rather than in + * a deployment that starts and quietly does less than it says. + */ +class RedisCapabilityAutoConfigurationRegistrationTest { + + private static final String IMPORTS_RESOURCE = + "META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports"; + + /** The auto-configurations this leaf publishes. */ + private static final List PUBLISHED_ROOTS = + List.of("dev.caskeleton.adapter.outbound.cache.redis.capability.RedisCapabilityConfig"); + + @Test + @DisplayName("the shipped registration file names every root this leaf publishes") + void theShippedRegistrationFileNamesEveryRoot() { + assertThat(registeredNames()) + .as("the registration lines this leaf's own jar ships") + .containsAll(PUBLISHED_ROOTS); + } + + @Test + @DisplayName("every registered name resolves to a real Boot auto-configuration") + void everyRegisteredNameResolvesToAnAutoConfiguration() { + for (String name : registeredNames()) { + Class registered; + try { + registered = + Class.forName( + name, + false, + RedisCapabilityAutoConfigurationRegistrationTest.class.getClassLoader()); + } catch (ClassNotFoundException missing) { + throw new AssertionError( + IMPORTS_RESOURCE + " registers " + name + ", which does not exist", missing); + } + assertThat(AnnotatedElementUtils.hasAnnotation(registered, AutoConfiguration.class)) + .as("%s is registered but is not annotated @AutoConfiguration", name) + .isTrue(); + } + } + + /** + * The registration lines this leaf's own resource declares. + * + *

Read from this leaf's source tree rather than from the classpath. {@code + * ClassLoader#getResources} returns every registration file on the test runtime classpath — + * Spring Boot's, springdoc's, and every dependency leaf's — so asserting over that set tests + * other people's modules and fails on their conditional classes. The file below is the one this + * leaf packages, which is the thing this contract is about. + */ + private static List registeredNames() { + Path resource = leafRoot().resolve("src/main/resources/" + IMPORTS_RESOURCE); + assertThat(Files.isRegularFile(resource)).as("%s", resource).isTrue(); + List names; + try { + names = + Files.readAllLines(resource, StandardCharsets.UTF_8).stream() + .map(String::strip) + .filter(line -> !line.isEmpty() && !line.startsWith("#")) + .toList(); + } catch (IOException failure) { + throw new UncheckedIOException("cannot read " + resource, failure); + } + assertThat(names).as("%s registers nothing", resource).isNotEmpty(); + return names; + } + + /** The nearest directory above the test's working directory that ships a registration file. */ + private static Path leafRoot() { + for (Path path = Path.of("").toAbsolutePath(); path != null; path = path.getParent()) { + if (Files.isRegularFile(path.resolve("src/main/resources/" + IMPORTS_RESOURCE))) { + return path; + } + } + throw new IllegalStateException( + "no leaf shipping " + IMPORTS_RESOURCE + " found above " + Path.of("").toAbsolutePath()); + } +} diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisCapabilityCompositionTest.java b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityCompositionTest.java similarity index 99% rename from src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisCapabilityCompositionTest.java rename to src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityCompositionTest.java index e0dee699..d8832968 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisCapabilityCompositionTest.java +++ b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisCapabilityCompositionTest.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.redis; +package dev.caskeleton.adapter.outbound.cache.redis.capability; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisSemanticScriptAclProbeTest.java b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisSemanticScriptAclProbeTest.java similarity index 96% rename from src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisSemanticScriptAclProbeTest.java rename to src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisSemanticScriptAclProbeTest.java index 04a8d2f3..7c7c03a9 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisSemanticScriptAclProbeTest.java +++ b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/capability/RedisSemanticScriptAclProbeTest.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.redis; +package dev.caskeleton.adapter.outbound.cache.redis.capability; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; @@ -9,7 +9,7 @@ import dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.connection.RedisC import dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.connection.RedisRuntimeClient; import dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.connection.RedisRuntimeOwner; import dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.operations.RedisCommandGateway; -import dev.caskeleton.bootstrap.runtime.startup.StartupValidationException; +import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; import java.lang.reflect.Proxy; import java.nio.charset.StandardCharsets; import java.time.Duration; @@ -71,7 +71,7 @@ class RedisSemanticScriptAclProbeTest { Duration.ofSeconds(1)); assertThatThrownBy(probe::afterSingletonsInstantiated) - .isInstanceOf(StartupValidationException.class) + .isInstanceOf(CapabilityStartupValidationException.class) .hasMessageContaining("SCRIPT LOAD/EVALSHA is unavailable") .hasRootCauseInstanceOf(RuntimeException.class); } diff --git a/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/lease/RedisDistributedLeaseAdapterTest.java b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/lease/RedisDistributedLeaseAdapterTest.java index 27434f29..cab61ad2 100644 --- a/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/lease/RedisDistributedLeaseAdapterTest.java +++ b/src/adapter/outbound/cache-redis/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/lease/RedisDistributedLeaseAdapterTest.java @@ -75,7 +75,9 @@ class RedisDistributedLeaseAdapterTest { new LeaseScripts(), Clock.fixed(T0, ZoneOffset.UTC), nanos::get, - Duration.ofSeconds(2), Duration.ofMillis(50), driftBudget); + Duration.ofSeconds(2), + Duration.ofMillis(50), + driftBudget); } private LeaseRequest request(LeaseAttempt attempt, Duration ttl) { @@ -154,8 +156,7 @@ class RedisDistributedLeaseAdapterTest { @DisplayName("an inspected lease spends the configured drift budget before becoming usable") void inspectionAppliesTheDriftBudget() { LeaseAttempt attempt = adapter.newAttempt(OPERATION_A); - LeaseAcquireOutcome acquired = - adapter.tryAcquire(request(attempt, Duration.ofSeconds(30))); + LeaseAcquireOutcome acquired = adapter.tryAcquire(request(attempt, Duration.ofSeconds(30))); assertThat(acquired).isInstanceOf(LeaseAcquireOutcome.Acquired.class); RedisDistributedLeaseAdapter recovering = diff --git a/src/adapter/outbound/fileserver/build.gradle b/src/adapter/outbound/fileserver/build.gradle index ad125567..174c5354 100644 --- a/src/adapter/outbound/fileserver/build.gradle +++ b/src/adapter/outbound/fileserver/build.gradle @@ -14,6 +14,12 @@ dependencies { implementation project(':application-core') implementation project(':application-fileserver') implementation project(':shared-contract') + // CapabilityStartupValidationException: the seam that lets this leaf refuse a bad configuration + // without depending on the composition root. `12-bootstrap-sample.md` §3.4 names it as the + // answer to "how does assembly move into a leaf while failure reporting stays central" — + // app-bootstrap's StartupFailureExceptionReporter recognises it and emits the repository's + // standard STARTUP_VALIDATION_FAILED log, so the dependency runs bootstrap → support only. + implementation project(':adapter:outbound:support') implementation 'org.springframework.boot:spring-boot-autoconfigure' implementation 'org.slf4j:slf4j-api' diff --git a/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverCapabilityAutoConfiguration.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverCapabilityAutoConfiguration.java new file mode 100644 index 00000000..7ed0425b --- /dev/null +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverCapabilityAutoConfiguration.java @@ -0,0 +1,62 @@ +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; + +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Import; +import org.springframework.core.env.Environment; + +/** + * The Fileserver platform's own assembly, owned by the leaf that implements it. + * + *

Everything reachable from here builds this leaf's storage, verification, upload, download, + * cleanup, security and observability graph out of this leaf's own types. That is the reason it + * moved: the composition root was naming nineteen implementation classes it had no other business + * with, and "which capability assembles what" could only be answered by reading app-bootstrap. + * + *

What stayed in the composition root is the part that genuinely spans leaves — the HTTP + * surface, which is {@code adapter:inbound:web}'s, and the admin plane and startup sequencing, + * which are deployment policy. The root reaches this graph through the settings bean and the beans + * below, not by naming the configurations, so adding or splitting one of them here is no longer a + * change to app-bootstrap's compile. + * + *

Registered through this leaf's {@code AutoConfiguration.imports}. The master switch is carried + * here rather than assumed, so a deployment that never turned the platform on assembles nothing + * from this leaf — and, because the settings are bound here rather than by the application-wide + * properties scan, it does not even bind, let alone reject, a Fileserver configuration block it + * never enabled. + */ +@AutoConfiguration +@ConditionalOnProperty( + prefix = FileserverPlatformSettings.PREFIX, + name = "enabled", + havingValue = "true") +// Listed concretely rather than through the two aggregators that used to hold them. Those +// aggregators each mixed a leaf-internal concern with one that needs a sibling adapter — the JPA +// metadata store, the identifier generator — so they could not move as a unit, and a grouping that +// cannot survive the boundary it is grouped across was not describing a real concern. +@Import({ + FileserverObservabilityConfiguration.class, + FileserverStorageGatewayConfiguration.class, + FileserverStorageOperationsConfiguration.class, + FileserverVerificationConfiguration.class, + FileserverSecurityConfiguration.class, + FileserverDownloadLifecycleConfiguration.class, + FileserverMaintenanceServiceConfiguration.class +}) +public class FileserverCapabilityAutoConfiguration { + + /** + * Binds the platform settings once the master switch has already been proven true. + * + *

Binding is deliberately not delegated to {@code @ConfigurationPropertiesScan}: that would + * bind — and reject — Fileserver detail settings in deployments that never switched the + * capability on. + */ + @Bean + @ConditionalOnMissingBean + public FileserverPlatformSettings fileserverPlatformSettings(Environment environment) { + return FileserverPlatformSettingsBinder.bind(environment); + } +} diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverDownloadLifecycleConfiguration.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverDownloadLifecycleConfiguration.java similarity index 97% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverDownloadLifecycleConfiguration.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverDownloadLifecycleConfiguration.java index 959a7020..378b5a74 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverDownloadLifecycleConfiguration.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverDownloadLifecycleConfiguration.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; import dev.caskeleton.application.fileserver.api.metadata.FileMetadataStore; import dev.caskeleton.application.fileserver.api.security.FileAccessPolicy; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverFingerprintConsumerCondition.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverFingerprintConsumerCondition.java similarity index 93% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverFingerprintConsumerCondition.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverFingerprintConsumerCondition.java index 99343133..9a407828 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverFingerprintConsumerCondition.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverFingerprintConsumerCondition.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; import org.springframework.boot.autoconfigure.condition.AnyNestedCondition; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverMaintenanceServiceConfiguration.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverMaintenanceServiceConfiguration.java similarity index 98% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverMaintenanceServiceConfiguration.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverMaintenanceServiceConfiguration.java index 40d9b6a9..d9b7790f 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverMaintenanceServiceConfiguration.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverMaintenanceServiceConfiguration.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; import dev.caskeleton.application.fileserver.admin.AdminAuditPort; import dev.caskeleton.application.fileserver.admin.DefaultFileserverAdminService; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverMetricsSupport.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverMetricsSupport.java similarity index 77% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverMetricsSupport.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverMetricsSupport.java index f1d7f739..d4886882 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverMetricsSupport.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverMetricsSupport.java @@ -1,10 +1,10 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; import dev.caskeleton.application.fileserver.observability.FileserverMetricsPort; import org.springframework.beans.factory.ObjectProvider; /** Shared optional-metrics selection for Fileserver application-service assembly. */ -final class FileserverMetricsSupport { +public final class FileserverMetricsSupport { private FileserverMetricsSupport() {} @@ -16,7 +16,7 @@ final class FileserverMetricsSupport { * no-op stands in — which is also what stops the ports from being dead code the way they were * when nothing called them at all. */ - static FileserverMetricsPort metricsOrNoop(ObjectProvider metrics) { + public static FileserverMetricsPort metricsOrNoop(ObjectProvider metrics) { return metrics.getIfAvailable(FileserverMetricsPort::noop); } } diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverObservabilityConfiguration.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverObservabilityConfiguration.java similarity index 91% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverObservabilityConfiguration.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverObservabilityConfiguration.java index f0bd1b1e..605e2d7f 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverObservabilityConfiguration.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverObservabilityConfiguration.java @@ -1,9 +1,9 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; import dev.caskeleton.adapter.outbound.fileserver.platform.observability.MicrometerFileserverMetrics; +import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; import dev.caskeleton.application.fileserver.observability.FileserverMetricsPort; import dev.caskeleton.application.fileserver.observability.SafeFileFingerprint; -import dev.caskeleton.bootstrap.runtime.startup.StartupFailures; import io.micrometer.core.instrument.MeterRegistry; import java.nio.charset.StandardCharsets; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -31,7 +31,7 @@ class FileserverObservabilityConfiguration { SafeFileFingerprint fileserverFingerprint(FileserverPlatformSettings properties) { String key = properties.observability().fingerprintKey(); if (key == null || key.isBlank()) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( FileserverPlatformSettings.PREFIX + ".observability.fingerprint-key must be configured while metrics are enabled: an " + "unkeyed digest of an enumerable identifier is reversible"); diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformSettings.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverPlatformSettings.java similarity index 91% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformSettings.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverPlatformSettings.java index c53c9715..55d03a7d 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformSettings.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverPlatformSettings.java @@ -1,6 +1,6 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; -import dev.caskeleton.bootstrap.runtime.startup.StartupFailures; +import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; import java.nio.file.Path; import java.time.Duration; import java.util.List; @@ -78,7 +78,7 @@ public record FileserverPlatformSettings( requireText(publishMode, "storage.publish-mode"); long bytes = requireSize(bufferSize, "storage.buffer-size"); if (bytes < MINIMUM_BUFFER_BYTES || bytes > MAXIMUM_BUFFER_BYTES) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( PREFIX + ".storage.buffer-size must be between 4KB and 8MB"); } } @@ -100,13 +100,13 @@ public record FileserverPlatformSettings( long maxRequest = requireSize(maxRequestSize, "upload.max-request-size"); long reservation = requireSize(initialReservation, "upload.initial-reservation"); if (maxRequest < maxFile) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( PREFIX + ".upload.max-request-size must be at least upload.max-file-size: a request " + "envelope smaller than the file it carries rejects every maximum-sized upload"); } if (reservation > maxFile) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( PREFIX + ".upload.initial-reservation must not exceed upload.max-file-size"); } requirePositive(maxParts, "upload.max-parts"); @@ -153,7 +153,7 @@ public record FileserverPlatformSettings( requirePositive(queueCapacity, "transfer.queue-capacity"); requirePositive(awaitSeconds, "transfer.await-seconds"); if (coreSize > maxSize) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( PREFIX + ".transfer.core-size must not exceed transfer.max-size"); } } @@ -236,11 +236,11 @@ public record FileserverPlatformSettings( requireFraction(softHighWater, "quota.soft-high-water"); requireFraction(hardHighWater, "quota.hard-high-water"); if (softHighWater >= hardHighWater) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( PREFIX + ".quota.soft-high-water must be below quota.hard-high-water"); } if (scopeUploadPermits > instanceUploadPermits) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( PREFIX + ".quota.scope-upload-permits must not exceed quota.instance-upload-permits"); } } @@ -299,13 +299,14 @@ public record FileserverPlatformSettings( private static void requireText(String value, String name) { if (value == null || value.isBlank()) { - throw StartupFailures.envValidation(PREFIX + "." + name + " must be non-blank"); + throw new CapabilityStartupValidationException(PREFIX + "." + name + " must be non-blank"); } } private static void requireRoles(List roles, String name) { if (roles == null || roles.isEmpty()) { - throw StartupFailures.envValidation(PREFIX + "." + name + " must list at least one role"); + throw new CapabilityStartupValidationException( + PREFIX + "." + name + " must list at least one role"); } for (String role : roles) { requireText(role, name); @@ -314,19 +315,21 @@ public record FileserverPlatformSettings( private static void requirePositive(int value, String name) { if (value < 1) { - throw StartupFailures.envValidation(PREFIX + "." + name + " must be positive"); + throw new CapabilityStartupValidationException(PREFIX + "." + name + " must be positive"); } } private static void requirePositive(Duration value, String name) { if (value == null || value.isNegative() || value.isZero()) { - throw StartupFailures.envValidation(PREFIX + "." + name + " must be a positive duration"); + throw new CapabilityStartupValidationException( + PREFIX + "." + name + " must be a positive duration"); } } private static void requireFraction(double value, String name) { if (!(value > 0) || value > 1) { - throw StartupFailures.envValidation(PREFIX + "." + name + " must be within (0, 1]"); + throw new CapabilityStartupValidationException( + PREFIX + "." + name + " must be within (0, 1]"); } } @@ -338,14 +341,15 @@ public record FileserverPlatformSettings( */ private static long requireSize(DataSize value, String name) { if (value == null || value.toBytes() < 1) { - throw StartupFailures.envValidation(PREFIX + "." + name + " must be a positive size"); + throw new CapabilityStartupValidationException( + PREFIX + "." + name + " must be a positive size"); } return value.toBytes(); } private static void requireAbsolute(Path root) { if (root == null || !root.isAbsolute()) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( PREFIX + ".storage.root must be an absolute path: a relative root resolves against the " + "process working directory, which differs between a container and a test"); diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformSettingsBinder.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverPlatformSettingsBinder.java similarity index 93% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformSettingsBinder.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverPlatformSettingsBinder.java index a0d6ada8..5de0464c 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformSettingsBinder.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverPlatformSettingsBinder.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; import dev.caskeleton.adapter.outbound.support.StrictSettingsBinder; import org.springframework.core.env.Environment; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverSecurityConfiguration.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverSecurityConfiguration.java similarity index 90% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverSecurityConfiguration.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverSecurityConfiguration.java index c4939522..ca8218e7 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverSecurityConfiguration.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverSecurityConfiguration.java @@ -1,14 +1,13 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; import dev.caskeleton.adapter.outbound.fileserver.platform.audit.StructuredAdminAuditAdapter; import dev.caskeleton.adapter.outbound.fileserver.platform.audit.StructuredFileserverAuditAdapter; import dev.caskeleton.adapter.outbound.fileserver.platform.security.RoleBasedFileAccessPolicy; import dev.caskeleton.adapter.outbound.fileserver.platform.security.UnenforcedFileAccessPolicy; +import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; import dev.caskeleton.application.fileserver.admin.AdminAuditPort; import dev.caskeleton.application.fileserver.api.security.FileAccessPolicy; import dev.caskeleton.application.fileserver.observability.FileserverAuditPort; -import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot; -import dev.caskeleton.bootstrap.runtime.startup.StartupFailures; import dev.caskeleton.shared.runtime.RuntimeEnvironment; import java.util.LinkedHashSet; import java.util.List; @@ -56,11 +55,11 @@ public class FileserverSecurityConfiguration { false); case MODE_UNENFORCED -> unenforcedOrFail(environment); case MODE_REQUIRED -> - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "fileserver is enabled without an authorization policy: supply a FileAccessPolicy " + "bean, or set app.fileserver-platform.security.access-policy to role-based"); default -> - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "app.fileserver-platform.security.access-policy must be one of required, role-based, " + "unenforced"); }; @@ -79,8 +78,8 @@ public class FileserverSecurityConfiguration { } private static FileAccessPolicy unenforcedOrFail(Environment environment) { - if (RuntimeProfileSnapshot.from(environment).isProduction()) { - throw StartupFailures.profileMismatch( + if (RuntimeEnvironment.isProductionActive(List.of(environment.getActiveProfiles()))) { + throw new CapabilityStartupValidationException( "app.fileserver-platform.security.access-policy=unenforced authorizes every file " + "operation and must not be active under the '" + RuntimeEnvironment.PROD.profileName() diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStartupCheck.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStartupCheck.java similarity index 94% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStartupCheck.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStartupCheck.java index ffa39e85..74a8d57c 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStartupCheck.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStartupCheck.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageProbeResult; import dev.caskeleton.application.fileserver.api.content.PublishMode; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStartupValidator.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStartupValidator.java similarity index 88% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStartupValidator.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStartupValidator.java index 3ce92afb..d03074c9 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStartupValidator.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStartupValidator.java @@ -1,9 +1,7 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageProbeResult; import dev.caskeleton.application.fileserver.api.content.PublishMode; -import dev.caskeleton.bootstrap.runtime.startup.StartupPhase; -import dev.caskeleton.bootstrap.runtime.startup.StartupValidationContext; import java.nio.file.Path; /** @@ -26,8 +24,7 @@ public final class FileserverStartupValidator { * allowed to fall back to a metadata pointer publish, so it only requires the mandatory checks. */ public void validate(PublishMode publishMode, LocalStorageProbeResult probeResult) { - StartupValidationContext violations = - StartupValidationContext.forPhase(StartupPhase.ENV_VALIDATION); + FileserverStartupViolations violations = new FileserverStartupViolations(); collectStorageViolations(publishMode, probeResult, violations); violations.failIfViolated(SUMMARY); } @@ -39,8 +36,7 @@ public final class FileserverStartupValidator { * rather than discovering them one restart at a time. */ public void validate(FileserverStartupCheck check) { - StartupValidationContext violations = - StartupValidationContext.forPhase(StartupPhase.ENV_VALIDATION); + FileserverStartupViolations violations = new FileserverStartupViolations(); collectStorageViolations(check.publishMode(), check.probeResult(), violations); collectRootViolations(check, violations); @@ -63,7 +59,7 @@ public final class FileserverStartupValidator { private void collectStorageViolations( PublishMode publishMode, LocalStorageProbeResult probeResult, - StartupValidationContext violations) { + FileserverStartupViolations violations) { if (!probeResult.writableRoot()) { violations.reject("storage root is not writable"); } @@ -94,7 +90,7 @@ public final class FileserverStartupValidator { * execution, so this is checked before anything is written. */ private void collectRootViolations( - FileserverStartupCheck check, StartupValidationContext violations) { + FileserverStartupCheck check, FileserverStartupViolations violations) { Path root = check.storageRoot().toAbsolutePath().normalize(); for (Path forbidden : check.forbiddenRootAncestors()) { Path normalized = forbidden.toAbsolutePath().normalize(); diff --git a/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStartupViolations.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStartupViolations.java new file mode 100644 index 00000000..f8bce99a --- /dev/null +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStartupViolations.java @@ -0,0 +1,44 @@ +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; + +import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Collects every Fileserver startup violation, then raises them as one configuration failure. + * + *

Accumulating rather than failing fast is the property worth keeping, and it is the reason this + * exists at all: an operator fixing a misconfigured deployment works in cycles of edit, restart, + * read the error, so reporting one problem per restart turns one bad configuration into as many + * restarts as it has mistakes. + * + *

A leaf-local collector rather than the composition root's {@code StartupValidationContext}. + * That class is shared by fifteen guards in {@code app-bootstrap} and chooses its exception from a + * {@code StartupPhase}, which is composition-root vocabulary; a leaf that assembles its own + * capability must be able to refuse a bad configuration without depending on the root at all. The + * failure it raises is {@link CapabilityStartupValidationException}, which the root's {@code + * StartupFailureExceptionReporter} recognises and reports with the repository's standard {@code + * STARTUP_VALIDATION_FAILED} fields and exit code — so the dependency runs one way, and the + * operator sees no difference. + * + *

The message shape is unchanged: the summary, a colon, then the violations joined with "; ". + */ +final class FileserverStartupViolations { + + private final List violations = new ArrayList<>(); + + /** Records a violation. */ + FileserverStartupViolations reject(String violation) { + violations.add(Objects.requireNonNull(violation, "violation")); + return this; + } + + /** Raises everything collected, or returns quietly when nothing was. */ + void failIfViolated(String summary) { + if (violations.isEmpty()) { + return; + } + throw new CapabilityStartupValidationException(summary + ": " + String.join("; ", violations)); + } +} diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStorageGatewayConfiguration.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStorageGatewayConfiguration.java similarity index 97% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStorageGatewayConfiguration.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStorageGatewayConfiguration.java index 1e8bb60d..0cef1a75 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStorageGatewayConfiguration.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStorageGatewayConfiguration.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalBlockingContentStore; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalCleanupContentGateway; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStorageOperationsConfiguration.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStorageOperationsConfiguration.java similarity index 97% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStorageOperationsConfiguration.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStorageOperationsConfiguration.java index 81ae13f6..11f99d30 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStorageOperationsConfiguration.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStorageOperationsConfiguration.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalBlockingContentStore; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalOrphanScanAdapter; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverVerificationConfiguration.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverVerificationConfiguration.java similarity index 97% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverVerificationConfiguration.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverVerificationConfiguration.java index 06ecddf8..ca5cbf9c 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverVerificationConfiguration.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverVerificationConfiguration.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalBlockingContentStore; import dev.caskeleton.adapter.outbound.fileserver.platform.verification.FilenamePolicyVerifier; diff --git a/src/adapter/outbound/identifier/src/main/java/dev/caskeleton/adapter/outbound/identifier/RandomUploadIdentifierFactory.java b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/identifier/RandomUploadIdentifierFactory.java similarity index 93% rename from src/adapter/outbound/identifier/src/main/java/dev/caskeleton/adapter/outbound/identifier/RandomUploadIdentifierFactory.java rename to src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/identifier/RandomUploadIdentifierFactory.java index e81ee2fd..69d74975 100644 --- a/src/adapter/outbound/identifier/src/main/java/dev/caskeleton/adapter/outbound/identifier/RandomUploadIdentifierFactory.java +++ b/src/adapter/outbound/fileserver/src/main/java/dev/caskeleton/adapter/outbound/fileserver/platform/identifier/RandomUploadIdentifierFactory.java @@ -1,4 +1,4 @@ -package dev.caskeleton.adapter.outbound.identifier; +package dev.caskeleton.adapter.outbound.fileserver.platform.identifier; import dev.caskeleton.application.fileserver.api.FileId; import dev.caskeleton.application.fileserver.api.UploadId; diff --git a/src/adapter/outbound/fileserver/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/src/adapter/outbound/fileserver/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..68166273 --- /dev/null +++ b/src/adapter/outbound/fileserver/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverCapabilityAutoConfiguration diff --git a/src/adapter/outbound/fileserver/src/test/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverCapabilityAutoConfigurationRegistrationTest.java b/src/adapter/outbound/fileserver/src/test/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverCapabilityAutoConfigurationRegistrationTest.java new file mode 100644 index 00000000..f670ad9e --- /dev/null +++ b/src/adapter/outbound/fileserver/src/test/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverCapabilityAutoConfigurationRegistrationTest.java @@ -0,0 +1,105 @@ +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.core.annotation.AnnotatedElementUtils; + +/** + * This leaf's auto-configurations are registered, not merely annotated. + * + *

Spring Boot needs two independent things before an auto-configuration runs: the annotation on + * the class, and a line naming it in {@code META-INF/spring/...AutoConfiguration.imports}. Tests + * that build a context with {@code AutoConfigurations.of(...)} supply the second one themselves, so + * they stay green for a capability that is present in no running application — which is exactly how + * several capabilities in this repository came to be assembled by nothing. + * + *

So this reads the registration file the jar actually ships and asserts both directions: every + * class this leaf means to register is named in it, and every name in it resolves to a class that + * carries {@code @AutoConfiguration}. A rename, a move or a deleted line fails here rather than in + * a deployment that starts and quietly does less than it says. + */ +class FileserverCapabilityAutoConfigurationRegistrationTest { + + private static final String IMPORTS_RESOURCE = + "META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports"; + + /** The auto-configurations this leaf publishes. */ + private static final List PUBLISHED_ROOTS = + List.of( + "dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverCapabilityAutoConfiguration"); + + @Test + @DisplayName("the shipped registration file names every root this leaf publishes") + void theShippedRegistrationFileNamesEveryRoot() { + assertThat(registeredNames()) + .as("the registration lines this leaf's own jar ships") + .containsAll(PUBLISHED_ROOTS); + } + + @Test + @DisplayName("every registered name resolves to a real Boot auto-configuration") + void everyRegisteredNameResolvesToAnAutoConfiguration() { + for (String name : registeredNames()) { + Class registered; + try { + registered = + Class.forName( + name, + false, + FileserverCapabilityAutoConfigurationRegistrationTest.class.getClassLoader()); + } catch (ClassNotFoundException missing) { + throw new AssertionError( + IMPORTS_RESOURCE + " registers " + name + ", which does not exist", missing); + } + assertThat(AnnotatedElementUtils.hasAnnotation(registered, AutoConfiguration.class)) + .as("%s is registered but is not annotated @AutoConfiguration", name) + .isTrue(); + } + } + + /** + * The registration lines this leaf's own resource declares. + * + *

Read from this leaf's source tree rather than from the classpath. {@code + * ClassLoader#getResources} returns every registration file on the test runtime classpath — + * Spring Boot's, springdoc's, and every dependency leaf's — so asserting over that set tests + * other people's modules and fails on their conditional classes. The file below is the one this + * leaf packages, which is the thing this contract is about. + */ + private static List registeredNames() { + Path resource = leafRoot().resolve("src/main/resources/" + IMPORTS_RESOURCE); + assertThat(Files.isRegularFile(resource)).as("%s", resource).isTrue(); + List names; + try { + names = + Files.readAllLines(resource, StandardCharsets.UTF_8).stream() + .map(String::strip) + .filter(line -> !line.isEmpty() && !line.startsWith("#")) + .toList(); + } catch (IOException failure) { + throw new UncheckedIOException("cannot read " + resource, failure); + } + assertThat(names).as("%s registers nothing", resource).isNotEmpty(); + return names; + } + + /** The nearest directory above the test's working directory that ships a registration file. */ + private static Path leafRoot() { + for (Path path = Path.of("").toAbsolutePath(); path != null; path = path.getParent()) { + if (Files.isRegularFile(path.resolve("src/main/resources/" + IMPORTS_RESOURCE))) { + return path; + } + } + throw new IllegalStateException( + "no leaf shipping " + IMPORTS_RESOURCE + " found above " + Path.of("").toAbsolutePath()); + } +} diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStartupValidatorTest.java b/src/adapter/outbound/fileserver/src/test/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStartupValidatorTest.java similarity index 98% rename from src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStartupValidatorTest.java rename to src/adapter/outbound/fileserver/src/test/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStartupValidatorTest.java index 13997a66..18e794b4 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStartupValidatorTest.java +++ b/src/adapter/outbound/fileserver/src/test/java/dev/caskeleton/adapter/outbound/fileserver/platform/autoconfigure/FileserverStartupValidatorTest.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; diff --git a/src/adapter/outbound/httpclient/gradle.lockfile b/src/adapter/outbound/httpclient/gradle.lockfile index 0036b8e8..1f7fdc18 100644 --- a/src/adapter/outbound/httpclient/gradle.lockfile +++ b/src/adapter/outbound/httpclient/gradle.lockfile @@ -144,8 +144,8 @@ org.codehaus.plexus:plexus-component-annotations:2.1.0=checkstyle org.codehaus.plexus:plexus-container-default:2.1.0=checkstyle org.codehaus.plexus:plexus-utils:3.3.0=checkstyle org.dom4j:dom4j:2.2.0=spotbugs -org.eclipse.jetty.compression:jetty-compression-common:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath -org.eclipse.jetty.compression:jetty-compression-gzip:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath +org.eclipse.jetty.compression:jetty-compression-common:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath +org.eclipse.jetty.compression:jetty-compression-gzip:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath org.eclipse.jetty.http3:jetty-http3-client-transport:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath org.eclipse.jetty.http3:jetty-http3-client:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath org.eclipse.jetty.http3:jetty-http3-common:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath @@ -154,11 +154,11 @@ org.eclipse.jetty.quic:jetty-quic-api:12.1.12=compileClasspath,httpClientPerform org.eclipse.jetty.quic:jetty-quic-client:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath org.eclipse.jetty.quic:jetty-quic-common:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath org.eclipse.jetty.quic:jetty-quic-util:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath -org.eclipse.jetty:jetty-alpn-client:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath -org.eclipse.jetty:jetty-client:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath -org.eclipse.jetty:jetty-http:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath -org.eclipse.jetty:jetty-io:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath -org.eclipse.jetty:jetty-util:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath +org.eclipse.jetty:jetty-alpn-client:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath +org.eclipse.jetty:jetty-client:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath +org.eclipse.jetty:jetty-http:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath +org.eclipse.jetty:jetty-io:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath +org.eclipse.jetty:jetty-util:12.1.12=compileClasspath,httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath org.hamcrest:hamcrest-core:3.0=httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testFixturesCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath org.hamcrest:hamcrest:3.0=httpClientPerformanceTestCompileClasspath,httpClientPerformanceTestRuntimeClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testFixturesCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath org.hdrhistogram:HdrHistogram:2.2.2=httpClientPerformanceTestRuntimeClasspath,integrationTestRuntimeClasspath,jmhRuntimeClasspath,runtimeClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath,testkitRuntimeClasspath diff --git a/src/adapter/outbound/httpclient/src/httpClientPerformanceTest/java/dev/caskeleton/adapter/outbound/httpclient/performance/Http2StreamSaturationTest.java b/src/adapter/outbound/httpclient/src/httpClientPerformanceTest/java/dev/caskeleton/adapter/outbound/httpclient/performance/Http2StreamSaturationTest.java index a62e059e..15d6af76 100644 --- a/src/adapter/outbound/httpclient/src/httpClientPerformanceTest/java/dev/caskeleton/adapter/outbound/httpclient/performance/Http2StreamSaturationTest.java +++ b/src/adapter/outbound/httpclient/src/httpClientPerformanceTest/java/dev/caskeleton/adapter/outbound/httpclient/performance/Http2StreamSaturationTest.java @@ -71,8 +71,7 @@ class Http2StreamSaturationTest { try { reactor.netty.http.client.HttpClient client = new ReactorHttpClientFactory() - .create( - profile, pool, Optional.of(TlsMaterials.trustOnly(fixture)), Optional.empty()); + .create(profile, pool, Optional.of(TlsMaterials.trustOnly(fixture))); List versions = Flux.fromStream(IntStream.range(0, streams).boxed()) diff --git a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/apache/ApacheHttp2EvidenceReader.java b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/apache/ApacheHttp2EvidenceReader.java new file mode 100644 index 00000000..888da2eb --- /dev/null +++ b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/apache/ApacheHttp2EvidenceReader.java @@ -0,0 +1,49 @@ +package dev.caskeleton.adapter.outbound.httpclient.apache; + +import dev.caskeleton.adapter.outbound.httpclient.resilience.Http2ProtocolEvidence; +import dev.caskeleton.adapter.outbound.httpclient.resilience.ProtocolEvidenceReader; +import org.apache.hc.core5.http2.H2Error; +import org.apache.hc.core5.http2.H2StreamResetException; + +/** + * Reads HTTP/2 frame evidence out of Apache HttpClient 5 failures. + * + *

Only {@code REFUSED_STREAM} is reported, and that limit is the point. RFC 9113 §8.7 says a + * stream refused with that code was not processed, so promoting the attempt back to NOT_SENT is a + * fact rather than an inference — which is what makes a retry of a non-idempotent request safe. + * + *

GOAWAY is deliberately not reported. The promotion rule needs the frame's last-stream-id + * compared against this attempt's stream id, and HC5 surfaces neither on the exception: it raises a + * connection-level failure with no id attached. Reporting GOAWAY without those two numbers would + * mean treating every connection that went away as proof the request was never processed, and the + * requests that had already been processed are exactly the ones a false NOT_SENT would duplicate. A + * reader that says nothing leaves the attempt classified by the ordinary rules, which is correct; + * one that guesses makes a duplicate look safe. + * + *

The cause chain is walked because the engine wraps: a stream reset arrives inside an I/O + * exception inside Spring's {@code ResourceAccessException}. + */ +public final class ApacheHttp2EvidenceReader implements ProtocolEvidenceReader { + + /** Bounds the walk, so a self-referencing cause cannot spin here. */ + private static final int MAXIMUM_CAUSE_DEPTH = 16; + + @Override + public Http2ProtocolEvidence read(Throwable failure) { + Throwable current = failure; + for (int depth = 0; current != null && depth < MAXIMUM_CAUSE_DEPTH; depth++) { + if (current instanceof H2StreamResetException reset + && reset.getCode() == H2Error.REFUSED_STREAM.getCode()) { + // The stream id is not on the exception either; it is not needed for REFUSED_STREAM, whose + // meaning does not depend on comparing ids the way GOAWAY's does. + return Http2ProtocolEvidence.refusedStream(0); + } + Throwable cause = current.getCause(); + if (cause == current) { + break; + } + current = cause; + } + return Http2ProtocolEvidence.none(); + } +} diff --git a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettings.java b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettings.java index 3c7aad52..094fc544 100644 --- a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettings.java +++ b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettings.java @@ -36,11 +36,14 @@ import org.springframework.boot.context.properties.bind.DefaultValue; * @param enabled master switch for the whole capability * @param clients the Named Client Profiles this deployment declares * @param dynamicTargets the Dynamic Target policies this deployment declares + * @param rotationDrainTimeout how long a retired runtime generation may keep draining after a + * certificate rotation before its pool is closed underneath whatever is still in flight */ public record HttpClientPlatformSettings( @DefaultValue("false") boolean enabled, @DefaultValue List clients, - @DefaultValue List dynamicTargets) { + @DefaultValue List dynamicTargets, + @DefaultValue("30s") Duration rotationDrainTimeout) { /** Configuration prefix; the canonical environment form is {@code APP_HTTPCLIENT_*}. */ public static final String PREFIX = "app.httpclient"; @@ -48,6 +51,12 @@ public record HttpClientPlatformSettings( public HttpClientPlatformSettings { clients = List.copyOf(clients == null ? List.of() : clients); dynamicTargets = List.copyOf(dynamicTargets == null ? List.of() : dynamicTargets); + rotationDrainTimeout = + rotationDrainTimeout == null ? Duration.ofSeconds(30) : rotationDrainTimeout; + if (rotationDrainTimeout.isNegative()) { + throw new CapabilityStartupValidationException( + PREFIX + ".rotation-drain-timeout must not be negative"); + } if (enabled && clients.isEmpty()) { // An active platform with nothing to call still holds transport providers, a resilience // registry and five caller-facing gateways that no caller can reach. That is not a working diff --git a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientProfileAutoConfiguration.java b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientProfileAutoConfiguration.java index db3c0fb6..8c5155ad 100644 --- a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientProfileAutoConfiguration.java +++ b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientProfileAutoConfiguration.java @@ -7,6 +7,7 @@ import dev.caskeleton.adapter.outbound.httpclient.dynamic.DynamicCredentialBindi import dev.caskeleton.adapter.outbound.httpclient.profile.ClientApiType; import dev.caskeleton.adapter.outbound.httpclient.profile.ClientProfile; import dev.caskeleton.adapter.outbound.httpclient.profile.ClientRuntime; +import dev.caskeleton.adapter.outbound.httpclient.profile.ClientRuntimeFactory; import dev.caskeleton.adapter.outbound.httpclient.profile.ClientRuntimeRegistry; import dev.caskeleton.adapter.outbound.httpclient.profile.RuntimeEnvironment; import dev.caskeleton.adapter.outbound.httpclient.profile.RuntimeGeneration; @@ -15,6 +16,7 @@ import dev.caskeleton.adapter.outbound.httpclient.resilience.ResilienceRegistry; import dev.caskeleton.adapter.outbound.httpclient.restclient.BlockingExecutionSupport; import dev.caskeleton.adapter.outbound.httpclient.restclient.RestClientRuntimeFactory; import dev.caskeleton.adapter.outbound.httpclient.security.TlsPolicyValidator; +import dev.caskeleton.adapter.outbound.httpclient.security.TlsRuntimeRotationCoordinator; import dev.caskeleton.adapter.outbound.httpclient.transport.BlockingTransportProvider; import dev.caskeleton.adapter.outbound.httpclient.transport.ReactiveTransportProvider; import dev.caskeleton.adapter.outbound.httpclient.transport.TransportLifecycleListener; @@ -54,31 +56,23 @@ public class HttpClientProfileAutoConfiguration { return new HttpClientStartupValidator(tlsPolicyValidator); } - @Bean(destroyMethod = "close") + /** + * The one factory that builds a runtime for any profile, whichever API the profile declares. + * + *

Published rather than assembled inside the registry method because rotation needs the same + * factory the initial build used: a replacement generation that is constructed differently from + * the generation it replaces is not the same client with new material, it is a different client. + */ + @Bean @ConditionalOnMissingBean - ClientRuntimeRegistry httpClientRuntimeRegistry( - Environment environment, - HttpClientPlatformSettings properties, - HttpClientProfileFactory profileFactory, - HttpClientStartupValidator startupValidator, + ClientRuntimeFactory httpClientRuntimeFactory( Map httpClientBlockingTransportProviders, Map httpClientReactiveTransportProviders, ResilienceRegistry resilienceRegistry, CredentialProviderRegistry credentialProviders, ReactiveRequestCredentialProvider reactiveCredentialProvider, BlockingExecutionSupport executionSupport, - TransportLifecycleListener lifecycleListener, - List dynamicCredentialBindings, - ObjectProvider secretSources) { - - Map profiles = profileFactory.create(properties); - startupValidator.validateComposition( - profiles, - properties.dynamicTargets(), - dynamicCredentialBindings, - runtimeEnvironment(environment), - secretSources.getIfAvailable() != null); - + TransportLifecycleListener lifecycleListener) { RestClientRuntimeFactory blockingFactory = new RestClientRuntimeFactory( httpClientBlockingTransportProviders, @@ -95,15 +89,54 @@ public class HttpClientProfileAutoConfiguration { executionSupport, lifecycleListener, RandomGenerator.getDefault()); + return (profile, generation) -> + profile.api() == ClientApiType.WEB_CLIENT + ? reactiveFactory.create(profile, generation) + : blockingFactory.create(profile, generation); + } + + /** + * The runtime certificate rotation entry point. + * + *

{@link TlsRuntimeRotationCoordinator} and the generation drain it drives were fully + * implemented and published by nothing, so a deployment whose client certificate was renewed had + * no way to pick the new material up short of a restart — while the leaf's own documentation + * claimed runtime generations as a responsibility. A bean is what makes the capability reachable; + * {@code @ConditionalOnMissingBean} leaves a deployment free to drive rotation its own way. + */ + @Bean + @ConditionalOnMissingBean + TlsRuntimeRotationCoordinator httpClientTlsRuntimeRotationCoordinator( + ClientRuntimeRegistry runtimes, + ClientRuntimeFactory runtimeFactory, + HttpClientPlatformSettings properties) { + return new TlsRuntimeRotationCoordinator( + runtimes, runtimeFactory, properties.rotationDrainTimeout()); + } + + @Bean(destroyMethod = "close") + @ConditionalOnMissingBean + ClientRuntimeRegistry httpClientRuntimeRegistry( + Environment environment, + HttpClientPlatformSettings properties, + HttpClientProfileFactory profileFactory, + HttpClientStartupValidator startupValidator, + ClientRuntimeFactory runtimeFactory, + List dynamicCredentialBindings, + ObjectProvider secretSources) { + + Map profiles = profileFactory.create(properties); + startupValidator.validateComposition( + profiles, + properties.dynamicTargets(), + dynamicCredentialBindings, + runtimeEnvironment(environment), + secretSources.getIfAvailable() != null); Map runtimes = new LinkedHashMap<>(); profiles.forEach( (name, profile) -> - runtimes.put( - name, - profile.api() == ClientApiType.WEB_CLIENT - ? reactiveFactory.create(profile, new RuntimeGeneration(1)) - : blockingFactory.create(profile, new RuntimeGeneration(1)))); + runtimes.put(name, runtimeFactory.create(profile, new RuntimeGeneration(1)))); return new ClientRuntimeRegistry(runtimes); } diff --git a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/resilience/ProtocolEvidenceReader.java b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/resilience/ProtocolEvidenceReader.java new file mode 100644 index 00000000..30570794 --- /dev/null +++ b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/resilience/ProtocolEvidenceReader.java @@ -0,0 +1,28 @@ +package dev.caskeleton.adapter.outbound.httpclient.resilience; + +/** + * Reads frame-level protocol evidence out of whatever the transport engine threw. + * + *

The seam exists because the evidence is engine-specific and the classification is not. {@link + * Http2EvidenceMapper} knew how to turn a refused stream into "the peer did not process this", and + * nothing ever handed it a frame: every attempt passed {@link ProtocolEvidence#none()}, so the + * promotion the design documents — an already-sent request going back to NOT_SENT when the peer + * refused the stream — was unreachable in production while five unit tests exercised the mapper in + * isolation. + * + *

An implementation returns {@link Http2ProtocolEvidence#none()} when the failure carries no + * frame it can read. Silence is the correct answer far more often than a guess: treating an + * ambiguous failure as proof of non-processing would make a retry safe-looking when it is not, and + * that is worse than not promoting at all. + */ +@FunctionalInterface +public interface ProtocolEvidenceReader { + + /** Evidence carried by this failure, or {@link Http2ProtocolEvidence#none()}. */ + Http2ProtocolEvidence read(Throwable failure); + + /** A reader for an engine whose failures carry no readable frame. */ + static ProtocolEvidenceReader none() { + return failure -> Http2ProtocolEvidence.none(); + } +} diff --git a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/restclient/BlockingAttemptExecutor.java b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/restclient/BlockingAttemptExecutor.java index c8ef67f1..2b9acb52 100644 --- a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/restclient/BlockingAttemptExecutor.java +++ b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/restclient/BlockingAttemptExecutor.java @@ -123,12 +123,17 @@ public final class BlockingAttemptExecutor { } catch (RuntimeException engineFailure) { TransportFailure classified = runtime.failureClassifier().classify(engineFailure, tracker.stage()); + // The engine's own frame, not a constant. This argument was `ProtocolEvidence.none()` at + // every call, which made the documented promotion — an HTTP/2 REFUSED_STREAM taking an + // already-sent attempt back to NOT_SENT — unreachable in production while its mapper stayed + // green in isolation. The reader answers "nothing readable" for every failure that carries no + // frame, so the classification of everything else is unchanged. + ProtocolEvidence protocolEvidence = + support.http2EvidenceMapper().map(support.protocolEvidenceReader().read(engineFailure)); HttpFailureMetadata metadata = baseMetadata .withEvidence( - support - .evidenceClassifier() - .classify(tracker.snapshot(), ProtocolEvidence.none())) + support.evidenceClassifier().classify(tracker.snapshot(), protocolEvidence)) .withStage(classified.stage()); HttpClientException mapped = support.exceptionMapper().map(classified, metadata, engineFailure); diff --git a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/restclient/BlockingExecutionSupport.java b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/restclient/BlockingExecutionSupport.java index 06d394b8..3d16ce3d 100644 --- a/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/restclient/BlockingExecutionSupport.java +++ b/src/adapter/outbound/httpclient/src/main/java/dev/caskeleton/adapter/outbound/httpclient/restclient/BlockingExecutionSupport.java @@ -1,5 +1,6 @@ package dev.caskeleton.adapter.outbound.httpclient.restclient; +import dev.caskeleton.adapter.outbound.httpclient.apache.ApacheHttp2EvidenceReader; import dev.caskeleton.adapter.outbound.httpclient.auth.UnauthorizedRetryPolicy; import dev.caskeleton.adapter.outbound.httpclient.observation.HttpClientTagPolicy; import dev.caskeleton.adapter.outbound.httpclient.resilience.AttemptBudgetCalculator; @@ -7,6 +8,8 @@ import dev.caskeleton.adapter.outbound.httpclient.resilience.DeadlineCalculator; import dev.caskeleton.adapter.outbound.httpclient.resilience.DefaultExecutionEvidenceClassifier; import dev.caskeleton.adapter.outbound.httpclient.resilience.DefaultRetryEligibilityEngine; import dev.caskeleton.adapter.outbound.httpclient.resilience.ExecutionEvidenceClassifier; +import dev.caskeleton.adapter.outbound.httpclient.resilience.Http2EvidenceMapper; +import dev.caskeleton.adapter.outbound.httpclient.resilience.ProtocolEvidenceReader; import dev.caskeleton.adapter.outbound.httpclient.resilience.RetryEligibilityEngine; import dev.caskeleton.adapter.outbound.httpclient.security.RedirectEvaluator; import dev.caskeleton.adapter.outbound.httpclient.security.SensitiveHeaderStripper; @@ -27,6 +30,8 @@ public record BlockingExecutionSupport( MeterRegistry meterRegistry, HttpClientTagPolicy tagPolicy, ExecutionEvidenceClassifier evidenceClassifier, + ProtocolEvidenceReader protocolEvidenceReader, + Http2EvidenceMapper http2EvidenceMapper, RetryEligibilityEngine eligibilityEngine, RestClientBodyWriter bodyWriter, RestClientResponseReader responseReader, @@ -46,6 +51,8 @@ public record BlockingExecutionSupport( Objects.requireNonNull(meterRegistry, "meter registry"); Objects.requireNonNull(tagPolicy, "tag policy"); Objects.requireNonNull(evidenceClassifier, "evidence classifier"); + Objects.requireNonNull(protocolEvidenceReader, "protocol evidence reader"); + Objects.requireNonNull(http2EvidenceMapper, "http/2 evidence mapper"); Objects.requireNonNull(eligibilityEngine, "retry eligibility engine"); Objects.requireNonNull(bodyWriter, "body writer"); Objects.requireNonNull(responseReader, "response reader"); @@ -69,6 +76,11 @@ public record BlockingExecutionSupport( meterRegistry, HttpClientTagPolicy.standard(), new DefaultExecutionEvidenceClassifier(), + // The blocking transport is Apache HC5, so its failures are the ones that can carry a + // readable frame. A deployment on another engine gets ProtocolEvidenceReader.none() and the + // ordinary classification, which is what it had before this seam existed. + new ApacheHttp2EvidenceReader(), + new Http2EvidenceMapper(), new DefaultRetryEligibilityEngine(), new RestClientBodyWriter(), reader, diff --git a/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/apache/ApacheHttp2EvidenceReaderTest.java b/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/apache/ApacheHttp2EvidenceReaderTest.java new file mode 100644 index 00000000..945f1632 --- /dev/null +++ b/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/apache/ApacheHttp2EvidenceReaderTest.java @@ -0,0 +1,73 @@ +package dev.caskeleton.adapter.outbound.httpclient.apache; + +import static org.assertj.core.api.Assertions.assertThat; + +import dev.caskeleton.adapter.outbound.httpclient.resilience.Http2EvidenceMapper; +import dev.caskeleton.adapter.outbound.httpclient.resilience.Http2ProtocolEvidence; +import java.io.IOException; +import org.apache.hc.core5.http2.H2Error; +import org.apache.hc.core5.http2.H2StreamResetException; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.web.client.ResourceAccessException; + +/** + * The engine failure the executor actually catches, read back into platform evidence. + * + *

{@code Http2EvidenceMapperTest} already proves the mapping rule. What it cannot prove is that + * anything ever produces a frame for it to map — every attempt passed {@code ProtocolEvidence + * .none()}, so the rule was a function nobody called. This test starts from the exception Apache + * HttpClient throws, wrapped the way the caller sees it, and ends at the promotion. + */ +class ApacheHttp2EvidenceReaderTest { + + private final ApacheHttp2EvidenceReader reader = new ApacheHttp2EvidenceReader(); + private final Http2EvidenceMapper mapper = new Http2EvidenceMapper(); + + @Test + @DisplayName("a refused stream buried in the engine's wrappers proves the peer did not process") + void aRefusedStreamIsFoundThroughTheCauseChain() { + Throwable asTheExecutorSeesIt = + new ResourceAccessException( + "I/O error on POST", + new IOException(new H2StreamResetException(H2Error.REFUSED_STREAM, "stream refused"))); + + Http2ProtocolEvidence frame = reader.read(asTheExecutorSeesIt); + + assertThat(frame.kind()).isEqualTo(Http2ProtocolEvidence.Kind.REFUSED_STREAM); + assertThat(mapper.map(frame).peerDidNotProcess()) + .as("RFC 9113 §8.7: a stream refused with REFUSED_STREAM was not processed") + .isTrue(); + } + + @Test + @DisplayName("any other stream reset stays neutral") + void anotherResetCodeProvesNothing() { + Http2ProtocolEvidence frame = + reader.read(new H2StreamResetException(H2Error.INTERNAL_ERROR, "reset")); + + assertThat(frame.kind()).isEqualTo(Http2ProtocolEvidence.Kind.NONE); + assertThat(mapper.map(frame).peerDidNotProcess()).isFalse(); + } + + @Test + @DisplayName("an ordinary I/O failure carries no frame") + void anOrdinaryFailureCarriesNoFrame() { + assertThat(reader.read(new IOException("connection reset")).kind()) + .isEqualTo(Http2ProtocolEvidence.Kind.NONE); + } + + @Test + @DisplayName("a cyclic cause chain terminates instead of spinning") + void aCyclicCauseChainTerminates() { + // Java refuses self-causation, but not a cycle through two exceptions, and re-wrapping engines + // do produce them. A walk without a bound would hang the attempt rather than fail it, which is + // the worse of the two outcomes for a caller holding a deadline. + IOException outer = new IOException("outer"); + IOException inner = new IOException("inner"); + outer.initCause(inner); + inner.initCause(outer); + + assertThat(reader.read(outer).kind()).isEqualTo(Http2ProtocolEvidence.Kind.NONE); + } +} diff --git a/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientAutoConfigurationRegistrationTest.java b/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientAutoConfigurationRegistrationTest.java new file mode 100644 index 00000000..1dba8315 --- /dev/null +++ b/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientAutoConfigurationRegistrationTest.java @@ -0,0 +1,103 @@ +package dev.caskeleton.adapter.outbound.httpclient.autoconfigure; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.core.annotation.AnnotatedElementUtils; + +/** + * This leaf's auto-configurations are registered, not merely annotated. + * + *

Spring Boot needs two independent things before an auto-configuration runs: the annotation on + * the class, and a line naming it in {@code META-INF/spring/...AutoConfiguration.imports}. Tests + * that build a context with {@code AutoConfigurations.of(...)} supply the second one themselves, so + * they stay green for a capability that is present in no running application — which is exactly how + * several capabilities in this repository came to be assembled by nothing. + * + *

So this reads the registration file the jar actually ships and asserts both directions: every + * class this leaf means to register is named in it, and every name in it resolves to a class that + * carries {@code @AutoConfiguration}. A rename, a move or a deleted line fails here rather than in + * a deployment that starts and quietly does less than it says. + */ +class HttpClientAutoConfigurationRegistrationTest { + + private static final String IMPORTS_RESOURCE = + "META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports"; + + /** The auto-configurations this leaf publishes. */ + private static final List PUBLISHED_ROOTS = + List.of( + "dev.caskeleton.adapter.outbound.httpclient.autoconfigure.HttpClientPlatformAutoConfiguration"); + + @Test + @DisplayName("the shipped registration file names every root this leaf publishes") + void theShippedRegistrationFileNamesEveryRoot() { + assertThat(registeredNames()) + .as("the registration lines this leaf's own jar ships") + .containsAll(PUBLISHED_ROOTS); + } + + @Test + @DisplayName("every registered name resolves to a real Boot auto-configuration") + void everyRegisteredNameResolvesToAnAutoConfiguration() { + for (String name : registeredNames()) { + Class registered; + try { + registered = + Class.forName( + name, false, HttpClientAutoConfigurationRegistrationTest.class.getClassLoader()); + } catch (ClassNotFoundException missing) { + throw new AssertionError( + IMPORTS_RESOURCE + " registers " + name + ", which does not exist", missing); + } + assertThat(AnnotatedElementUtils.hasAnnotation(registered, AutoConfiguration.class)) + .as("%s is registered but is not annotated @AutoConfiguration", name) + .isTrue(); + } + } + + /** + * The registration lines this leaf's own resource declares. + * + *

Read from this leaf's source tree rather than from the classpath. {@code + * ClassLoader#getResources} returns every registration file on the test runtime classpath — + * Spring Boot's, springdoc's, and every dependency leaf's — so asserting over that set tests + * other people's modules and fails on their conditional classes. The file below is the one this + * leaf packages, which is the thing this contract is about. + */ + private static List registeredNames() { + Path resource = leafRoot().resolve("src/main/resources/" + IMPORTS_RESOURCE); + assertThat(Files.isRegularFile(resource)).as("%s", resource).isTrue(); + List names; + try { + names = + Files.readAllLines(resource, StandardCharsets.UTF_8).stream() + .map(String::strip) + .filter(line -> !line.isEmpty() && !line.startsWith("#")) + .toList(); + } catch (IOException failure) { + throw new UncheckedIOException("cannot read " + resource, failure); + } + assertThat(names).as("%s registers nothing", resource).isNotEmpty(); + return names; + } + + /** The nearest directory above the test's working directory that ships a registration file. */ + private static Path leafRoot() { + for (Path path = Path.of("").toAbsolutePath(); path != null; path = path.getParent()) { + if (Files.isRegularFile(path.resolve("src/main/resources/" + IMPORTS_RESOURCE))) { + return path; + } + } + throw new IllegalStateException( + "no leaf shipping " + IMPORTS_RESOURCE + " found above " + Path.of("").toAbsolutePath()); + } +} diff --git a/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettingsTest.java b/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettingsTest.java index 2a811112..5e6afb0e 100644 --- a/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettingsTest.java +++ b/src/adapter/outbound/httpclient/src/test/java/dev/caskeleton/adapter/outbound/httpclient/autoconfigure/HttpClientPlatformSettingsTest.java @@ -18,7 +18,7 @@ class HttpClientPlatformSettingsTest { @Test @DisplayName("an enabled platform with no client is a startup failure, not an idle platform") void anEnabledPlatformWithoutAnyClientIsRefused() { - assertThatThrownBy(() -> new HttpClientPlatformSettings(true, List.of(), List.of())) + assertThatThrownBy(() -> new HttpClientPlatformSettings(true, List.of(), List.of(), null)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("HTTPCLIENT_ACTIVE_WITHOUT_CLIENTS"); } @@ -26,13 +26,14 @@ class HttpClientPlatformSettingsTest { @Test @DisplayName("a disabled platform with no client is the normal case") void aDisabledPlatformWithoutAnyClientIsFine() { - assertThat(new HttpClientPlatformSettings(false, List.of(), List.of()).clients()).isEmpty(); + assertThat(new HttpClientPlatformSettings(false, List.of(), List.of(), null).clients()) + .isEmpty(); } @Test @DisplayName("null lists bind as empty rather than exploding later") void absentListsBecomeEmptyOnes() { - HttpClientPlatformSettings settings = new HttpClientPlatformSettings(false, null, null); + HttpClientPlatformSettings settings = new HttpClientPlatformSettings(false, null, null, null); assertThat(settings.clients()).isEmpty(); assertThat(settings.dynamicTargets()).isEmpty(); @@ -44,7 +45,7 @@ class HttpClientPlatformSettingsTest { assertThatThrownBy( () -> new HttpClientPlatformSettings( - true, List.of(client("payment"), client("payment")), List.of())) + true, List.of(client("payment"), client("payment")), List.of(), null)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("more than once") .hasMessageContaining("payment"); @@ -63,7 +64,7 @@ class HttpClientPlatformSettingsTest { assertThatThrownBy( () -> new HttpClientPlatformSettings( - true, List.of(client("payment-api"), client("payment_api")), List.of())) + true, List.of(client("payment-api"), client("payment_api")), List.of(), null)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("normalise to the same environment variable segment") .hasMessageContaining("PAYMENTAPI"); @@ -72,7 +73,8 @@ class HttpClientPlatformSettingsTest { @Test @DisplayName("a client without a name is refused") void anUnnamedClientIsRefused() { - assertThatThrownBy(() -> new HttpClientPlatformSettings(true, List.of(client(" ")), List.of())) + assertThatThrownBy( + () -> new HttpClientPlatformSettings(true, List.of(client(" ")), List.of(), null)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("name must be non-blank"); } @@ -83,7 +85,10 @@ class HttpClientPlatformSettingsTest { assertThatThrownBy( () -> new HttpClientPlatformSettings( - false, List.of(), List.of(dynamicTarget("web-hook"), dynamicTarget("webhook")))) + false, + List.of(), + List.of(dynamicTarget("web-hook"), dynamicTarget("webhook")), + null)) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("dynamic-targets"); } diff --git a/src/adapter/outbound/identifier/build.gradle b/src/adapter/outbound/identifier/build.gradle index c5bf4c14..bddded3c 100644 --- a/src/adapter/outbound/identifier/build.gradle +++ b/src/adapter/outbound/identifier/build.gradle @@ -2,7 +2,9 @@ plugins { id 'ca.spring-library' } +// No `application-fileserver` edge. This leaf held exactly one Fileserver type — the upload +// identifier factory — and that one type is why every application that needed an identifier also +// resolved the Fileserver use cases. It lives with the capability now. dependencies { implementation project(':application-core') - implementation project(':application-fileserver') } diff --git a/src/adapter/outbound/messaging-kafka/src/test/java/dev/caskeleton/adapter/outbound/messaging/kafka/LegacyKafkaAutoConfigurationRegistrationTest.java b/src/adapter/outbound/messaging-kafka/src/test/java/dev/caskeleton/adapter/outbound/messaging/kafka/LegacyKafkaAutoConfigurationRegistrationTest.java new file mode 100644 index 00000000..c20ba121 --- /dev/null +++ b/src/adapter/outbound/messaging-kafka/src/test/java/dev/caskeleton/adapter/outbound/messaging/kafka/LegacyKafkaAutoConfigurationRegistrationTest.java @@ -0,0 +1,103 @@ +package dev.caskeleton.adapter.outbound.messaging.kafka; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.core.annotation.AnnotatedElementUtils; + +/** + * This leaf's auto-configurations are registered, not merely annotated. + * + *

Spring Boot needs two independent things before an auto-configuration runs: the annotation on + * the class, and a line naming it in {@code META-INF/spring/...AutoConfiguration.imports}. Tests + * that build a context with {@code AutoConfigurations.of(...)} supply the second one themselves, so + * they stay green for a capability that is present in no running application — which is exactly how + * several capabilities in this repository came to be assembled by nothing. + * + *

So this reads the registration file the jar actually ships and asserts both directions: every + * class this leaf means to register is named in it, and every name in it resolves to a class that + * carries {@code @AutoConfiguration}. A rename, a move or a deleted line fails here rather than in + * a deployment that starts and quietly does less than it says. + */ +class LegacyKafkaAutoConfigurationRegistrationTest { + + private static final String IMPORTS_RESOURCE = + "META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports"; + + /** The auto-configurations this leaf publishes. */ + private static final List PUBLISHED_ROOTS = + List.of( + "dev.caskeleton.adapter.outbound.messaging.kafka.LegacyKafkaMessagingRootAutoConfiguration"); + + @Test + @DisplayName("the shipped registration file names every root this leaf publishes") + void theShippedRegistrationFileNamesEveryRoot() { + assertThat(registeredNames()) + .as("the registration lines this leaf's own jar ships") + .containsAll(PUBLISHED_ROOTS); + } + + @Test + @DisplayName("every registered name resolves to a real Boot auto-configuration") + void everyRegisteredNameResolvesToAnAutoConfiguration() { + for (String name : registeredNames()) { + Class registered; + try { + registered = + Class.forName( + name, false, LegacyKafkaAutoConfigurationRegistrationTest.class.getClassLoader()); + } catch (ClassNotFoundException missing) { + throw new AssertionError( + IMPORTS_RESOURCE + " registers " + name + ", which does not exist", missing); + } + assertThat(AnnotatedElementUtils.hasAnnotation(registered, AutoConfiguration.class)) + .as("%s is registered but is not annotated @AutoConfiguration", name) + .isTrue(); + } + } + + /** + * The registration lines this leaf's own resource declares. + * + *

Read from this leaf's source tree rather than from the classpath. {@code + * ClassLoader#getResources} returns every registration file on the test runtime classpath — + * Spring Boot's, springdoc's, and every dependency leaf's — so asserting over that set tests + * other people's modules and fails on their conditional classes. The file below is the one this + * leaf packages, which is the thing this contract is about. + */ + private static List registeredNames() { + Path resource = leafRoot().resolve("src/main/resources/" + IMPORTS_RESOURCE); + assertThat(Files.isRegularFile(resource)).as("%s", resource).isTrue(); + List names; + try { + names = + Files.readAllLines(resource, StandardCharsets.UTF_8).stream() + .map(String::strip) + .filter(line -> !line.isEmpty() && !line.startsWith("#")) + .toList(); + } catch (IOException failure) { + throw new UncheckedIOException("cannot read " + resource, failure); + } + assertThat(names).as("%s registers nothing", resource).isNotEmpty(); + return names; + } + + /** The nearest directory above the test's working directory that ships a registration file. */ + private static Path leafRoot() { + for (Path path = Path.of("").toAbsolutePath(); path != null; path = path.getParent()) { + if (Files.isRegularFile(path.resolve("src/main/resources/" + IMPORTS_RESOURCE))) { + return path; + } + } + throw new IllegalStateException( + "no leaf shipping " + IMPORTS_RESOURCE + " found above " + Path.of("").toAbsolutePath()); + } +} diff --git a/src/adapter/outbound/messaging/build.gradle b/src/adapter/outbound/messaging/build.gradle index 85f8330c..b8d8b047 100644 --- a/src/adapter/outbound/messaging/build.gradle +++ b/src/adapter/outbound/messaging/build.gradle @@ -1,6 +1,8 @@ plugins { id 'ca.spring-library' id 'ca.spring-config' + id 'ca.dependency-policy' + id 'ca.strict-qualification' } diff --git a/src/adapter/outbound/messaging/src/test/java/dev/caskeleton/adapter/outbound/messaging/autoconfigure/MessagingBridgeAutoConfigurationRegistrationTest.java b/src/adapter/outbound/messaging/src/test/java/dev/caskeleton/adapter/outbound/messaging/autoconfigure/MessagingBridgeAutoConfigurationRegistrationTest.java new file mode 100644 index 00000000..a65defca --- /dev/null +++ b/src/adapter/outbound/messaging/src/test/java/dev/caskeleton/adapter/outbound/messaging/autoconfigure/MessagingBridgeAutoConfigurationRegistrationTest.java @@ -0,0 +1,105 @@ +package dev.caskeleton.adapter.outbound.messaging.autoconfigure; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.core.annotation.AnnotatedElementUtils; + +/** + * This leaf's auto-configurations are registered, not merely annotated. + * + *

Spring Boot needs two independent things before an auto-configuration runs: the annotation on + * the class, and a line naming it in {@code META-INF/spring/...AutoConfiguration.imports}. Tests + * that build a context with {@code AutoConfigurations.of(...)} supply the second one themselves, so + * they stay green for a capability that is present in no running application — which is exactly how + * several capabilities in this repository came to be assembled by nothing. + * + *

So this reads the registration file the jar actually ships and asserts both directions: every + * class this leaf means to register is named in it, and every name in it resolves to a class that + * carries {@code @AutoConfiguration}. A rename, a move or a deleted line fails here rather than in + * a deployment that starts and quietly does less than it says. + */ +class MessagingBridgeAutoConfigurationRegistrationTest { + + private static final String IMPORTS_RESOURCE = + "META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports"; + + /** The auto-configurations this leaf publishes. */ + private static final List PUBLISHED_ROOTS = + List.of( + "dev.caskeleton.adapter.outbound.messaging.autoconfigure.MessagingBridgeRootAutoConfiguration"); + + @Test + @DisplayName("the shipped registration file names every root this leaf publishes") + void theShippedRegistrationFileNamesEveryRoot() { + assertThat(registeredNames()) + .as("the registration lines this leaf's own jar ships") + .containsAll(PUBLISHED_ROOTS); + } + + @Test + @DisplayName("every registered name resolves to a real Boot auto-configuration") + void everyRegisteredNameResolvesToAnAutoConfiguration() { + for (String name : registeredNames()) { + Class registered; + try { + registered = + Class.forName( + name, + false, + MessagingBridgeAutoConfigurationRegistrationTest.class.getClassLoader()); + } catch (ClassNotFoundException missing) { + throw new AssertionError( + IMPORTS_RESOURCE + " registers " + name + ", which does not exist", missing); + } + assertThat(AnnotatedElementUtils.hasAnnotation(registered, AutoConfiguration.class)) + .as("%s is registered but is not annotated @AutoConfiguration", name) + .isTrue(); + } + } + + /** + * The registration lines this leaf's own resource declares. + * + *

Read from this leaf's source tree rather than from the classpath. {@code + * ClassLoader#getResources} returns every registration file on the test runtime classpath — + * Spring Boot's, springdoc's, and every dependency leaf's — so asserting over that set tests + * other people's modules and fails on their conditional classes. The file below is the one this + * leaf packages, which is the thing this contract is about. + */ + private static List registeredNames() { + Path resource = leafRoot().resolve("src/main/resources/" + IMPORTS_RESOURCE); + assertThat(Files.isRegularFile(resource)).as("%s", resource).isTrue(); + List names; + try { + names = + Files.readAllLines(resource, StandardCharsets.UTF_8).stream() + .map(String::strip) + .filter(line -> !line.isEmpty() && !line.startsWith("#")) + .toList(); + } catch (IOException failure) { + throw new UncheckedIOException("cannot read " + resource, failure); + } + assertThat(names).as("%s registers nothing", resource).isNotEmpty(); + return names; + } + + /** The nearest directory above the test's working directory that ships a registration file. */ + private static Path leafRoot() { + for (Path path = Path.of("").toAbsolutePath(); path != null; path = path.getParent()) { + if (Files.isRegularFile(path.resolve("src/main/resources/" + IMPORTS_RESOURCE))) { + return path; + } + } + throw new IllegalStateException( + "no leaf shipping " + IMPORTS_RESOURCE + " found above " + Path.of("").toAbsolutePath()); + } +} diff --git a/src/adapter/outbound/notification/CLAUDE.md b/src/adapter/outbound/notification/CLAUDE.md index 660f77ed..2a7822de 100644 --- a/src/adapter/outbound/notification/CLAUDE.md +++ b/src/adapter/outbound/notification/CLAUDE.md @@ -40,6 +40,11 @@ Package root: `dev.caskeleton.adapter.outbound.notification`. `src/config/architecture/modules.json` entry. - No inbound DTO/controller, persistence, bootstrap, or sample dependency. - Provider selection may route configured channels but must not encode business eligibility rules. +- No fully-qualified inline type references. `adapter:outbound:fileserver` already forbids these and + this leaf did not, so the same construct was a defect in one capability and ordinary style in the + next; the platform auto-configurations had accumulated twenty-two of them. A parameter written as + `dev.caskeleton.application.notification.platform.dispatch.ReconciliationJobStorePort jobs` hides + from the import block exactly the cross-leaf edge the import block exists to make readable. ## Tests diff --git a/src/adapter/outbound/notification/build.gradle b/src/adapter/outbound/notification/build.gradle index b62b1c19..226beb1f 100644 --- a/src/adapter/outbound/notification/build.gradle +++ b/src/adapter/outbound/notification/build.gradle @@ -1,6 +1,7 @@ plugins { id 'ca.spring-library' id 'ca.spring-config' + id 'ca.dependency-policy' } dependencies { diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/NotificationRoutesSettings.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/NotificationRoutesSettings.java index 55847e3c..18b75473 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/NotificationRoutesSettings.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/NotificationRoutesSettings.java @@ -11,16 +11,18 @@ import org.springframework.boot.context.properties.ConfigurationProperties; * app.notification.routes..=[,]}. * *

Mirrors {@code CacheBindingSettings}: relaxed binding maps the channel segment (e.g. {@code - * email} → {@link NotificationChannel#EMAIL}) automatically via Spring's {@code ApplicationConversionService}. - * Route values are coerced to {@code List} by the binder (comma-separated or YAML list). - * Default is an empty map so the notification template stays a non-required optional module: - * startup never fails when no routes are configured. Consistency (every referenced providerId has - * an enabled provider) is validated fail-fast by {@link RoutingNotifier} at construction time. + * email} → {@link NotificationChannel#EMAIL}) automatically via Spring's {@code + * ApplicationConversionService}. Route values are coerced to {@code List} by the binder + * (comma-separated or YAML list). Default is an empty map so the notification template stays a + * non-required optional module: startup never fails when no routes are configured. Consistency + * (every referenced providerId has an enabled provider) is validated fail-fast by {@link + * RoutingNotifier} at construction time. * * @param routes channel → (route → providerId list), default empty */ @ConfigurationProperties(prefix = "app.notification") -public record NotificationRoutesSettings(Map>> routes) { +public record NotificationRoutesSettings( + Map>> routes) { public NotificationRoutesSettings { routes = (routes == null) ? Map.of() : Map.copyOf(routes); diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/core/FailOpenNotificationProvider.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/core/FailOpenNotificationProvider.java index 4558232e..afe278cc 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/core/FailOpenNotificationProvider.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/core/FailOpenNotificationProvider.java @@ -1,8 +1,8 @@ package dev.caskeleton.adapter.outbound.notification.core; import dev.caskeleton.adapter.outbound.support.FailOpenDependencyLogger; -import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.application.notification.Notification; +import dev.caskeleton.application.notification.NotificationChannel; /** * Fail-open decorator: a provider failure is logged (no payload/PII) and swallowed so a diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/core/NotificationProvider.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/core/NotificationProvider.java index 2569c513..e0c7ddc5 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/core/NotificationProvider.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/core/NotificationProvider.java @@ -1,13 +1,14 @@ package dev.caskeleton.adapter.outbound.notification.core; -import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.application.notification.Notification; +import dev.caskeleton.application.notification.NotificationChannel; /** * SPI a forking project contributes to bind the notification template to a real provider for a - * given {@link NotificationChannel}. Each provider registers a bean of this type. {@link #providerId()} is the - * identifier referenced by {@code app.notification.routes..=[,]} values and - * must be unique within a channel. + * given {@link NotificationChannel}. Each provider registers a bean of this type. {@link + * #providerId()} is the identifier referenced by {@code + * app.notification.routes..=[,]} values and must be unique within a + * channel. */ public interface NotificationProvider { diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/core/RoutingNotifier.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/core/RoutingNotifier.java index 97fb8a3d..82cf83b9 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/core/RoutingNotifier.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/core/RoutingNotifier.java @@ -1,7 +1,7 @@ package dev.caskeleton.adapter.outbound.notification.core; -import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.application.notification.Notification; +import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.application.notification.NotificationPort; import dev.caskeleton.shared.error.AdapterDisabledException; import java.util.Collection; @@ -43,7 +43,8 @@ public final class RoutingNotifier implements NotificationPort { */ private static Map> buildRegistry( Collection providers) { - Map> registry = new EnumMap<>(NotificationChannel.class); + Map> registry = + new EnumMap<>(NotificationChannel.class); for (FailOpenNotificationProvider provider : providers) { Map byId = registry.computeIfAbsent(provider.channel(), ch -> new HashMap<>()); @@ -72,7 +73,8 @@ public final class RoutingNotifier implements NotificationPort { private static void validateRoutes( Map>> routes, Map> registry) { - for (Map.Entry>> channelEntry : routes.entrySet()) { + for (Map.Entry>> channelEntry : + routes.entrySet()) { NotificationChannel channel = channelEntry.getKey(); Map channelRegistry = registry.getOrDefault(channel, Map.of()); @@ -99,7 +101,8 @@ public final class RoutingNotifier implements NotificationPort { /** Deep, immutable copy of the routes map (channel → route → providerId list). */ private static Map>> immutableRoutesCopy( Map>> routes) { - Map>> immutable = new EnumMap<>(NotificationChannel.class); + Map>> immutable = + new EnumMap<>(NotificationChannel.class); routes.forEach( (channel, routeMap) -> { Map> copy = new HashMap<>(); diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/email/google/GoogleEmailProvider.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/email/google/GoogleEmailProvider.java index 124f2976..411ced83 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/email/google/GoogleEmailProvider.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/email/google/GoogleEmailProvider.java @@ -1,15 +1,16 @@ package dev.caskeleton.adapter.outbound.notification.email.google; import dev.caskeleton.adapter.outbound.notification.core.NotificationProvider; -import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.application.notification.Notification; +import dev.caskeleton.application.notification.NotificationChannel; /** - * Google Email contribution of the {@link NotificationProvider} SPI (channel {@link NotificationChannel#EMAIL}, - * providerId {@code "google-email"}). Delegates the raw send to the project-supplied {@link - * GoogleEmailClient} seam; the fail-open policy and PII-safe logging are applied centrally by - * {@link dev.caskeleton.adapter.outbound.notification.core.FailOpenNotificationProvider}, not here - * — so this class carries no policy and no mail SDK. + * Google Email contribution of the {@link NotificationProvider} SPI (channel {@link + * NotificationChannel#EMAIL}, providerId {@code "google-email"}). Delegates the raw send to the + * project-supplied {@link GoogleEmailClient} seam; the fail-open policy and PII-safe logging are + * applied centrally by {@link + * dev.caskeleton.adapter.outbound.notification.core.FailOpenNotificationProvider}, not here — so + * this class carries no policy and no mail SDK. * *

Adding another email provider (e.g. AWS SES) is a new sibling file with a different {@code * providerId} — this file never changes. diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformDispatchConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformDispatchConfig.java index 748cccfc..fb9ad764 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformDispatchConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformDispatchConfig.java @@ -2,6 +2,9 @@ package dev.caskeleton.adapter.outbound.notification.platform.autoconfigure; import dev.caskeleton.adapter.outbound.notification.platform.dispatch.NotificationDispatchProperties; import dev.caskeleton.adapter.outbound.notification.platform.dispatch.ProviderRuntimeRegistry; +import dev.caskeleton.application.notification.platform.admin.AdminAuthorizationGuard; +import dev.caskeleton.application.notification.platform.admin.DuplicateRiskGuard; +import dev.caskeleton.application.notification.platform.admin.ProviderRuntimeControlPort; import dev.caskeleton.application.notification.platform.callback.ProviderEventLedger; import dev.caskeleton.application.notification.platform.callback.ProviderEventProjectionService; import dev.caskeleton.application.notification.platform.dispatch.ContactPointStorePort; @@ -12,6 +15,7 @@ import dev.caskeleton.application.notification.platform.dispatch.DispatchPipelin import dev.caskeleton.application.notification.platform.dispatch.NotificationIdGeneratorPort; import dev.caskeleton.application.notification.platform.dispatch.RecipientDeliveryStorePort; import dev.caskeleton.application.notification.platform.dispatch.ReconciliationGatewayPort; +import dev.caskeleton.application.notification.platform.dispatch.ReconciliationJobStorePort; import dev.caskeleton.application.notification.platform.dispatch.ReconciliationService; import dev.caskeleton.application.notification.platform.dispatch.SyntheticEventFingerprint; import dev.caskeleton.application.notification.platform.observation.NotificationAuditPort; @@ -51,8 +55,7 @@ class NotificationPlatformDispatchConfig { * @return the control port */ @Bean - public dev.caskeleton.application.notification.platform.admin.ProviderRuntimeControlPort - providerRuntimeControl(ProviderRuntimeRegistry runtimes) { + public ProviderRuntimeControlPort providerRuntimeControl(ProviderRuntimeRegistry runtimes) { return new dev.caskeleton.adapter.outbound.notification.platform.dispatch .RegistryProviderRuntimeControl(runtimes); } @@ -63,9 +66,8 @@ class NotificationPlatformDispatchConfig { * @return the guard */ @Bean - public dev.caskeleton.application.notification.platform.admin.AdminAuthorizationGuard - adminAuthorizationGuard() { - return new dev.caskeleton.application.notification.platform.admin.AdminAuthorizationGuard(); + public AdminAuthorizationGuard adminAuthorizationGuard() { + return new AdminAuthorizationGuard(); } /** @@ -74,9 +76,8 @@ class NotificationPlatformDispatchConfig { * @return the guard */ @Bean - public dev.caskeleton.application.notification.platform.admin.DuplicateRiskGuard - duplicateRiskGuard() { - return new dev.caskeleton.application.notification.platform.admin.DuplicateRiskGuard(); + public DuplicateRiskGuard duplicateRiskGuard() { + return new DuplicateRiskGuard(); } /** Pre-provider guard chain. */ @@ -99,11 +100,9 @@ class NotificationPlatformDispatchConfig { public DispatchOutcomeRecorder dispatchOutcomeRecorder( DeliveryAttemptStorePort attempts, RecipientDeliveryStorePort recipients, - dev.caskeleton.application.notification.platform.dispatch.ReconciliationJobStorePort - reconciliationJobs, - dev.caskeleton.application.notification.platform.callback.ProviderEventLedger ledger, - dev.caskeleton.application.notification.platform.callback.ProviderEventProjectionService - projection, + ReconciliationJobStorePort reconciliationJobs, + ProviderEventLedger ledger, + ProviderEventProjectionService projection, NotificationMetricsPort metrics, NotificationDispatchProperties properties) { return new DispatchOutcomeRecorder( diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformPolicyConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformPolicyConfig.java index 7d753ea9..730baec4 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformPolicyConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformPolicyConfig.java @@ -7,6 +7,8 @@ import dev.caskeleton.application.notification.platform.dispatch.NotificationRou import dev.caskeleton.application.notification.platform.dispatch.RequestFingerprint; import dev.caskeleton.application.notification.platform.dispatch.SyntheticEventFingerprint; import dev.caskeleton.application.notification.platform.policy.CompositeNotificationEligibilityPolicy; +import dev.caskeleton.application.notification.platform.policy.DeduplicationService; +import dev.caskeleton.application.notification.platform.policy.DeduplicationStorePort; import dev.caskeleton.application.notification.platform.policy.DefaultNotificationRetryPolicy; import dev.caskeleton.application.notification.platform.policy.JitterSource; import dev.caskeleton.application.notification.platform.policy.NotificationEligibilityPolicy; @@ -136,11 +138,8 @@ class NotificationPlatformPolicyConfig { */ @Bean @ConditionalOnMissingBean - public dev.caskeleton.application.notification.platform.policy.DeduplicationService - notificationDeduplicationService( - dev.caskeleton.application.notification.platform.policy.DeduplicationStorePort store, - Clock clock) { - return new dev.caskeleton.application.notification.platform.policy.DeduplicationService( - store, clock); + public DeduplicationService notificationDeduplicationService( + DeduplicationStorePort store, Clock clock) { + return new DeduplicationService(store, clock); } } diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformProviderConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformProviderConfig.java index 4e6655e8..ee6fae7d 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformProviderConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformProviderConfig.java @@ -1,6 +1,7 @@ package dev.caskeleton.adapter.outbound.notification.platform.autoconfigure; import dev.caskeleton.adapter.outbound.notification.platform.dispatch.CapabilityReconciliationGateway; +import dev.caskeleton.adapter.outbound.notification.platform.dispatch.ConfiguredProfileCatalog; import dev.caskeleton.adapter.outbound.notification.platform.dispatch.MapTemplateRendererRegistry; import dev.caskeleton.adapter.outbound.notification.platform.dispatch.ProviderRuntimeRegistry; import dev.caskeleton.adapter.outbound.notification.platform.dispatch.RegistryProviderDispatchGateway; @@ -11,6 +12,7 @@ import dev.caskeleton.adapter.outbound.notification.platform.template.ThymeleafS import dev.caskeleton.application.notification.platform.api.routing.Channel; import dev.caskeleton.application.notification.platform.dispatch.AttachmentIntegrityGuard; import dev.caskeleton.application.notification.platform.dispatch.NotificationRoutePlannerPort; +import dev.caskeleton.application.notification.platform.dispatch.PolicyRoutePlanner; import dev.caskeleton.application.notification.platform.dispatch.ProviderDispatchGatewayPort; import dev.caskeleton.application.notification.platform.dispatch.ReconciliationGatewayPort; import dev.caskeleton.application.notification.platform.dispatch.TemplateRendererRegistry; @@ -153,8 +155,6 @@ class NotificationPlatformProviderConfig { // The adapter supplies the configured catalogue; the application decides eligibility, order and // fallback. Those decisions used to be made inside ConfiguredRoutePlanner, in the outbound // adapter, where no application test could reach them. - return new dev.caskeleton.application.notification.platform.dispatch.PolicyRoutePlanner( - new dev.caskeleton.adapter.outbound.notification.platform.dispatch.ConfiguredProfileCatalog( - platform.routes())); + return new PolicyRoutePlanner(new ConfiguredProfileCatalog(platform.routes())); } } diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformRuntimeConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformRuntimeConfig.java index 60017997..69896a30 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformRuntimeConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformRuntimeConfig.java @@ -38,7 +38,6 @@ import org.springframework.context.annotation.Import; // so a deployment with the platform on and no spring.mail.host contributes no assembler and any // profile declaring type: SMTP is refused by name at assembly rather than dispatched into // nothing. - dev.caskeleton.adapter.outbound.notification.platform.autoconfigure.NotificationSmtpProviderConfig - .class, + NotificationSmtpProviderConfig.class, }) class NotificationPlatformRuntimeConfig {} diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformWorkerConfig.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformWorkerConfig.java index b2c7174e..b27a221d 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformWorkerConfig.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformWorkerConfig.java @@ -6,9 +6,16 @@ import dev.caskeleton.adapter.outbound.notification.platform.dispatch.Notificati import dev.caskeleton.adapter.outbound.notification.platform.dispatch.NotificationSchedulerWorker; import dev.caskeleton.adapter.outbound.notification.platform.dispatch.ProviderEventReplayWorker; import dev.caskeleton.adapter.outbound.notification.platform.dispatch.ReconciliationJobWorker; +import dev.caskeleton.application.notification.platform.callback.ProviderEventLedger; +import dev.caskeleton.application.notification.platform.callback.ProviderEventProjectionService; +import dev.caskeleton.application.notification.platform.dispatch.DeliveryAttemptStorePort; import dev.caskeleton.application.notification.platform.dispatch.NotificationDispatchService; +import dev.caskeleton.application.notification.platform.dispatch.RecipientDeliveryStorePort; import dev.caskeleton.application.notification.platform.dispatch.RecipientLeaseStorePort; +import dev.caskeleton.application.notification.platform.dispatch.ReconciliationJobStorePort; +import dev.caskeleton.application.notification.platform.dispatch.ReconciliationService; import dev.caskeleton.application.notification.platform.observation.NotificationMetricsPort; +import dev.caskeleton.application.notification.platform.observation.NotificationServingStatePort; import java.util.UUID; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -55,9 +62,8 @@ class NotificationPlatformWorkerConfig { @Bean @ConditionalOnMissingBean public ReconciliationJobWorker reconciliationJobWorker( - dev.caskeleton.application.notification.platform.dispatch.ReconciliationJobStorePort jobs, - dev.caskeleton.application.notification.platform.dispatch.ReconciliationService - reconciliation, + ReconciliationJobStorePort jobs, + ReconciliationService reconciliation, java.time.Clock clock, NotificationDispatchProperties properties) { return new ReconciliationJobWorker( @@ -89,11 +95,9 @@ class NotificationPlatformWorkerConfig { @ConditionalOnMissingBean public LeaseRecoveryService notificationLeaseRecoveryService( RecipientLeaseStorePort leases, - dev.caskeleton.application.notification.platform.dispatch.DeliveryAttemptStorePort attempts, - dev.caskeleton.application.notification.platform.dispatch.RecipientDeliveryStorePort - deliveries, - dev.caskeleton.application.notification.platform.dispatch.ReconciliationService - reconciliation, + DeliveryAttemptStorePort attempts, + RecipientDeliveryStorePort deliveries, + ReconciliationService reconciliation, java.time.Clock clock, NotificationDispatchProperties properties) { return new LeaseRecoveryService( @@ -117,9 +121,8 @@ class NotificationPlatformWorkerConfig { @Bean @ConditionalOnMissingBean public ProviderEventReplayWorker notificationProviderEventReplayWorker( - dev.caskeleton.application.notification.platform.callback.ProviderEventLedger ledger, - dev.caskeleton.application.notification.platform.callback.ProviderEventProjectionService - projection, + ProviderEventLedger ledger, + ProviderEventProjectionService projection, NotificationDispatchProperties properties) { return new ProviderEventReplayWorker(ledger, projection, properties.claimBatchSize()); } @@ -192,8 +195,7 @@ class NotificationPlatformWorkerConfig { NotificationDispatchService dispatcher, NotificationMetricsPort metrics, NotificationDispatchProperties properties, - dev.caskeleton.application.notification.platform.observation.NotificationServingStatePort - servingState) { + NotificationServingStatePort servingState) { String owner = "notification-worker-1:" + UUID.randomUUID(); NotificationSchedulerWorker worker = new NotificationSchedulerWorker( diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/template/TemplateSlotPolicy.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/template/TemplateSlotPolicy.java index 8b7aa5df..fd6dce01 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/template/TemplateSlotPolicy.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/platform/template/TemplateSlotPolicy.java @@ -29,14 +29,14 @@ public final class TemplateSlotPolicy { * in a notification is followed by a person who has no way to check it. */ private static final Set ALLOWED_URI_SCHEMES = Set.of("https", "caskeleton"); + private static final Pattern HTML_NAME = Pattern.compile("[a-z][a-z0-9-]{0,31}"); private static final Set APPROVED_HTML_TAGS = Set.of( - "a", "b", "body", "br", "div", "em", "h1", "h2", "h3", "h4", "h5", "h6", "head", - "html", "i", "img", "li", "ol", "p", "span", "strong", "table", "tbody", "td", "th", - "thead", "tr", "ul"); - private static final Set APPROVED_INERT_ATTRIBUTES = - Set.of("alt", "aria-label", "title"); + "a", "b", "body", "br", "div", "em", "h1", "h2", "h3", "h4", "h5", "h6", "head", "html", + "i", "img", "li", "ol", "p", "span", "strong", "table", "tbody", "td", "th", "thead", + "tr", "ul"); + private static final Set APPROVED_INERT_ATTRIBUTES = Set.of("alt", "aria-label", "title"); private TemplateSlotPolicy() {} @@ -132,8 +132,6 @@ public final class TemplateSlotPolicy { return value; } - - /** * Validates the operator-authored HTML surrounding escaped values. * diff --git a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/slack/webhook/SlackWebhookProvider.java b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/slack/webhook/SlackWebhookProvider.java index ca54a980..5555c1b0 100644 --- a/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/slack/webhook/SlackWebhookProvider.java +++ b/src/adapter/outbound/notification/src/main/java/dev/caskeleton/adapter/outbound/notification/slack/webhook/SlackWebhookProvider.java @@ -1,8 +1,8 @@ package dev.caskeleton.adapter.outbound.notification.slack.webhook; import dev.caskeleton.adapter.outbound.notification.core.NotificationProvider; -import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.application.notification.Notification; +import dev.caskeleton.application.notification.NotificationChannel; /** * Slack incoming-webhook contribution of the {@link NotificationProvider} SPI (channel {@link diff --git a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/core/NotificationAdapterTest.java b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/core/NotificationAdapterTest.java index 77ef017d..b8ae6e7f 100644 --- a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/core/NotificationAdapterTest.java +++ b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/core/NotificationAdapterTest.java @@ -9,8 +9,8 @@ import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.read.ListAppender; import dev.caskeleton.adapter.outbound.support.FailOpenDependencyLogger; import dev.caskeleton.adapter.outbound.support.OutboundCorrelation; -import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.application.notification.Notification; +import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.shared.error.AdapterDisabledException; import java.util.List; import java.util.Map; diff --git a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/core/RoutingNotifierTest.java b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/core/RoutingNotifierTest.java index d4341925..251d45ef 100644 --- a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/core/RoutingNotifierTest.java +++ b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/core/RoutingNotifierTest.java @@ -9,8 +9,8 @@ import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.read.ListAppender; import dev.caskeleton.adapter.outbound.support.FailOpenDependencyLogger; import dev.caskeleton.adapter.outbound.support.OutboundCorrelation; -import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.application.notification.Notification; +import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.shared.error.AdapterDisabledException; import java.util.ArrayList; import java.util.List; @@ -113,7 +113,8 @@ class RoutingNotifierTest { }; } - private static NotificationProvider failingProvider(NotificationChannel channel, String providerId) { + private static NotificationProvider failingProvider( + NotificationChannel channel, String providerId) { return new NotificationProvider() { @Override public NotificationChannel channel() { @@ -243,7 +244,8 @@ class RoutingNotifierTest { new FailOpenNotificationProvider( failingProvider(NotificationChannel.EMAIL, "provider-a"), dependencyLogger), new FailOpenNotificationProvider( - countingProvider(NotificationChannel.EMAIL, "provider-b", sendB), dependencyLogger)); + countingProvider(NotificationChannel.EMAIL, "provider-b", sendB), + dependencyLogger)); Map>> routes = Map.of(NotificationChannel.EMAIL, Map.of("alerts", List.of("provider-a", "provider-b"))); diff --git a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformReachabilityTest.java b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformReachabilityTest.java index 4012233b..2250638e 100644 --- a/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformReachabilityTest.java +++ b/src/adapter/outbound/notification/src/test/java/dev/caskeleton/adapter/outbound/notification/platform/autoconfigure/NotificationPlatformReachabilityTest.java @@ -6,6 +6,7 @@ import java.util.Arrays; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.core.annotation.AnnotatedElementUtils; @@ -51,4 +52,25 @@ class NotificationPlatformReachabilityTest { assertThat(imports).isNotNull(); assertThat(imports.value()).doesNotHaveDuplicates(); } + + @Test + @DisplayName("every imported type is itself a configuration Spring will process") + void everyImportedTypeIsAConfiguration() { + // Restored after the move from the composition root, which dropped it. `@Import` accepts any + // class: a type that carries neither `@Configuration` nor `@AutoConfiguration` is imported as a + // plain bean, so its `@Bean` methods are never read and the capability it was meant to assemble + // is simply absent. Nothing fails, which is the failure mode this leaf's whole reachability + // suite exists for. + Import imports = NotificationPlatformAutoConfiguration.class.getAnnotation(Import.class); + assertThat(imports).isNotNull(); + assertThat(Arrays.asList(imports.value())) + .allSatisfy( + imported -> + assertThat( + AnnotatedElementUtils.hasAnnotation(imported, Configuration.class) + || AnnotatedElementUtils.hasAnnotation( + imported, AutoConfiguration.class)) + .as("%s is imported but is not a configuration class", imported.getName()) + .isTrue()); + } } diff --git a/src/adapter/outbound/objectstorage/build.gradle b/src/adapter/outbound/objectstorage/build.gradle index bdfd79bd..e307a618 100644 --- a/src/adapter/outbound/objectstorage/build.gradle +++ b/src/adapter/outbound/objectstorage/build.gradle @@ -2,6 +2,7 @@ plugins { id 'ca.spring-library' id 'ca.spring-config' id 'ca.auxiliary-source-set' + id 'ca.strict-qualification' } // Driven adapter: provider-neutral semantic object-storage ports plus a bounded local-development @@ -93,8 +94,8 @@ extensions.getByName('strictQualification').register( 'objectStorageAwsQualificationTest', sourceSets.objectStorageAwsQualificationTest, [ - 'dev.caskeleton.adapter.outbound.objectstorage.qualification.AwsS3DirectTransferQualificationTest', - 'dev.caskeleton.adapter.outbound.objectstorage.qualification.AwsS3ManagedCommonSubsetQualificationTest' + 'dev.caskeleton.adapter.outbound.objectstorage.qualification.AwsS3DirectMutationPreconditionsTest', + 'dev.caskeleton.adapter.outbound.objectstorage.qualification.AwsS3QualificationPreconditionsTest' ], 'Runs only with explicit protected AWS sandbox authority and exact inputs.' ) diff --git a/src/adapter/outbound/objectstorage/src/main/java/dev/caskeleton/adapter/outbound/objectstorage/direct/DirectTransferCoordinator.java b/src/adapter/outbound/objectstorage/src/main/java/dev/caskeleton/adapter/outbound/objectstorage/direct/DirectTransferCoordinator.java index 702b2599..754a76b0 100644 --- a/src/adapter/outbound/objectstorage/src/main/java/dev/caskeleton/adapter/outbound/objectstorage/direct/DirectTransferCoordinator.java +++ b/src/adapter/outbound/objectstorage/src/main/java/dev/caskeleton/adapter/outbound/objectstorage/direct/DirectTransferCoordinator.java @@ -96,8 +96,7 @@ public final class DirectTransferCoordinator policy.validateSignedGrant(material.requestUri(), current.session().expiresAt()); ObjectDirectSessionRecord issuedRecord = replace(key, current, current.session().issue(clock.instant())); - issued.put( - sessionId.canonicalText(), material, issuedRecord.session().expiresAt()); + issued.put(sessionId.canonicalText(), material, issuedRecord.session().expiresAt()); return uploadGrant(issuedRecord.session(), material); } diff --git a/src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3DirectMutationPreconditionsTest.java b/src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3DirectMutationPreconditionsTest.java new file mode 100644 index 00000000..a7d8ae9f --- /dev/null +++ b/src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3DirectMutationPreconditionsTest.java @@ -0,0 +1,40 @@ +package dev.caskeleton.adapter.outbound.objectstorage.qualification; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Map; +import org.junit.jupiter.api.Test; + +/** + * Preconditions for the protected AWS lane. **This qualifies nothing.** + * + *

The class was called {@code ...QualificationTest} and asserted that four environment variables + * were set. Nothing in it touches S3, constructs this leaf's provider, or moves a byte — so a green + * run said "somebody exported the right variables", while the name said "the AWS provider is + * qualified". Those are the two claims the review found conflated across this repository, and a + * lane that reads as the second while proving the first is the most expensive version of the + * mistake: it is the one a release decision gets made on. + * + *

Renamed rather than deleted, because the check is worth having — a protected lane that runs + * against the wrong account is worse than one that refuses to start. What it cannot do is stand in + * for a round trip, and {@code docs/registries/object-storage-readiness.yaml} agrees: no card + * claims an AWS provider, and {@code AwsQualificationClaimHonestyTest} fails if one appears while + * this lane is still the only AWS evidence there is. + */ +class AwsS3DirectMutationPreconditionsTest { + + @Test + void theDirectMutationLaneRefusesToRunWithoutItsOwnSeparateAuthority() { + Map environment = System.getenv(); + + assertThat(environment.get("OBJECT_STORAGE_AWS_QUALIFICATION_ENABLED")) + .as("protected AWS qualification authority") + .isEqualTo("true"); + assertThat(environment.get("OBJECT_STORAGE_AWS_DIRECT_MUTATION_ENABLED")) + .as("separate direct-transfer mutation authority") + .isEqualTo("true"); + assertThat(environment.get("OBJECT_STORAGE_AWS_BUCKET")).isNotBlank(); + assertThat(environment.get("OBJECT_STORAGE_AWS_REGION")).isNotBlank(); + assertThat(environment.get("OBJECT_STORAGE_AWS_EXPECTED_OWNER")).matches("[0-9]{12}"); + } +} diff --git a/src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3DirectTransferQualificationTest.java b/src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3DirectTransferQualificationTest.java deleted file mode 100644 index 40858f58..00000000 --- a/src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3DirectTransferQualificationTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package dev.caskeleton.adapter.outbound.objectstorage.qualification; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Map; -import org.junit.jupiter.api.Test; - -class AwsS3DirectTransferQualificationTest { - - @Test - void protectedDirectLaneRequiresSeparateExplicitMutationAuthority() { - Map environment = System.getenv(); - - assertThat(environment.get("OBJECT_STORAGE_AWS_QUALIFICATION_ENABLED")) - .as("protected AWS qualification authority") - .isEqualTo("true"); - assertThat(environment.get("OBJECT_STORAGE_AWS_DIRECT_MUTATION_ENABLED")) - .as("separate direct-transfer mutation authority") - .isEqualTo("true"); - assertThat(environment.get("OBJECT_STORAGE_AWS_BUCKET")).isNotBlank(); - assertThat(environment.get("OBJECT_STORAGE_AWS_REGION")).isNotBlank(); - assertThat(environment.get("OBJECT_STORAGE_AWS_EXPECTED_OWNER")).matches("[0-9]{12}"); - } -} diff --git a/src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3ManagedCommonSubsetQualificationTest.java b/src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3ManagedCommonSubsetQualificationTest.java deleted file mode 100644 index ed5ca640..00000000 --- a/src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3ManagedCommonSubsetQualificationTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package dev.caskeleton.adapter.outbound.objectstorage.qualification; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Map; -import org.junit.jupiter.api.Test; - -class AwsS3ManagedCommonSubsetQualificationTest { - - @Test - void protectedLaneRequiresExplicitAuthorityAndExactSandboxInputs() { - Map environment = System.getenv(); - - assertThat(environment.get("OBJECT_STORAGE_AWS_QUALIFICATION_ENABLED")) - .as("protected AWS qualification authority") - .isEqualTo("true"); - assertThat(environment.get("OBJECT_STORAGE_AWS_BUCKET")) - .as("exact sandbox bucket") - .isNotBlank(); - assertThat(environment.get("OBJECT_STORAGE_AWS_REGION")) - .as("exact sandbox region") - .isNotBlank(); - assertThat(environment.get("OBJECT_STORAGE_AWS_EXPECTED_OWNER")) - .as("exact expected owner") - .matches("[0-9]{12}"); - } -} diff --git a/src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3QualificationPreconditionsTest.java b/src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3QualificationPreconditionsTest.java new file mode 100644 index 00000000..77f0129b --- /dev/null +++ b/src/adapter/outbound/objectstorage/src/objectStorageAwsQualificationTest/java/dev/caskeleton/adapter/outbound/objectstorage/qualification/AwsS3QualificationPreconditionsTest.java @@ -0,0 +1,43 @@ +package dev.caskeleton.adapter.outbound.objectstorage.qualification; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Map; +import org.junit.jupiter.api.Test; + +/** + * Preconditions for the protected AWS lane. **This qualifies nothing.** + * + *

The class was called {@code ...QualificationTest} and asserted that four environment variables + * were set. Nothing in it touches S3, constructs this leaf's provider, or moves a byte — so a green + * run said "somebody exported the right variables", while the name said "the AWS provider is + * qualified". Those are the two claims the review found conflated across this repository, and a + * lane that reads as the second while proving the first is the most expensive version of the + * mistake: it is the one a release decision gets made on. + * + *

Renamed rather than deleted, because the check is worth having — a protected lane that runs + * against the wrong account is worse than one that refuses to start. What it cannot do is stand in + * for a round trip, and {@code docs/registries/object-storage-readiness.yaml} agrees: no card + * claims an AWS provider, and {@code AwsQualificationClaimHonestyTest} fails if one appears while + * this lane is still the only AWS evidence there is. + */ +class AwsS3QualificationPreconditionsTest { + + @Test + void theProtectedLaneRefusesToRunWithoutExplicitAuthorityAndExactSandboxInputs() { + Map environment = System.getenv(); + + assertThat(environment.get("OBJECT_STORAGE_AWS_QUALIFICATION_ENABLED")) + .as("protected AWS qualification authority") + .isEqualTo("true"); + assertThat(environment.get("OBJECT_STORAGE_AWS_BUCKET")) + .as("exact sandbox bucket") + .isNotBlank(); + assertThat(environment.get("OBJECT_STORAGE_AWS_REGION")) + .as("exact sandbox region") + .isNotBlank(); + assertThat(environment.get("OBJECT_STORAGE_AWS_EXPECTED_OWNER")) + .as("exact expected owner") + .matches("[0-9]{12}"); + } +} diff --git a/src/adapter/outbound/objectstorage/src/test/java/dev/caskeleton/adapter/outbound/objectstorage/readiness/AwsQualificationClaimHonestyTest.java b/src/adapter/outbound/objectstorage/src/test/java/dev/caskeleton/adapter/outbound/objectstorage/readiness/AwsQualificationClaimHonestyTest.java new file mode 100644 index 00000000..680b9fd9 --- /dev/null +++ b/src/adapter/outbound/objectstorage/src/test/java/dev/caskeleton/adapter/outbound/objectstorage/readiness/AwsQualificationClaimHonestyTest.java @@ -0,0 +1,80 @@ +package dev.caskeleton.adapter.outbound.objectstorage.readiness; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.yaml.snakeyaml.LoaderOptions; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.constructor.SafeConstructor; + +/** + * No readiness card may claim an AWS provider while the AWS lane proves only its preconditions. + * + *

This leaf ships 3,581 lines of S3 provider that no real store has ever answered. That is a + * legitimate state — the qualification needs credentials and an authorised sandbox, and neither can + * be manufactured — but it is only legitimate while nothing claims otherwise. The protected lane's + * two tests assert that four environment variables are set and stop there; until a card is backed + * by a lane that actually round-trips through this leaf's provider, the registry must stay silent + * about AWS. + * + *

So the guard is on the claim, not on the gap. The gap is honest; a card asserting R1 against + * {@code provider_type: aws-s3} on the strength of an environment-variable check would not be, and + * this is the test that has to be deleted before anyone can write one. + */ +class AwsQualificationClaimHonestyTest { + + private static final String REGISTRY = "docs/registries/object-storage-readiness.yaml"; + + @Test + @DisplayName("no readiness card claims an AWS provider") + @SuppressWarnings("unchecked") + void noCardClaimsAnAwsProvider() { + LoaderOptions options = new LoaderOptions(); + options.setAllowDuplicateKeys(false); + Object loaded = new Yaml(new SafeConstructor(options)).load(read()); + assertThat(loaded).isInstanceOf(Map.class); + + Object claims = ((Map) loaded).get("claims"); + assertThat(claims).as("%s must declare claims", REGISTRY).isInstanceOf(List.class); + + for (Object claim : (List) claims) { + assertThat(claim).isInstanceOf(Map.class); + Object providerType = ((Map) claim).get("provider_type"); + assertThat(String.valueOf(providerType)) + .as( + "card %s claims an AWS provider, but the AWS lane only checks that its sandbox " + + "environment variables are set. Back it with a lane that round-trips through " + + "this leaf's provider first, or the claim is a decision made on no evidence.", + ((Map) claim).get("card_id")) + .doesNotContain("aws") + .doesNotContain("s3"); + } + } + + private static String read() { + Path registry = repositoryRoot().resolve(REGISTRY); + assertThat(Files.isRegularFile(registry)).as("%s", registry).isTrue(); + try { + return Files.readString(registry); + } catch (IOException failure) { + throw new UncheckedIOException("cannot read " + registry, failure); + } + } + + private static Path repositoryRoot() { + for (Path path = Path.of("").toAbsolutePath(); path != null; path = path.getParent()) { + if (Files.isRegularFile(path.resolve("AGENTS.md")) + && Files.isRegularFile(path.resolve("src/settings.gradle"))) { + return path; + } + } + throw new IllegalStateException("repository root not found"); + } +} diff --git a/src/adapter/outbound/objectstorage/src/test/java/dev/caskeleton/adapter/outbound/objectstorage/s3/S3SdkApiCharacterizationTest.java b/src/adapter/outbound/objectstorage/src/test/java/dev/caskeleton/adapter/outbound/objectstorage/s3/S3SdkApiCharacterizationTest.java index 9fc3ebe5..b9fb274b 100644 --- a/src/adapter/outbound/objectstorage/src/test/java/dev/caskeleton/adapter/outbound/objectstorage/s3/S3SdkApiCharacterizationTest.java +++ b/src/adapter/outbound/objectstorage/src/test/java/dev/caskeleton/adapter/outbound/objectstorage/s3/S3SdkApiCharacterizationTest.java @@ -73,10 +73,13 @@ class S3SdkApiCharacterizationTest { CompleteMultipartUploadRequest.Builder.class, AbortMultipartUploadRequest.Builder.class); + // Named for what it does. It was called `assertThatCode`, which is also an AssertJ entry point, + // so `allSatisfy(builder -> assertThatCode(...))` read like an assertion and built no assertion + // object at all — the check is the LinkageError this raises when the method is gone. assertThat(builders) .allSatisfy( builder -> - assertThatCode(() -> builder.getMethod("expectedBucketOwner", String.class))); + requireSdkMethod(() -> builder.getMethod("expectedBucketOwner", String.class))); } @Test @@ -99,7 +102,8 @@ class S3SdkApiCharacterizationTest { S3ClientPolicy.MINIMUM_NON_FINAL_PART_BYTES - 1, false)); } - private static void assertThatCode(ThrowingCall call) { + /** Fails the test with a LinkageError when the SDK method this characterization names is gone. */ + private static void requireSdkMethod(ThrowingCall call) { try { call.run(); } catch (ReflectiveOperationException exception) { diff --git a/src/adapter/outbound/persistence-fileserver/build.gradle b/src/adapter/outbound/persistence-fileserver/build.gradle new file mode 100644 index 00000000..7c6cf1f6 --- /dev/null +++ b/src/adapter/outbound/persistence-fileserver/build.gradle @@ -0,0 +1,25 @@ +plugins { + id 'ca.spring-library' +} + +// The Fileserver capability's relational persistence. +// +// It was a package inside `adapter:outbound:persistence-jpa`, and that is why every application +// that needed a database also resolved the Fileserver use cases: the capability's six entities, its +// Spring Data repositories and its nine `@Repository` adapters were compiled into the leaf every +// deployment depends on, so `application-fileserver` came with them. +// +// The package turned out to be entirely self-contained — it imports `application.fileserver`, JPA, +// Hibernate, Spring Data and JDBC, and not one type from any other `persistence.*` package — so +// extracting it needed no seam and no new abstraction. It does not depend on `persistence-jpa` +// either: it contributes entities and repositories to whatever persistence unit the application +// already has. +dependencies { + implementation project(':application-core') + implementation project(':application-fileserver') + + implementation 'org.springframework.boot:spring-boot-autoconfigure' + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + implementation 'org.springframework:spring-jdbc' + implementation 'org.springframework:spring-context' +} diff --git a/src/adapter/outbound/persistence-fileserver/gradle.lockfile b/src/adapter/outbound/persistence-fileserver/gradle.lockfile new file mode 100644 index 00000000..4948f75b --- /dev/null +++ b/src/adapter/outbound/persistence-fileserver/gradle.lockfile @@ -0,0 +1,179 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +biz.aQute.bnd:biz.aQute.bnd.annotation:7.1.0=compileClasspath,testCompileClasspath +ch.qos.logback:logback-classic:1.5.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +ch.qos.logback:logback-core:1.5.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.21=testCompileClasspath,testRuntimeClasspath +com.fasterxml:classmate:1.7.3=runtimeClasspath,testRuntimeClasspath +com.github.ben-manes.caffeine:caffeine:3.2.4=annotationProcessor,testAnnotationProcessor +com.github.kevinstern:software-and-algorithms:1.0=annotationProcessor,testAnnotationProcessor +com.github.spotbugs:spotbugs-annotations:4.10.2=spotbugs +com.github.spotbugs:spotbugs:4.10.2=spotbugs +com.github.stephenc.jcip:jcip-annotations:1.0-1=spotbugs +com.google.auto.service:auto-service-annotations:1.0.1=annotationProcessor,testAnnotationProcessor +com.google.auto.value:auto-value-annotations:1.9=annotationProcessor,testAnnotationProcessor +com.google.auto:auto-common:1.2.2=annotationProcessor,testAnnotationProcessor +com.google.code.findbugs:jsr305:3.0.2=checkstyle,spotbugs +com.google.code.gson:gson:2.13.2=spotbugs +com.google.errorprone:error_prone_annotation:2.49.0=annotationProcessor,testAnnotationProcessor +com.google.errorprone:error_prone_annotations:2.38.0=compileClasspath,testCompileClasspath +com.google.errorprone:error_prone_annotations:2.41.0=spotbugs +com.google.errorprone:error_prone_annotations:2.47.0=checkstyle +com.google.errorprone:error_prone_annotations:2.49.0=annotationProcessor,testAnnotationProcessor +com.google.errorprone:error_prone_check_api:2.49.0=annotationProcessor,testAnnotationProcessor +com.google.errorprone:error_prone_core:2.49.0=annotationProcessor,testAnnotationProcessor +com.google.googlejavaformat:google-java-format:1.35.0=annotationProcessor,testAnnotationProcessor +com.google.guava:failureaccess:1.0.3=annotationProcessor,checkstyle,testAnnotationProcessor +com.google.guava:guava:33.5.0-jre=annotationProcessor,testAnnotationProcessor +com.google.guava:guava:33.6.0-jre=checkstyle +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,checkstyle,testAnnotationProcessor +com.google.j2objc:j2objc-annotations:3.1=annotationProcessor,checkstyle,testAnnotationProcessor +com.google.protobuf:protobuf-java:4.33.2=annotationProcessor,testAnnotationProcessor +com.h3xstream.findsecbugs:findsecbugs-plugin:1.14.0=spotbugsPlugins +com.jayway.jsonpath:json-path:2.10.0=testCompileClasspath,testRuntimeClasspath +com.puppycrawl.tools:checkstyle:13.5.0=checkstyle +com.sun.istack:istack-commons-runtime:4.1.2=runtimeClasspath,testRuntimeClasspath +com.vaadin.external.google:android-json:0.0.20131108.vaadin1=testCompileClasspath,testRuntimeClasspath +com.zaxxer:HikariCP:7.0.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +commons-beanutils:commons-beanutils:1.11.0=checkstyle +commons-collections:commons-collections:3.2.2=checkstyle +commons-io:commons-io:2.21.0=spotbugs +commons-logging:commons-logging:1.3.6=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +info.picocli:picocli:4.7.7=checkstyle +io.github.eisop:dataflow-errorprone:3.41.0-eisop1=annotationProcessor,testAnnotationProcessor +io.github.java-diff-utils:java-diff-utils:4.12=annotationProcessor,testAnnotationProcessor +io.micrometer:micrometer-commons:1.16.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.micrometer:micrometer-observation:1.16.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.activation:jakarta.activation-api:2.1.4=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.annotation:jakarta.annotation-api:3.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.inject:jakarta.inject-api:2.0.1=runtimeClasspath,testRuntimeClasspath +jakarta.persistence:jakarta.persistence-api:3.2.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.transaction:jakarta.transaction-api:2.0.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.xml.bind:jakarta.xml.bind-api:4.0.5=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.inject:javax.inject:1=annotationProcessor,testAnnotationProcessor +jaxen:jaxen:2.0.6=spotbugs +net.bytebuddy:byte-buddy-agent:1.17.8=testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy:1.17.8=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +net.minidev:accessors-smart:2.6.0=testCompileClasspath,testRuntimeClasspath +net.minidev:json-smart:2.6.0=testCompileClasspath,testRuntimeClasspath +net.sf.saxon:Saxon-HE:12.9=checkstyle,spotbugs +org.antlr:antlr4-runtime:4.13.2=checkstyle,compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.bcel:bcel:6.12.0=spotbugs +org.apache.commons:commons-lang3:3.20.0=checkstyle,spotbugs +org.apache.commons:commons-text:1.15.0=spotbugs +org.apache.commons:commons-text:1.3=checkstyle +org.apache.httpcomponents:httpclient:4.5.13=checkstyle +org.apache.httpcomponents:httpcore:4.4.16=checkstyle +org.apache.logging.log4j:log4j-api:2.25.5=compileClasspath,runtimeClasspath,spotbugs,testCompileClasspath,testRuntimeClasspath +org.apache.logging.log4j:log4j-core:2.25.5=spotbugs +org.apache.logging.log4j:log4j-to-slf4j:2.25.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.maven.doxia:doxia-core:1.12.0=checkstyle +org.apache.maven.doxia:doxia-logging-api:1.12.0=checkstyle +org.apache.maven.doxia:doxia-module-xdoc:1.12.0=checkstyle +org.apache.maven.doxia:doxia-sink-api:1.12.0=checkstyle +org.apache.tomcat.embed:tomcat-embed-core:11.0.24=testCompileClasspath,testRuntimeClasspath +org.apache.tomcat.embed:tomcat-embed-el:11.0.24=testCompileClasspath,testRuntimeClasspath +org.apache.tomcat.embed:tomcat-embed-websocket:11.0.24=testCompileClasspath,testRuntimeClasspath +org.apache.xbean:xbean-reflect:3.7=checkstyle +org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath +org.aspectj:aspectjweaver:1.9.25.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.assertj:assertj-core:3.27.7=testCompileClasspath,testRuntimeClasspath +org.awaitility:awaitility:4.3.0=testCompileClasspath,testRuntimeClasspath +org.codehaus.plexus:plexus-classworlds:2.6.0=checkstyle +org.codehaus.plexus:plexus-component-annotations:2.1.0=checkstyle +org.codehaus.plexus:plexus-container-default:2.1.0=checkstyle +org.codehaus.plexus:plexus-utils:3.3.0=checkstyle +org.dom4j:dom4j:2.2.0=spotbugs +org.eclipse.angus:angus-activation:2.0.3=runtimeClasspath,testRuntimeClasspath +org.glassfish.jaxb:jaxb-core:4.0.9=runtimeClasspath,testRuntimeClasspath +org.glassfish.jaxb:jaxb-runtime:4.0.9=runtimeClasspath,testRuntimeClasspath +org.glassfish.jaxb:txw2:4.0.9=runtimeClasspath,testRuntimeClasspath +org.hamcrest:hamcrest:3.0=testCompileClasspath,testRuntimeClasspath +org.hibernate.models:hibernate-models:1.0.1=runtimeClasspath,testRuntimeClasspath +org.hibernate.orm:hibernate-core:7.2.24.Final=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.javassist:javassist:3.28.0-GA=checkstyle +org.jboss.logging:jboss-logging:3.6.3.Final=runtimeClasspath,testRuntimeClasspath +org.jspecify:jspecify:1.0.1=annotationProcessor,checkstyle,compileClasspath,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-api:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-engine:6.0.3=testRuntimeClasspath +org.junit.jupiter:junit-jupiter-params:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-commons:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-engine:6.0.3=testRuntimeClasspath +org.junit.platform:junit-platform-launcher:6.0.3=testRuntimeClasspath +org.junit:junit-bom:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit:junit-bom:6.1.0=spotbugs +org.mockito:mockito-core:5.20.0=mockitoAgent,testCompileClasspath,testRuntimeClasspath +org.mockito:mockito-junit-jupiter:5.20.0=testCompileClasspath,testRuntimeClasspath +org.objenesis:objenesis:3.3=testRuntimeClasspath +org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testRuntimeClasspath +org.osgi:org.osgi.annotation.bundle:2.0.0=compileClasspath,testCompileClasspath +org.osgi:org.osgi.annotation.versioning:1.1.2=compileClasspath,testCompileClasspath +org.osgi:org.osgi.resource:1.0.0=compileClasspath,testCompileClasspath +org.osgi:org.osgi.service.serviceloader:1.0.0=compileClasspath,testCompileClasspath +org.ow2.asm:asm-analysis:9.10.1=spotbugs +org.ow2.asm:asm-commons:9.10.1=spotbugs +org.ow2.asm:asm-tree:9.10.1=spotbugs +org.ow2.asm:asm-util:9.10.1=spotbugs +org.ow2.asm:asm:9.10.1=spotbugs +org.ow2.asm:asm:9.7.1=testCompileClasspath,testRuntimeClasspath +org.pcollections:pcollections:4.0.1=annotationProcessor,testAnnotationProcessor +org.reflections:reflections:0.10.2=checkstyle +org.skyscreamer:jsonassert:1.5.3=testCompileClasspath,testRuntimeClasspath +org.slf4j:jul-to-slf4j:2.0.18=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:2.0.18=compileClasspath,runtimeClasspath,spotbugs,spotbugsSlf4j,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-simple:2.0.17=spotbugsSlf4j +org.slf4j:slf4j-simple:2.0.18=checkstyle +org.springframework.boot:spring-boot-autoconfigure:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-data-commons:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-data-jpa:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-hibernate:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-http-converter:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-jackson:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-jdbc:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-jpa:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-persistence:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-resttestclient:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-servlet:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-sql:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-data-jpa:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-jackson-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-jackson:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-jdbc:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-logging:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-tomcat-runtime:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-tomcat:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-webmvc-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-webmvc:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-test-autoconfigure:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-tomcat:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-transaction:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-web-server:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-webmvc-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-webmvc:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.data:spring-data-commons:4.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.data:spring-data-jpa:4.0.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-aop:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-aspects:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-beans:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-context:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-core:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-expression:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-jdbc:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-orm:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-test:7.0.9=testCompileClasspath,testRuntimeClasspath +org.springframework:spring-tx:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-web:7.0.9=testCompileClasspath,testRuntimeClasspath +org.springframework:spring-webmvc:7.0.9=testCompileClasspath,testRuntimeClasspath +org.xmlresolver:xmlresolver:5.3.3=checkstyle,spotbugs +org.xmlunit:xmlunit-core:2.10.4=testCompileClasspath,testRuntimeClasspath +org.yaml:snakeyaml:2.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +tools.jackson.core:jackson-core:3.1.5=testCompileClasspath,testRuntimeClasspath +tools.jackson.core:jackson-databind:3.1.5=testCompileClasspath,testRuntimeClasspath +tools.jackson:jackson-bom:3.1.5=testCompileClasspath,testRuntimeClasspath +empty= diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileEntityMapper.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileEntityMapper.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileEntityMapper.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileEntityMapper.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileserverJpaPersistenceConfig.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileserverJpaPersistenceConfig.java similarity index 66% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileserverJpaPersistenceConfig.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileserverJpaPersistenceConfig.java index f2b6e2dc..20a3a6a1 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileserverJpaPersistenceConfig.java +++ b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileserverJpaPersistenceConfig.java @@ -1,9 +1,9 @@ package dev.caskeleton.adapter.outbound.persistence.fileserver; +import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.persistence.autoconfigure.EntityScan; import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; /** @@ -26,14 +26,21 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories; *

The condition is the same master switch those beans use, so disabled means one thing * everywhere: no entity metadata, no repository beans, no schema expectation. * - *

{@code @ComponentScan} is here for the reason {@link - * dev.caskeleton.adapter.outbound.persistence.config.JpaAdapterComponentsConfig} exists: the nine - * {@code @Repository} adapters in this package carry the condition quoted above but were reached by - * no scan at all once the composition root stopped scanning the persistence tree, so the condition - * had nothing to decide about. {@code @EnableJpaRepositories} does not cover them — it registers - * Spring Data interfaces, and these are classes that consume those interfaces. + *

This is now the leaf's own auto-configuration root rather than an {@code @Import} of the JPA + * leaf's. It is ordered before that leaf's root because {@code @EntityScan} contributes packages to + * the persistence unit, and a contribution that arrives after the {@code EntityManagerFactory} is + * built arrives too late to be in it. + * + *

{@code @ComponentScan} is here for the reason the JPA leaf's {@code + * JpaAdapterComponentsConfig} exists: the nine {@code @Repository} adapters in this package carry + * the condition quoted above but were reached by no scan at all once the composition root stopped + * scanning the persistence tree, so the condition had nothing to decide about. + * {@code @EnableJpaRepositories} does not cover them — it registers Spring Data interfaces, and + * these are classes that consume those interfaces. */ -@Configuration(proxyBeanMethods = false) +@AutoConfiguration( + beforeName = + "dev.caskeleton.adapter.outbound.persistence.autoconfigure.PersistenceJpaAutoConfiguration") @ConditionalOnProperty(prefix = "app.fileserver-platform", name = "enabled", havingValue = "true") @EntityScan(basePackages = "dev.caskeleton.adapter.outbound.persistence.fileserver") @EnableJpaRepositories(basePackages = "dev.caskeleton.adapter.outbound.persistence.fileserver") diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileserverSchemaActivation.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileserverSchemaActivation.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileserverSchemaActivation.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/FileserverSchemaActivation.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaCleanupQueue.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaCleanupQueue.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaCleanupQueue.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaCleanupQueue.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaContentReferenceLedger.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaContentReferenceLedger.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaContentReferenceLedger.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaContentReferenceLedger.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaFileMetadataStore.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaFileMetadataStore.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaFileMetadataStore.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaFileMetadataStore.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaFileQuotaService.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaFileQuotaService.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaFileQuotaService.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaFileQuotaService.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaQuotaCommitGateway.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaQuotaCommitGateway.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaQuotaCommitGateway.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaQuotaCommitGateway.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaQuotaReclaimGateway.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaQuotaReclaimGateway.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaQuotaReclaimGateway.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaQuotaReclaimGateway.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaRecoveryQueue.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaRecoveryQueue.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaRecoveryQueue.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaRecoveryQueue.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaStagingUploadLocator.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaStagingUploadLocator.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaStagingUploadLocator.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaStagingUploadLocator.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaUploadSessionStore.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaUploadSessionStore.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaUploadSessionStore.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/JpaUploadSessionStore.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/CleanupItemEntity.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/CleanupItemEntity.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/CleanupItemEntity.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/CleanupItemEntity.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/FileEntity.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/FileEntity.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/FileEntity.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/FileEntity.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/QuotaReservationEntity.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/QuotaReservationEntity.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/QuotaReservationEntity.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/QuotaReservationEntity.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/RecoveryItemEntity.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/RecoveryItemEntity.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/RecoveryItemEntity.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/RecoveryItemEntity.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/UploadSessionEntity.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/UploadSessionEntity.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/UploadSessionEntity.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/UploadSessionEntity.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/VerificationResultEntity.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/VerificationResultEntity.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/VerificationResultEntity.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/entity/VerificationResultEntity.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileTransitionRepository.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileTransitionRepository.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileTransitionRepository.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileTransitionRepository.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverCleanupRepository.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverCleanupRepository.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverCleanupRepository.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverCleanupRepository.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverQuotaRepository.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverQuotaRepository.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverQuotaRepository.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverQuotaRepository.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverRecoveryRepository.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverRecoveryRepository.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverRecoveryRepository.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/FileserverRecoveryRepository.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/JpaFileRepository.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/JpaFileRepository.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/JpaFileRepository.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/JpaFileRepository.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/JpaUploadSessionRepository.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/JpaUploadSessionRepository.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/JpaUploadSessionRepository.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/JpaUploadSessionRepository.java diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/UploadLeaseRepository.java b/src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/UploadLeaseRepository.java similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/UploadLeaseRepository.java rename to src/adapter/outbound/persistence-fileserver/src/main/java/dev/caskeleton/adapter/outbound/persistence/fileserver/repository/UploadLeaseRepository.java diff --git a/src/adapter/outbound/persistence-fileserver/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/src/adapter/outbound/persistence-fileserver/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..575df5cb --- /dev/null +++ b/src/adapter/outbound/persistence-fileserver/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +dev.caskeleton.adapter.outbound.persistence.fileserver.FileserverJpaPersistenceConfig diff --git a/src/adapter/outbound/persistence-jpa/src/main/resources/db/migration/jpa/fileserver/V1__create_fileserver_metadata.sql b/src/adapter/outbound/persistence-fileserver/src/main/resources/db/migration/jpa/fileserver/V1__create_fileserver_metadata.sql similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/resources/db/migration/jpa/fileserver/V1__create_fileserver_metadata.sql rename to src/adapter/outbound/persistence-fileserver/src/main/resources/db/migration/jpa/fileserver/V1__create_fileserver_metadata.sql diff --git a/src/adapter/outbound/persistence-jpa/src/main/resources/db/migration/jpa/fileserver/V2__fileserver_recovery_and_staging_cleanup.sql b/src/adapter/outbound/persistence-fileserver/src/main/resources/db/migration/jpa/fileserver/V2__fileserver_recovery_and_staging_cleanup.sql similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/resources/db/migration/jpa/fileserver/V2__fileserver_recovery_and_staging_cleanup.sql rename to src/adapter/outbound/persistence-fileserver/src/main/resources/db/migration/jpa/fileserver/V2__fileserver_recovery_and_staging_cleanup.sql diff --git a/src/adapter/outbound/persistence-jpa/src/main/resources/db/migration/jpa/fileserver/V3__fileserver_fenced_cleanup_lease.sql b/src/adapter/outbound/persistence-fileserver/src/main/resources/db/migration/jpa/fileserver/V3__fileserver_fenced_cleanup_lease.sql similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/resources/db/migration/jpa/fileserver/V3__fileserver_fenced_cleanup_lease.sql rename to src/adapter/outbound/persistence-fileserver/src/main/resources/db/migration/jpa/fileserver/V3__fileserver_fenced_cleanup_lease.sql diff --git a/src/adapter/outbound/persistence-jpa/src/main/resources/db/migration/jpa/fileserver/V4__fileserver_upload_terminal_state.sql b/src/adapter/outbound/persistence-fileserver/src/main/resources/db/migration/jpa/fileserver/V4__fileserver_upload_terminal_state.sql similarity index 100% rename from src/adapter/outbound/persistence-jpa/src/main/resources/db/migration/jpa/fileserver/V4__fileserver_upload_terminal_state.sql rename to src/adapter/outbound/persistence-fileserver/src/main/resources/db/migration/jpa/fileserver/V4__fileserver_upload_terminal_state.sql diff --git a/src/adapter/outbound/persistence-jpa/build.gradle b/src/adapter/outbound/persistence-jpa/build.gradle index 2dc5b28e..d40cf578 100644 --- a/src/adapter/outbound/persistence-jpa/build.gradle +++ b/src/adapter/outbound/persistence-jpa/build.gradle @@ -5,6 +5,7 @@ plugins { id 'ca.jpa-evidence' id 'ca.jpa-test-lanes' id 'ca.auxiliary-source-set' + id 'ca.api-surface' } // Shared test code as a Gradle test-fixtures variant — ADR-BUILD-001. @@ -36,7 +37,9 @@ auxiliarySourceSets { dependencies { implementation project(':application-core') implementation project(':application-notification') - implementation project(':application-fileserver') + // No `application-fileserver`. The Fileserver capability's entities, repositories and adapters + // were a package in this leaf, and that is how every application with a database also resolved + // the Fileserver use cases. They are `adapter:outbound:persistence-fileserver` now. implementation project(':shared-contract') implementation 'org.springframework.boot:spring-boot-starter-data-jpa' @@ -74,6 +77,14 @@ dependencies { // Application-owned provider-neutral contract kit. The adapter supplies real PostgreSQL // implementations; the fixture supplies only the port semantics every implementation must obey. + // The Fileserver capability's persistence moved to its own leaf, and three of this lane's + // qualifications exercise it against real PostgreSQL. They stay here rather than following the + // code: this lane already owns the container, the Flyway wiring and the vendor fixtures, and + // duplicating that infrastructure into the new leaf for three files would add a source set for + // no isolation that does not already exist. The edge is test-scope only, so the production + // dependency graph — the thing Build Composition governs — is untouched. + postgresqlIntegrationTestImplementation project(':adapter:outbound:persistence-fileserver') + postgresqlIntegrationTestImplementation project(':application-fileserver') postgresqlIntegrationTestImplementation testFixtures(project(':application-core')) postgresqlIntegrationTestImplementation 'org.testcontainers:testcontainers-postgresql' postgresqlIntegrationTestImplementation 'org.testcontainers:testcontainers-junit-jupiter' @@ -172,5 +183,4 @@ apiSurface { // the ca.jpa-qualification plugin from build-tools, which the root applies. tasks.named('check') { dependsOn rootProject.tasks.named('verifyJpaReadinessRegistry') - dependsOn tasks.named('verifySetConfigParameterBinding') } diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfiguration.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfiguration.java index b077ff59..0460f1c2 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfiguration.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfiguration.java @@ -2,7 +2,6 @@ package dev.caskeleton.adapter.outbound.persistence.autoconfigure; import dev.caskeleton.adapter.outbound.persistence.config.JpaAdapterComponentsConfig; import dev.caskeleton.adapter.outbound.persistence.config.PersistenceVendorSettings; -import dev.caskeleton.adapter.outbound.persistence.fileserver.FileserverJpaPersistenceConfig; import dev.caskeleton.adapter.outbound.persistence.h2.H2PersistenceConfig; import dev.caskeleton.adapter.outbound.persistence.notification.configuration.NotificationJpaPersistenceFacade; import dev.caskeleton.adapter.outbound.persistence.postgresql.PostgreSqlPersistenceConfig; @@ -22,7 +21,6 @@ import org.springframework.context.annotation.Import; JpaAdapterComponentsConfig.class, PostgreSqlPersistenceConfig.class, H2PersistenceConfig.class, - FileserverJpaPersistenceConfig.class, NotificationJpaPersistenceFacade.class, PostgreSqlIdempotencyStoreConfig.class }) diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceJpaConfig.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceJpaConfig.java index 8ad3eb93..b067c335 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceJpaConfig.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceJpaConfig.java @@ -39,7 +39,6 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories; basePackages = { "dev.caskeleton.adapter.outbound.persistence.api", "dev.caskeleton.adapter.outbound.persistence.audit", - "dev.caskeleton.adapter.outbound.persistence.auditing", "dev.caskeleton.adapter.outbound.persistence.cache", "dev.caskeleton.adapter.outbound.persistence.envers", "dev.caskeleton.adapter.outbound.persistence.experimental", @@ -62,7 +61,6 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories; basePackages = { "dev.caskeleton.adapter.outbound.persistence.api", "dev.caskeleton.adapter.outbound.persistence.audit", - "dev.caskeleton.adapter.outbound.persistence.auditing", "dev.caskeleton.adapter.outbound.persistence.cache", "dev.caskeleton.adapter.outbound.persistence.envers", "dev.caskeleton.adapter.outbound.persistence.experimental", @@ -89,7 +87,8 @@ public class PersistenceJpaConfig { public static final String OPT_IN_NOTIFICATION_PACKAGE = "dev.caskeleton.adapter.outbound.persistence.notification"; - /** The other one. Its tables live only in {@code db/migration/jpa/fileserver}. */ - public static final String OPT_IN_FILESERVER_PACKAGE = - "dev.caskeleton.adapter.outbound.persistence.fileserver"; + // OPT_IN_FILESERVER_PACKAGE used to sit beside the notification one. It is gone because the + // package is: the Fileserver capability's persistence is + // `adapter:outbound:persistence-fileserver` + // now, so this leaf cannot scan it by accident and has nothing to exclude. } diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/envers/HibernateEnversHistoryReader.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/envers/HibernateEnversHistoryReader.java index 8f213fed..2e0e1320 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/envers/HibernateEnversHistoryReader.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/envers/HibernateEnversHistoryReader.java @@ -21,7 +21,8 @@ import org.hibernate.envers.query.AuditEntity; * *

Revision history is read with one Envers query that projects the entity snapshot, revision * number and revision timestamp together. Calling {@code find()} and {@code getRevisionDate()} once - * per revision turns a history page into 1+N database round trips as the entity accumulates changes. + * per revision turns a history page into 1+N database round trips as the entity accumulates + * changes. */ public final class HibernateEnversHistoryReader implements EnversHistoryReader { diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/IdempotencyReaper.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/IdempotencyReaper.java index efadc178..3461d791 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/IdempotencyReaper.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/IdempotencyReaper.java @@ -13,9 +13,7 @@ import org.springframework.transaction.annotation.Transactional; * also enforced lazily on read and on reclaim (see README "idempotency"). */ @Component -@ConditionalOnProperty( - name = "ca-skeleton.capabilities.idempotency.provider", - havingValue = "jdbc") +@ConditionalOnProperty(name = "ca-skeleton.capabilities.idempotency.provider", havingValue = "jdbc") public class IdempotencyReaper { private static final Logger log = LoggerFactory.getLogger(IdempotencyReaper.class); diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/IdempotencyStoreAdapter.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/IdempotencyStoreAdapter.java index 3a44f862..b343c689 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/IdempotencyStoreAdapter.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/idempotency/IdempotencyStoreAdapter.java @@ -26,9 +26,7 @@ import org.springframework.stereotype.Repository; * split. See README "idempotency" for the concurrency and §F rationale. */ @Repository -@ConditionalOnProperty( - name = "ca-skeleton.capabilities.idempotency.provider", - havingValue = "jdbc") +@ConditionalOnProperty(name = "ca-skeleton.capabilities.idempotency.provider", havingValue = "jdbc") public class IdempotencyStoreAdapter implements IdempotencyStorePort { /** §F threshold: payloads up to this size are stored inline in the DB row. */ diff --git a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/platform/AdminOperationResultPayloadCodec.java b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/platform/AdminOperationResultPayloadCodec.java index 0af23f9d..68442cec 100644 --- a/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/platform/AdminOperationResultPayloadCodec.java +++ b/src/adapter/outbound/persistence-jpa/src/main/java/dev/caskeleton/adapter/outbound/persistence/notification/platform/AdminOperationResultPayloadCodec.java @@ -61,8 +61,9 @@ final class AdminOperationResultPayloadCodec { final byte[] bytes; try { bytes = Base64.getUrlDecoder().decode(encoded); - } catch (IllegalArgumentException invalidBase64) { - throw new IllegalStateException("stored admin result payload is not valid Base64URL", invalidBase64); + } catch (IllegalArgumentException invalidEncoding) { + throw new IllegalStateException( + "stored admin result payload is not valid Base64URL", invalidEncoding); } try (DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes))) { @@ -73,12 +74,10 @@ final class AdminOperationResultPayloadCodec { String operationId = readString(in); boolean dryRun = in.readBoolean(); int affected = in.readInt(); - Optional notificationId = - readOptionalUuid(in).map(NotificationId::new); + Optional notificationId = readOptionalUuid(in).map(NotificationId::new); Optional recipientDeliveryId = readOptionalUuid(in).map(RecipientDeliveryId::new); - Optional newAttemptId = - readOptionalUuid(in).map(DeliveryAttemptId::new); + Optional newAttemptId = readOptionalUuid(in).map(DeliveryAttemptId::new); int reasonCount = in.readInt(); if (reasonCount < 0 || reasonCount > 1_000) { throw new IllegalStateException("stored admin result reason count is out of bounds"); diff --git a/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/liveevent/LiveEventLogContractTest.java b/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/liveevent/LiveEventLogContractTest.java index faad6503..977b9681 100644 --- a/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/liveevent/LiveEventLogContractTest.java +++ b/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/liveevent/LiveEventLogContractTest.java @@ -317,7 +317,8 @@ class LiveEventLogContractTest { private static String migration(String fileName) throws IOException { try (InputStream source = - LiveEventLogContractTest.class.getResourceAsStream("/db/migration/postgresql/" + fileName)) { + LiveEventLogContractTest.class.getResourceAsStream( + "/db/migration/postgresql/" + fileName)) { if (source == null) { throw new IllegalStateException( "the migration this store is defined by is missing from the classpath: " + fileName); diff --git a/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/notification/ProjectionFactDurabilityContractTest.java b/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/notification/ProjectionFactDurabilityContractTest.java index 18f81c77..85015255 100644 --- a/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/notification/ProjectionFactDurabilityContractTest.java +++ b/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/notification/ProjectionFactDurabilityContractTest.java @@ -268,6 +268,4 @@ class ProjectionFactDurabilityContractTest { private static List migrations() throws IOException { return NotificationFixtures.migrations(); } - - } diff --git a/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/notification/RecipientClaimContractTest.java b/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/notification/RecipientClaimContractTest.java index 5ee45923..d902ca35 100644 --- a/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/notification/RecipientClaimContractTest.java +++ b/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/notification/RecipientClaimContractTest.java @@ -317,6 +317,4 @@ class RecipientClaimContractTest { private static List migrations() throws IOException { return NotificationFixtures.migrations(); } - - } diff --git a/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/readiness/PostgreSqlNotificationSchemaManifestIntegrationTest.java b/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/readiness/PostgreSqlNotificationSchemaManifestIntegrationTest.java index bb8568f9..2f880565 100644 --- a/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/readiness/PostgreSqlNotificationSchemaManifestIntegrationTest.java +++ b/src/adapter/outbound/persistence-jpa/src/postgresqlIntegrationTest/java/dev/caskeleton/adapter/outbound/persistence/readiness/PostgreSqlNotificationSchemaManifestIntegrationTest.java @@ -2,6 +2,7 @@ package dev.caskeleton.adapter.outbound.persistence.readiness; import static org.assertj.core.api.Assertions.assertThat; +import dev.caskeleton.adapter.outbound.persistence.notification.NotificationJpaPersistenceConfig; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Table; @@ -13,7 +14,6 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.TreeMap; -import dev.caskeleton.adapter.outbound.persistence.notification.NotificationJpaPersistenceConfig; import org.flywaydb.core.Flyway; import org.hibernate.annotations.JdbcTypeCode; import org.hibernate.type.SqlTypes; @@ -40,7 +40,6 @@ import org.springframework.jdbc.core.JdbcTemplate; @Tag("jpa-migration") class PostgreSqlNotificationSchemaManifestIntegrationTest { - @Test @DisplayName("every mapped column exists in the migrated schema") void everyMappedColumnExists() throws Exception { @@ -211,7 +210,6 @@ class PostgreSqlNotificationSchemaManifestIntegrationTest { return schema; } - private static List> notificationEntities() { EntityScan scan = NotificationJpaPersistenceConfig.class.getAnnotation(EntityScan.class); if (scan == null) { @@ -232,7 +230,8 @@ class PostgreSqlNotificationSchemaManifestIntegrationTest { try { entities.add(Class.forName(className)); } catch (ClassNotFoundException missing) { - throw new IllegalStateException("scanned notification entity is not loadable: " + className, missing); + throw new IllegalStateException( + "scanned notification entity is not loadable: " + className, missing); } }); } diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/JpaModuleBoundaryTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/JpaModuleBoundaryTest.java index 3c147a59..36b06722 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/JpaModuleBoundaryTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/JpaModuleBoundaryTest.java @@ -77,7 +77,6 @@ class JpaModuleBoundaryTest { Set.of( "api", "config", - "fileserver", "h2", "hibernate", "notification", @@ -91,7 +90,6 @@ class JpaModuleBoundaryTest { Map.entry("envers", Set.of("api")), Map.entry("experimental", Set.of("api", "hibernate", "springdata", "transaction")), Map.entry("failure", Set.of("api")), - Map.entry("fileserver", Set.of("api", "failure", "springdata")), Map.entry( "h2", Set.of("api", "config", "failure", "idempotency", "outbox", "transaction")), Map.entry("hibernate", Set.of("api")), @@ -156,7 +154,6 @@ class JpaModuleBoundaryTest { "observation", "migration", "hibernate", - "fileserver", "failure", "config"); @@ -389,7 +386,8 @@ class JpaModuleBoundaryTest { } private static boolean containsJavaSource(java.nio.file.Path packageDirectory) { - try (java.util.stream.Stream files = java.nio.file.Files.walk(packageDirectory)) { + try (java.util.stream.Stream files = + java.nio.file.Files.walk(packageDirectory)) { return files.anyMatch( path -> java.nio.file.Files.isRegularFile(path) diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfigurationTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfigurationTest.java index 3ba3a97d..2346d67a 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfigurationTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/autoconfigure/PersistenceJpaAutoConfigurationTest.java @@ -4,13 +4,13 @@ import static org.assertj.core.api.Assertions.assertThat; import dev.caskeleton.adapter.outbound.persistence.config.JpaAdapterComponentsConfig; import dev.caskeleton.adapter.outbound.persistence.config.PersistenceVendorSettings; -import dev.caskeleton.adapter.outbound.persistence.fileserver.FileserverJpaPersistenceConfig; import dev.caskeleton.adapter.outbound.persistence.h2.H2PersistenceConfig; import dev.caskeleton.adapter.outbound.persistence.notification.configuration.NotificationJpaPersistenceFacade; import dev.caskeleton.adapter.outbound.persistence.postgresql.PostgreSqlPersistenceConfig; import java.io.IOException; -import java.io.InputStream; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Arrays; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfiguration; @@ -64,21 +64,38 @@ class PersistenceJpaAutoConfigurationTest { JpaAdapterComponentsConfig.class, PostgreSqlPersistenceConfig.class, H2PersistenceConfig.class, - FileserverJpaPersistenceConfig.class, + // No FileserverJpaPersistenceConfig. The Fileserver capability's persistence is its own + // leaf now and publishes its own auto-configuration, so this root importing it would be + // the coupling that put `application-fileserver` on every application's classpath. NotificationJpaPersistenceFacade.class, PostgreSqlIdempotencyStoreConfig.class); } @Test void leafJarPublishesThePackagePrivateRoot() throws IOException { - String resource = - "META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports"; - try (InputStream stream = - PersistenceJpaAutoConfigurationTest.class.getClassLoader().getResourceAsStream(resource)) { - assertThat(stream).isNotNull(); - assertThat(new String(stream.readAllBytes(), StandardCharsets.UTF_8)) - .contains(PersistenceJpaAutoConfiguration.class.getName()) - .contains(PersistenceJpaRuntimeConfig.class.getName()); + // This leaf's own file, not whichever one the class loader returns first. + // `getResourceAsStream` answers with the first match on the test runtime classpath, so this + // assertion was reading some other module's registration the moment a second leaf on the + // classpath started shipping one — and it did, when the Redis capability moved into + // `adapter:outbound:cache-redis`. Passing or failing on classpath order is not a contract. + Path resource = + leafRoot() + .resolve( + "src/main/resources/META-INF/spring/" + + "org.springframework.boot.autoconfigure.AutoConfiguration.imports"); + assertThat(Files.isRegularFile(resource)).as("%s", resource).isTrue(); + assertThat(Files.readString(resource, StandardCharsets.UTF_8)) + .contains(PersistenceJpaAutoConfiguration.class.getName()) + .contains(PersistenceJpaRuntimeConfig.class.getName()); + } + + private static Path leafRoot() { + for (Path path = Path.of("").toAbsolutePath(); path != null; path = path.getParent()) { + if ("persistence-jpa".equals(String.valueOf(path.getFileName())) + && Files.isRegularFile(path.resolve("build.gradle"))) { + return path; + } } + throw new IllegalStateException("persistence-jpa leaf root not found"); } } diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceEntityScanCoverageTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceEntityScanCoverageTest.java index 56aff86f..11c3cadf 100644 --- a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceEntityScanCoverageTest.java +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/config/PersistenceEntityScanCoverageTest.java @@ -2,7 +2,6 @@ package dev.caskeleton.adapter.outbound.persistence.config; import static org.assertj.core.api.Assertions.assertThat; -import dev.caskeleton.adapter.outbound.persistence.fileserver.FileserverJpaPersistenceConfig; import dev.caskeleton.adapter.outbound.persistence.notification.NotificationJpaPersistenceConfig; import java.io.IOException; import java.io.UncheckedIOException; @@ -46,11 +45,12 @@ class PersistenceEntityScanCoverageTest { new OptInCapability( PersistenceJpaConfig.OPT_IN_NOTIFICATION_PACKAGE, NotificationJpaPersistenceConfig.class, - "ca-skeleton.notification.platform"), - new OptInCapability( - PersistenceJpaConfig.OPT_IN_FILESERVER_PACKAGE, - FileserverJpaPersistenceConfig.class, - "app.fileserver-platform")); + "ca-skeleton.notification.platform") + // Fileserver used to be the second row. It is not an opt-in package of this leaf any + // more — it is `adapter:outbound:persistence-fileserver`, its own module, which is a + // stronger answer to the same question: a package that is not here cannot be scanned by + // accident, so there is nothing for this test to assert about it. + ); /** Sub-packages that hold no JPA entity or repository and therefore need no scan. */ private static final Set NOT_SCANNED = @@ -60,9 +60,9 @@ class PersistenceEntityScanCoverageTest { // Vendor-selection configuration only. "config", "h2", - // The opt-in capabilities, each scanned by its own gated configuration instead. - "notification", - "fileserver"); + // The opt-in capability, scanned by its own gated configuration instead. Fileserver was + // the second one and is not listed because the package is gone from this leaf entirely. + "notification"); @Test @DisplayName("every persistence sub-package is either scanned or explicitly exempt") diff --git a/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/postgresql/SetConfigParameterBindingTest.java b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/postgresql/SetConfigParameterBindingTest.java new file mode 100644 index 00000000..96616f78 --- /dev/null +++ b/src/adapter/outbound/persistence-jpa/src/test/java/dev/caskeleton/adapter/outbound/persistence/postgresql/SetConfigParameterBindingTest.java @@ -0,0 +1,100 @@ +package dev.caskeleton.adapter.outbound.persistence.postgresql; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Stream; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +/** + * Every {@code set_config('...')} this leaf issues must bind its value as a parameter. + * + *

PostgreSQL's {@code set_config} takes the value as an ordinary argument, so a concatenated + * literal is a string the database parses — a tenant identifier or an actor id that arrives with a + * quote in it changes the statement rather than the setting. The binding is what makes the value + * data. That is a property of this leaf's SQL, not of the build, so it is asserted here rather than + * by a Gradle task: the check needs no dependency resolution and no task graph, and a verifier that + * lives in an included build is one more thing a leaf's own {@code check} cannot explain. + * + *

The scan is source text on purpose. The statement is assembled as a Java string, so there is + * no bytecode signature to interrogate — the literal is the artifact, and reading it is the only + * way to see whether the value slot is a {@code ?} or a concatenation. + */ +class SetConfigParameterBindingTest { + + @Test + @DisplayName("every set_config value in this leaf binds a parameter") + void everySetConfigValueBindsAParameter() { + List violations = new ArrayList<>(); + for (Path source : productionSources()) { + List lines = readLines(source); + for (int index = 0; index < lines.size(); index++) { + String line = lines.get(index); + String trimmed = line.trim(); + if (trimmed.startsWith("//") || trimmed.startsWith("*") || trimmed.startsWith("/*")) { + continue; + } + if (line.contains("set_config('") && !line.contains("?")) { + violations.add(source + ":" + (index + 1) + ": set_config value is not parameterized"); + } + } + } + + assertThat(violations).as("non-parameterized set_config values").isEmpty(); + } + + @Test + @DisplayName("the scan actually reaches this leaf's production sources") + void theScanReachesProductionSources() { + // A source scan that walks an empty tree passes for the wrong reason. This leaf ships + // set_config statements, so both the tree and at least one subject must be present or the + // assertion above proves nothing. + assertThat(productionSources()).isNotEmpty(); + assertThat( + productionSources().stream() + .anyMatch( + path -> + readLines(path).stream().anyMatch(line -> line.contains("set_config('")))) + .as("this leaf must still contain the statements this contract governs") + .isTrue(); + } + + private static List productionSources() { + Path mainSource = leafRoot().resolve("src/main/java"); + assertThat(Files.isDirectory(mainSource)).as("%s", mainSource).isTrue(); + try (Stream paths = Files.walk(mainSource)) { + return paths + .filter(Files::isRegularFile) + .filter(path -> path.getFileName().toString().endsWith(".java")) + .sorted(Comparator.naturalOrder()) + .toList(); + } catch (IOException exception) { + throw new UncheckedIOException("cannot scan " + mainSource, exception); + } + } + + private static List readLines(Path source) { + try { + return Files.readAllLines(source); + } catch (IOException exception) { + throw new UncheckedIOException("cannot read " + source, exception); + } + } + + private static Path leafRoot() { + for (Path path = Path.of("").toAbsolutePath(); path != null; path = path.getParent()) { + if (Files.isRegularFile(path.resolve("build.gradle")) + && path.getFileName().toString().equals("persistence-jpa")) { + return path; + } + } + throw new IllegalStateException("persistence-jpa leaf root not found"); + } +} diff --git a/src/adapter/outbound/persistence-jpa/src/testFixtures/java/dev/caskeleton/adapter/outbound/persistence/testkit/arch/JpaAuditMechanismRule.java b/src/adapter/outbound/persistence-jpa/src/testFixtures/java/dev/caskeleton/adapter/outbound/persistence/testkit/arch/JpaAuditMechanismRule.java index 00610326..961bf9e9 100644 --- a/src/adapter/outbound/persistence-jpa/src/testFixtures/java/dev/caskeleton/adapter/outbound/persistence/testkit/arch/JpaAuditMechanismRule.java +++ b/src/adapter/outbound/persistence-jpa/src/testFixtures/java/dev/caskeleton/adapter/outbound/persistence/testkit/arch/JpaAuditMechanismRule.java @@ -30,6 +30,7 @@ public final class JpaAuditMechanismRule { private static final String EXPLICIT_BASE = "dev.caskeleton.adapter.outbound.persistence.audit.AuditableEntity"; + private JpaAuditMechanismRule() {} /** The rule. */ diff --git a/src/adapter/outbound/persistence-mongo/build.gradle b/src/adapter/outbound/persistence-mongo/build.gradle index c5e0b3b3..8b18224f 100644 --- a/src/adapter/outbound/persistence-mongo/build.gradle +++ b/src/adapter/outbound/persistence-mongo/build.gradle @@ -4,6 +4,7 @@ plugins { id 'java-test-fixtures' id 'ca.auxiliary-source-set' id 'ca.mongo-verification' + id 'ca.api-surface' } // Shared test code as a Gradle test-fixtures variant — ADR-BUILD-001. Applied here rather than diff --git a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/changestream/MongoChangeStreamSubscription.java b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/changestream/MongoChangeStreamSubscription.java index 2b1239de..52fc1fde 100644 --- a/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/changestream/MongoChangeStreamSubscription.java +++ b/src/adapter/outbound/persistence-mongo/src/main/java/dev/caskeleton/adapter/outbound/mongo/changestream/MongoChangeStreamSubscription.java @@ -12,8 +12,8 @@ import java.util.Objects; * indistinguishable from an idle one, so nothing ever alerts. * *

These two cursor knobs are part of the platform subscription contract for driver-level change - * stream sources. Spring Data MongoDB 5.0.7 does not expose either knob through - * {@code ChangeStreamOptions}; {@code SpringReactiveChangeStreamSource} therefore documents that + * stream sources. Spring Data MongoDB 5.0.7 does not expose either knob through {@code + * ChangeStreamOptions}; {@code SpringReactiveChangeStreamSource} therefore documents that * limitation explicitly and is not an activatable release composition. */ public record MongoChangeStreamSubscription( diff --git a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceConfigTest.java b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceConfigTest.java index d5d295ca..c4e9384a 100644 --- a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceConfigTest.java +++ b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/MongoPersistenceConfigTest.java @@ -17,7 +17,7 @@ class MongoPersistenceConfigTest { private final ApplicationContextRunner runner = new ApplicationContextRunner() .withUserConfiguration(BootAutoConfigurationApp.class, MongoPersistenceConfig.class) - .withPropertyValues("spring.data.mongodb.database=portfolio"); + .withPropertyValues("spring.mongodb.database=portfolio"); @Test void disabledByDefaultCreatesNoMongoInfrastructure() { @@ -61,7 +61,7 @@ class MongoPersistenceConfigTest { runner .withBean(MongoClient.class, () -> client) .withPropertyValues( - "ca-skeleton.persistence-mongo.enabled=true", "spring.data.mongodb.database=portfolio") + "ca-skeleton.persistence-mongo.enabled=true", "spring.mongodb.database=portfolio") .run( context -> { assertThat(context).hasNotFailed(); diff --git a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoReactiveWiringTest.java b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoReactiveWiringTest.java index 0875a756..00cd5310 100644 --- a/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoReactiveWiringTest.java +++ b/src/adapter/outbound/persistence-mongo/src/test/java/dev/caskeleton/adapter/outbound/mongo/autoconfigure/MongoReactiveWiringTest.java @@ -55,8 +55,7 @@ class MongoReactiveWiringTest { private static ReactiveMongoTemplate template() { return new ReactiveMongoTemplate( new org.springframework.data.mongodb.core.SimpleReactiveMongoDatabaseFactory( - mock(com.mongodb.reactivestreams.client.MongoClient.class), - "wiring-test")); + mock(com.mongodb.reactivestreams.client.MongoClient.class), "wiring-test")); } @Test diff --git a/src/adapter/outbound/redis-runtime/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/connection/RedisTopologyClientFactory.java b/src/adapter/outbound/redis-runtime/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/connection/RedisTopologyClientFactory.java index d4d23ae9..39f0f964 100644 --- a/src/adapter/outbound/redis-runtime/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/connection/RedisTopologyClientFactory.java +++ b/src/adapter/outbound/redis-runtime/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/connection/RedisTopologyClientFactory.java @@ -36,6 +36,8 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; /** * Builds the clients the configured topology and the configured accounts call for. @@ -119,27 +121,37 @@ public final class RedisTopologyClientFactory { * @return the runtime client */ public RedisRuntimeClient create() { + // One event-loop group for every account, not one per account. `ClientResources` carries + // `max(2, cores)` IO threads plus a computation pool and a timer; a deployment with an + // application, an advanced and a pub/sub account used to get three of each, so an eight-core + // pod ran twenty-four IO threads to talk to one Redis. The accounts differ in who they + // authenticate as, which is a property of the connection, not of the threads that carry it. + SharedClientResources shared = new SharedClientResources(resources()); Map byRole = new EnumMap<>(RedisCredentialRole.class); - RedisRuntimeClient application = - clientFor(Optional.ofNullable(credentials.get(RedisCredentialRole.APPLICATION))); - byRole.put(RedisCredentialRole.APPLICATION, application); List created = new ArrayList<>(); - created.add(application); try { + RedisRuntimeClient application = + clientFor(Optional.ofNullable(credentials.get(RedisCredentialRole.APPLICATION)), shared); + byRole.put(RedisCredentialRole.APPLICATION, application); + created.add(application); for (RedisCredentialRole role : RedisCredentialRole.values()) { if (role == RedisCredentialRole.APPLICATION || !credentials.containsKey(role)) { continue; } - RedisRuntimeClient client = clientFor(Optional.of(credentials.get(role))); + RedisRuntimeClient client = clientFor(Optional.of(credentials.get(role)), shared); created.add(client); byRole.put(role, client); } } catch (RuntimeException failure) { - // A half-built set would leak the event loops of the clients that did get created. + // A half-built set would leak the event loops of the clients that did get created. Closing + // them releases their hold on the shared resources; the group itself goes with the last one. created.forEach(RedisTopologyClientFactory::closeQuietly); + shared.shutdownAfterFailedBuild(shutdown()); throw failure; } - return byRole.size() == 1 ? application : new RoleRoutingRuntimeClient(byRole); + return byRole.size() == 1 + ? byRole.get(RedisCredentialRole.APPLICATION) + : new RoleRoutingRuntimeClient(byRole); } private static void closeQuietly(RedisRuntimeClient client) { @@ -150,15 +162,17 @@ public final class RedisTopologyClientFactory { } } - private RedisRuntimeClient clientFor(Optional account) { + private RedisRuntimeClient clientFor( + Optional account, SharedClientResources shared) { return switch (settings.getMode()) { - case STANDALONE -> standalone(account); - case SENTINEL -> sentinel(account); - case CLUSTER -> cluster(account); + case STANDALONE -> standalone(account, shared); + case SENTINEL -> sentinel(account, shared); + case CLUSTER -> cluster(account, shared); }; } - private RedisRuntimeClient standalone(Optional account) { + private RedisRuntimeClient standalone( + Optional account, SharedClientResources shared) { List nodes = endpoints(settings.getNodes(), account); if (nodes.size() != 1) { // Several addresses without a topology to resolve them is ambiguous: the client would pick @@ -168,14 +182,13 @@ public final class RedisTopologyClientFactory { + nodes.size() + " were configured. Use mode=sentinel or mode=cluster to address several servers."); } - ClientResources resources = resources(); - RedisClient client = RedisClient.create(resources, nodes.get(0)); + RedisClient client = RedisClient.create(shared.acquire(), nodes.get(0)); client.setOptions(clientOptions()); - return new StandaloneRuntimeClient( - client, resources, shutdown(), RedisDeploymentMode.STANDALONE); + return new StandaloneRuntimeClient(client, shared, shutdown(), RedisDeploymentMode.STANDALONE); } - private RedisRuntimeClient sentinel(Optional account) { + private RedisRuntimeClient sentinel( + Optional account, SharedClientResources shared) { RedisURI.Builder builder = null; for (RedisURI node : endpoints(sentinelNodes(), Optional.empty())) { if (builder == null) { @@ -198,16 +211,15 @@ public final class RedisTopologyClientFactory { uri.setTimeout(settings.getLifecycle().getConnectTimeout()); uri.setSsl(settings.getTls().isEnabled()); uri.setVerifyPeer(settings.getTls().isHostnameVerification()); - ClientResources resources = resources(); - RedisClient client = RedisClient.create(resources, uri); + RedisClient client = RedisClient.create(shared.acquire(), uri); client.setOptions(clientOptions()); - return new StandaloneRuntimeClient(client, resources, shutdown(), RedisDeploymentMode.SENTINEL); + return new StandaloneRuntimeClient(client, shared, shutdown(), RedisDeploymentMode.SENTINEL); } - private RedisRuntimeClient cluster(Optional account) { - ClientResources resources = resources(); + private RedisRuntimeClient cluster( + Optional account, SharedClientResources shared) { RedisClusterClient client = - RedisClusterClient.create(resources, endpoints(settings.getNodes(), account)); + RedisClusterClient.create(shared.acquire(), endpoints(settings.getNodes(), account)); ClusterTopologyRefreshOptions refresh = ClusterTopologyRefreshOptions.builder() .enablePeriodicRefresh(settings.getCluster().getTopologyRefreshPeriod()) @@ -222,7 +234,7 @@ public final class RedisTopologyClientFactory { .topologyRefreshOptions(refresh) .validateClusterNodeMembership(true) .build()); - return new ClusterRuntimeClient(client, resources, shutdown()); + return new ClusterRuntimeClient(client, shared, shutdown()); } private List sentinelNodes() { @@ -358,18 +370,71 @@ public final class RedisTopologyClientFactory { return () -> tlsMaterial.open(location); } + /** + * One {@link ClientResources} shared by every account, stopped by the last client to let go. + * + *

Lettuce treats whoever passes resources to {@code RedisClient.create} as their owner and + * {@code client.shutdown()} deliberately leaves them running, so somebody has to stop them. With + * one group per account that owner was obvious and wasteful; with one group for all of them the + * ownership is shared, and a hold count is the smallest thing that still guarantees the loops are + * stopped exactly once, after the last client that was using them. + */ + private static final class SharedClientResources { + + private final ClientResources resources; + private final AtomicInteger holds = new AtomicInteger(); + private final AtomicBoolean stopped = new AtomicBoolean(); + + private SharedClientResources(ClientResources resources) { + this.resources = resources; + } + + /** Takes a hold and returns the group to hand to a driver client. */ + private ClientResources acquire() { + holds.incrementAndGet(); + return resources; + } + + /** Releases one hold, stopping the loops when it was the last one. */ + private void release(ShutdownBudget shutdown) { + if (holds.decrementAndGet() == 0) { + stop(shutdown); + } + } + + /** + * Stops the loops after a build that did not finish. + * + *

Unconditional, not "when nothing holds it": a hold is taken before the driver client that + * would release it exists, so a failure between those two points leaves a hold nobody can give + * back. {@link #stop} is idempotent, so the clients that were built and closed normally having + * already stopped the group costs nothing here. + */ + private void shutdownAfterFailedBuild(ShutdownBudget shutdown) { + stop(shutdown); + } + + private void stop(ShutdownBudget shutdown) { + if (stopped.compareAndSet(false, true)) { + shutdown.await( + resources.shutdown( + shutdown.quietPeriod().toMillis(), shutdown.timeout().toMillis(), MILLISECONDS)); + } + } + } + /** Standalone and Sentinel share a client type; only how the URI resolves differs. */ private static final class StandaloneRuntimeClient implements RedisRuntimeClient { private final RedisClient client; - private final ClientResources resources; + private final SharedClientResources resources; private final RedisDeploymentMode mode; private final ShutdownBudget shutdown; private StandaloneRuntimeClient( RedisClient client, - ClientResources resources, + SharedClientResources resources, ShutdownBudget shutdown, RedisDeploymentMode mode) { this.client = client; @@ -399,10 +464,9 @@ public final class RedisTopologyClientFactory { } finally { // After the client, never before: the resources are the threads the shutdown runs on. And // awaited, not fired — shutdown() returns a future, so ignoring it means returning while - // the event loop is still running and reporting a clean stop that has not happened. - shutdown.await( - resources.shutdown( - shutdown.quietPeriod().toMillis(), shutdown.timeout().toMillis(), MILLISECONDS)); + // the event loop is still running and reporting a clean stop that has not happened. The + // group is shared across accounts, so only the last client to release actually stops it. + resources.release(shutdown); } } } @@ -411,12 +475,12 @@ public final class RedisTopologyClientFactory { private static final class ClusterRuntimeClient implements RedisRuntimeClient { private final RedisClusterClient client; - private final ClientResources resources; + private final SharedClientResources resources; private final ShutdownBudget shutdown; private ClusterRuntimeClient( - RedisClusterClient client, ClientResources resources, ShutdownBudget shutdown) { + RedisClusterClient client, SharedClientResources resources, ShutdownBudget shutdown) { this.client = client; this.resources = resources; this.shutdown = shutdown; @@ -472,9 +536,7 @@ public final class RedisTopologyClientFactory { client.shutdown( shutdown.quietPeriod().toMillis(), shutdown.timeout().toMillis(), MILLISECONDS); } finally { - shutdown.await( - resources.shutdown( - shutdown.quietPeriod().toMillis(), shutdown.timeout().toMillis(), MILLISECONDS)); + resources.release(shutdown); } } } diff --git a/src/adapter/outbound/redis-runtime/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/config/RedisSdkAutoConfigurationRegistrationTest.java b/src/adapter/outbound/redis-runtime/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/config/RedisSdkAutoConfigurationRegistrationTest.java new file mode 100644 index 00000000..84a3fd07 --- /dev/null +++ b/src/adapter/outbound/redis-runtime/src/test/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/config/RedisSdkAutoConfigurationRegistrationTest.java @@ -0,0 +1,102 @@ +package dev.caskeleton.adapter.outbound.cache.redis.sdk.config; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.core.annotation.AnnotatedElementUtils; + +/** + * This leaf's auto-configurations are registered, not merely annotated. + * + *

Spring Boot needs two independent things before an auto-configuration runs: the annotation on + * the class, and a line naming it in {@code META-INF/spring/...AutoConfiguration.imports}. Tests + * that build a context with {@code AutoConfigurations.of(...)} supply the second one themselves, so + * they stay green for a capability that is present in no running application — which is exactly how + * several capabilities in this repository came to be assembled by nothing. + * + *

So this reads the registration file the jar actually ships and asserts both directions: every + * class this leaf means to register is named in it, and every name in it resolves to a class that + * carries {@code @AutoConfiguration}. A rename, a move or a deleted line fails here rather than in + * a deployment that starts and quietly does less than it says. + */ +class RedisSdkAutoConfigurationRegistrationTest { + + private static final String IMPORTS_RESOURCE = + "META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports"; + + /** The auto-configurations this leaf publishes. */ + private static final List PUBLISHED_ROOTS = + List.of("dev.caskeleton.adapter.outbound.cache.redis.sdk.config.RedisSdkAutoConfiguration"); + + @Test + @DisplayName("the shipped registration file names every root this leaf publishes") + void theShippedRegistrationFileNamesEveryRoot() { + assertThat(registeredNames()) + .as("the registration lines this leaf's own jar ships") + .containsAll(PUBLISHED_ROOTS); + } + + @Test + @DisplayName("every registered name resolves to a real Boot auto-configuration") + void everyRegisteredNameResolvesToAnAutoConfiguration() { + for (String name : registeredNames()) { + Class registered; + try { + registered = + Class.forName( + name, false, RedisSdkAutoConfigurationRegistrationTest.class.getClassLoader()); + } catch (ClassNotFoundException missing) { + throw new AssertionError( + IMPORTS_RESOURCE + " registers " + name + ", which does not exist", missing); + } + assertThat(AnnotatedElementUtils.hasAnnotation(registered, AutoConfiguration.class)) + .as("%s is registered but is not annotated @AutoConfiguration", name) + .isTrue(); + } + } + + /** + * The registration lines this leaf's own resource declares. + * + *

Read from this leaf's source tree rather than from the classpath. {@code + * ClassLoader#getResources} returns every registration file on the test runtime classpath — + * Spring Boot's, springdoc's, and every dependency leaf's — so asserting over that set tests + * other people's modules and fails on their conditional classes. The file below is the one this + * leaf packages, which is the thing this contract is about. + */ + private static List registeredNames() { + Path resource = leafRoot().resolve("src/main/resources/" + IMPORTS_RESOURCE); + assertThat(Files.isRegularFile(resource)).as("%s", resource).isTrue(); + List names; + try { + names = + Files.readAllLines(resource, StandardCharsets.UTF_8).stream() + .map(String::strip) + .filter(line -> !line.isEmpty() && !line.startsWith("#")) + .toList(); + } catch (IOException failure) { + throw new UncheckedIOException("cannot read " + resource, failure); + } + assertThat(names).as("%s registers nothing", resource).isNotEmpty(); + return names; + } + + /** The nearest directory above the test's working directory that ships a registration file. */ + private static Path leafRoot() { + for (Path path = Path.of("").toAbsolutePath(); path != null; path = path.getParent()) { + if (Files.isRegularFile(path.resolve("src/main/resources/" + IMPORTS_RESOURCE))) { + return path; + } + } + throw new IllegalStateException( + "no leaf shipping " + IMPORTS_RESOURCE + " found above " + Path.of("").toAbsolutePath()); + } +} diff --git a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/admin/LettuceRedisAdminOperations.java b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/admin/LettuceRedisAdminOperations.java index eef5784a..cd162503 100644 --- a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/admin/LettuceRedisAdminOperations.java +++ b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/admin/LettuceRedisAdminOperations.java @@ -13,6 +13,7 @@ import dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.operations.RedisO import java.nio.charset.StandardCharsets; import java.time.Duration; import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -109,7 +110,10 @@ public final class LettuceRedisAdminOperations implements RedisAdminOperations { new SlowLogEntry( (Long) row.get(0), Instant.ofEpochSecond((Long) row.get(1)), - Duration.ofNanos(Duration.ofMillis((Long) row.get(2)).toNanos() / 1_000L), + // SLOWLOG reports microseconds. Said in the unit it is, rather than as milliseconds + // converted to nanoseconds and divided by a thousand — which computed the same value + // and read like a bug. + Duration.of((Long) row.get(2), ChronoUnit.MICROS), family(nested(row.get(3))))); } return List.copyOf(entries); diff --git a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/extensions/search/SearchQuery.java b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/extensions/search/SearchQuery.java index e29dcb12..705de3df 100644 --- a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/extensions/search/SearchQuery.java +++ b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/extensions/search/SearchQuery.java @@ -17,6 +17,11 @@ import java.util.Objects; */ public record SearchQuery(String expression, int offset, int count, Duration timeout) { + /** + * The longest expression this SDK will send; long enough for a written query, short of a payload. + */ + private static final int MAXIMUM_EXPRESSION_LENGTH = 4_096; + /** Canonical constructor. */ public SearchQuery { Objects.requireNonNull(expression, "query expression must be non-null"); @@ -24,6 +29,29 @@ public record SearchQuery(String expression, int offset, int count, Duration tim if (expression.isBlank()) { throw new IllegalArgumentException("a search needs a query expression"); } + // The expression is sent as one RESP argument, so it cannot become another command however it + // is spelled — argument framing is length-prefixed, not delimiter-separated. What it can still + // be is unbounded or unprintable: a caller-built expression that grows with user input becomes + // a request whose size nobody declared, and a control character in it is a caller bug that + // reaches the server as a query the operator cannot read back in SLOWLOG. Both are rejected + // here, where the value is constructed, rather than at the call that sends it. + if (expression.length() > MAXIMUM_EXPRESSION_LENGTH) { + throw new IllegalArgumentException( + "a search expression must be at most " + + MAXIMUM_EXPRESSION_LENGTH + + " characters, but was " + + expression.length()); + } + for (int index = 0; index < expression.length(); index++) { + char character = expression.charAt(index); + if (Character.isISOControl(character)) { + throw new IllegalArgumentException( + "a search expression must not contain control characters, but held U+" + + String.format("%04X", (int) character) + + " at " + + index); + } + } if (offset < 0) { throw new IllegalArgumentException("a search offset must not be negative"); } diff --git a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceReactiveRedisPubSubOperations.java b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceReactiveRedisPubSubOperations.java index 92bab6ed..c4861b86 100644 --- a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceReactiveRedisPubSubOperations.java +++ b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceReactiveRedisPubSubOperations.java @@ -1,11 +1,14 @@ package dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.operations; +import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.codec.RedisCodec; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.operations.PubSubChannel; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.operations.PubSubPattern; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.reactive.ReactiveRedisPubSubOperations; import dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.command.ReactiveRedisCommandExecutor; import java.util.Collection; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -48,16 +51,26 @@ public final class LettuceReactiveRedisPubSubOperations implements ReactiveRedis @Override public Flux subscribe(Collection> channels) { List targets = requests.channelTargets(channels); - PubSubChannel first = channels.iterator().next(); - return SubscriptionFlux.create( - gateway, targets, RedisPubSubGateway.SubscriptionKind.CHANNEL, first.messageCodec()); + // One codec per channel, not the first channel's codec for all of them — the same rule the + // blocking subscription already enforces. Until this matched, a two-channel subscription + // decoded correctly through RedisPubSubOperations and silently reinterpreted the second + // channel's payload under the first channel's schema through this one. + Map> codecsByChannel = new HashMap<>(); + for (PubSubChannel channel : channels) { + codecsByChannel.put(channel.render(), channel.messageCodec()); + } + return SubscriptionFlux.createPerChannel( + gateway, targets, RedisPubSubGateway.SubscriptionKind.CHANNEL, codecsByChannel); } @Override public Flux patternSubscribe(Collection> patterns) { List targets = requests.patternTargets(patterns); - PubSubPattern first = patterns.iterator().next(); + // A matched message carries its concrete channel, not the pattern that matched it, so there is + // no key to look a per-pattern codec up by. Mixed codecs are refused rather than guessed, which + // is what the blocking pattern subscription already does. + RedisCodec codec = PubSubCodecs.singlePatternCodec(patterns); return SubscriptionFlux.create( - gateway, targets, RedisPubSubGateway.SubscriptionKind.PATTERN, first.messageCodec()); + gateway, targets, RedisPubSubGateway.SubscriptionKind.PATTERN, codec); } } diff --git a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceReactiveRedisShardedPubSubOperations.java b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceReactiveRedisShardedPubSubOperations.java index fef67410..c6953a96 100644 --- a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceReactiveRedisShardedPubSubOperations.java +++ b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceReactiveRedisShardedPubSubOperations.java @@ -2,11 +2,14 @@ package dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.operations; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.RedisCapabilities; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.RedisCapability; +import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.codec.RedisCodec; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.operations.ShardedPubSubChannel; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.reactive.ReactiveRedisShardedPubSubOperations; import dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.command.ReactiveRedisCommandExecutor; import java.util.Collection; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.Optional; import reactor.core.publisher.Flux; @@ -60,8 +63,14 @@ public final class LettuceReactiveRedisShardedPubSubOperations @Override public Flux subscribe(Collection> channels) { List targets = requests.shardTargets(channels); - ShardedPubSubChannel first = channels.iterator().next(); - return SubscriptionFlux.create( - gateway, targets, RedisPubSubGateway.SubscriptionKind.SHARD, first.messageCodec()); + // One codec per channel, for the same reason as every other channel subscription here: the + // first channel's codec applied to all of them reinterprets the other channels' payloads under + // the wrong schema, and does it silently whenever the framings happen to be compatible. + Map> codecsByChannel = new HashMap<>(); + for (ShardedPubSubChannel channel : channels) { + codecsByChannel.put(channel.render(), channel.messageCodec()); + } + return SubscriptionFlux.createPerChannel( + gateway, targets, RedisPubSubGateway.SubscriptionKind.SHARD, codecsByChannel); } } diff --git a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceRedisPubSubOperations.java b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceRedisPubSubOperations.java index b067509e..2bb90938 100644 --- a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceRedisPubSubOperations.java +++ b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceRedisPubSubOperations.java @@ -90,27 +90,11 @@ public final class LettuceRedisPubSubOperations implements RedisPubSubOperations // matched it, so there is no key to look a per-pattern codec up by. Rather than pick one and // hope, the patterns are required to agree on their codec; mixing schemas across patterns is a // decode the SDK cannot perform correctly and so refuses to attempt. - RedisCodec codec = singleCodec(patterns); + RedisCodec codec = PubSubCodecs.singlePatternCodec(patterns); return LiveSubscription.start( gateway, targets, RedisPubSubGateway.SubscriptionKind.PATTERN, (channel, payload) -> handler.onMessage(channel, codec.decode(payload))); } - - private static RedisCodec singleCodec(Collection> patterns) { - RedisCodec codec = patterns.iterator().next().messageCodec(); - for (PubSubPattern pattern : patterns) { - if (!pattern.messageCodec().id().equals(codec.id())) { - throw new IllegalArgumentException( - "a pattern subscription must use one codec for every pattern, but found '" - + codec.id() - + "' and '" - + pattern.messageCodec().id() - + "'; a matched message carries its channel, not its pattern, so the SDK cannot" - + " tell which codec applies. Subscribe once per codec instead."); - } - } - return codec; - } } diff --git a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceRedisShardedPubSubOperations.java b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceRedisShardedPubSubOperations.java index dea4045e..47f7797b 100644 --- a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceRedisShardedPubSubOperations.java +++ b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/LettuceRedisShardedPubSubOperations.java @@ -2,13 +2,16 @@ package dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.operations; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.RedisCapabilities; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.RedisCapability; +import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.codec.RedisCodec; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.operations.RedisMessageHandler; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.operations.RedisShardedPubSubOperations; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.operations.ShardedPubSubChannel; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.operations.Subscription; import dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.command.SyncRedisCommandExecutor; import java.util.Collection; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.Optional; @@ -67,11 +70,29 @@ public final class LettuceRedisShardedPubSubOperations implements RedisShardedPu Collection> channels, RedisMessageHandler handler) { Objects.requireNonNull(handler, "handler must be non-null"); List targets = requests.shardTargets(channels); - ShardedPubSubChannel first = channels.iterator().next(); + // One codec per channel, not the first channel's codec for all of them. The blocking channel + // subscription fixed this and this one did not, so the same two-channel subscription decoded + // correctly on one API and silently reinterpreted the second channel's payload under the first + // channel's schema on the other — whenever the two framings happened to be compatible. + Map> codecsByChannel = new HashMap<>(); + for (ShardedPubSubChannel channel : channels) { + codecsByChannel.put(channel.render(), channel.messageCodec()); + } return LiveSubscription.start( gateway, targets, RedisPubSubGateway.SubscriptionKind.SHARD, - (channel, payload) -> handler.onMessage(channel, first.messageCodec().decode(payload))); + (channel, payload) -> { + RedisCodec codec = codecsByChannel.get(channel); + if (codec == null) { + // The server delivered a channel this subscription never asked for. Guessing a codec + // here is how a mis-routed message becomes a decoded object. + throw new IllegalStateException( + "received a message for shard channel '" + + channel + + "' which this subscription did not subscribe to"); + } + handler.onMessage(channel, codec.decode(payload)); + }); } } diff --git a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/PubSubCodecs.java b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/PubSubCodecs.java new file mode 100644 index 00000000..6cd8bbba --- /dev/null +++ b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/PubSubCodecs.java @@ -0,0 +1,43 @@ +package dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.operations; + +import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.codec.RedisCodec; +import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.operations.PubSubPattern; +import java.util.Collection; + +/** + * Codec selection rules shared by the blocking and reactive pub/sub surfaces. + * + *

The two surfaces used to answer "which codec decodes this message" differently — the blocking + * one per channel, the reactive one with whichever channel happened to be first — so the same + * two-channel subscription was correct through one API and silently wrong through the other. The + * rules live here so that difference cannot reappear one implementation at a time. + */ +final class PubSubCodecs { + + private PubSubCodecs() {} + + /** + * Returns the one codec every pattern in a pattern subscription agrees on. + * + *

A matched message arrives with its concrete channel name rather than the pattern that + * matched it, so there is no key to look a per-pattern codec up by. Mixing schemas across + * patterns is a decode the SDK cannot perform correctly, so it refuses rather than picking one. + * + * @throws IllegalArgumentException when the patterns do not agree on a codec + */ + static RedisCodec singlePatternCodec(Collection> patterns) { + RedisCodec codec = patterns.iterator().next().messageCodec(); + for (PubSubPattern pattern : patterns) { + if (!pattern.messageCodec().id().equals(codec.id())) { + throw new IllegalArgumentException( + "a pattern subscription must use one codec for every pattern, but found '" + + codec.id() + + "' and '" + + pattern.messageCodec().id() + + "'; a matched message carries its channel, not its pattern, so the SDK cannot" + + " tell which codec applies. Subscribe once per codec instead."); + } + } + return codec; + } +} diff --git a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/SubscriptionFlux.java b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/SubscriptionFlux.java index 44ab9084..082a8986 100644 --- a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/SubscriptionFlux.java +++ b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/SubscriptionFlux.java @@ -2,6 +2,7 @@ package dev.caskeleton.adapter.outbound.cache.redis.sdk.lettuce.operations; import dev.caskeleton.adapter.outbound.cache.redis.sdk.api.codec.RedisCodec; import java.util.List; +import java.util.Map; import java.util.Objects; import reactor.core.publisher.Flux; import reactor.core.publisher.FluxSink; @@ -42,6 +43,55 @@ final class SubscriptionFlux { return create(gateway, targets, kind, codec, DEFAULT_BUFFER_CAPACITY, OverflowPolicy.ERROR); } + /** + * Creates a channel subscription that decodes each message with the codec its own channel + * declared. + * + *

A subscription that mixes channels used to decode every message with whichever codec + * happened to be first, so the payloads of the other channels were reinterpreted under the wrong + * schema — silently, when the framings happened to be compatible. The blocking API fixed that and + * the reactive one did not, which made correctness depend on which API surface the caller picked. + */ + static Flux createPerChannel( + RedisPubSubGateway gateway, + List targets, + RedisPubSubGateway.SubscriptionKind kind, + Map> codecsByChannel) { + Objects.requireNonNull(gateway, "gateway must be non-null"); + Objects.requireNonNull(targets, "targets must be non-null"); + Objects.requireNonNull(kind, "subscription kind must be non-null"); + Objects.requireNonNull(codecsByChannel, "codecs must be non-null"); + Map> codecs = Map.copyOf(codecsByChannel); + return Flux.create( + sink -> { + RedisPubSubGateway.RedisSubscriptionHandle handle = + gateway.subscribe( + targets, + kind, + (channel, payload) -> { + try { + RedisCodec codec = codecs.get(channel); + if (codec == null) { + // The server delivered a channel this subscription never asked for. + // Guessing a codec here is how a mis-routed message becomes a decoded + // object. + throw new IllegalStateException( + "received a message for channel '" + + channel + + "' which this subscription did not subscribe to"); + } + sink.next(codec.decode(payload)); + } catch (RuntimeException failure) { + // Terminating disposes the sink, which closes the handle below. + sink.error(failure); + } + }); + sink.onDispose(handle::close); + }, + OverflowPolicy.ERROR.strategy()) + .onBackpressureBuffer(DEFAULT_BUFFER_CAPACITY, OverflowPolicy.ERROR.bufferStrategy()); + } + static Flux create( RedisPubSubGateway gateway, List targets, diff --git a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/ValueOperationRequests.java b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/ValueOperationRequests.java index e5716c23..5c8fbb2f 100644 --- a/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/ValueOperationRequests.java +++ b/src/adapter/outbound/redis-sdk/src/main/java/dev/caskeleton/adapter/outbound/cache/redis/sdk/lettuce/operations/ValueOperationRequests.java @@ -303,9 +303,22 @@ final class ValueOperationRequests { replyBytes += value.map(bytes -> bytes.length).orElse(0); } context.requireReplyWithinBudget(budget, replyBytes, values.size(), FAMILY); + if (values.size() != keys.size()) { + // MGET replies positionally: reply[i] is the value of key[i]. A reply of a different length + // means the positions no longer line up, and the index used to be clamped to the last key — + // so every extra value was decoded with the last key's codec and attributed to it. A length + // mismatch is the server or the driver disagreeing with this request about what was asked; + // decoding past it produces values that look valid and belong to the wrong key. + throw new IllegalStateException( + "MGET returned " + + values.size() + + " values for " + + keys.size() + + " keys; the reply does not line up with the request"); + } List> decoded = new ArrayList<>(values.size()); for (int index = 0; index < values.size(); index++) { - ValueKey key = keys.get(Math.min(index, keys.size() - 1)); + ValueKey key = keys.get(index); decoded.add(values.get(index).map(bytes -> key.valueCodec().decode(bytes))); } return List.copyOf(decoded); diff --git a/src/adapter/outbound/support/build.gradle b/src/adapter/outbound/support/build.gradle index 2ef72a78..2e446250 100644 --- a/src/adapter/outbound/support/build.gradle +++ b/src/adapter/outbound/support/build.gradle @@ -5,7 +5,8 @@ plugins { // Shared base for outbound integration adapters: correlation, fail-open dependency // logging, and the @Configuration seam. Depended on by messaging/cache/notification/httpclient. dependencies { - implementation project(':application-core') + implementation project(":application-core") + implementation project(":shared-contract") implementation 'org.springframework.boot:spring-boot-autoconfigure' implementation 'org.slf4j:slf4j-api' } diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/RuntimeProfileSnapshot.java b/src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/runtime/RuntimeProfileSnapshot.java similarity index 92% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/RuntimeProfileSnapshot.java rename to src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/runtime/RuntimeProfileSnapshot.java index 610f5e80..3ce9c592 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/RuntimeProfileSnapshot.java +++ b/src/adapter/outbound/support/src/main/java/dev/caskeleton/adapter/outbound/support/runtime/RuntimeProfileSnapshot.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.runtime; +package dev.caskeleton.adapter.outbound.support.runtime; import dev.caskeleton.shared.runtime.RuntimeEnvironment; import java.util.List; @@ -9,7 +9,7 @@ import org.springframework.core.env.Environment; /** * Immutable snapshot of Spring's active profiles at one composition-root decision point. * - *

This is the only app-bootstrap production type that reads {@link + *

This is the only production type in the repository that reads {@link * Environment#getActiveProfiles()}. Runtime vocabulary and interpretation remain owned by the * framework-free {@link RuntimeEnvironment}; this type only bridges Spring's environment API to * that contract. diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/RuntimeProfileSnapshotTest.java b/src/adapter/outbound/support/src/test/java/dev/caskeleton/adapter/outbound/support/runtime/RuntimeProfileSnapshotTest.java similarity index 97% rename from src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/RuntimeProfileSnapshotTest.java rename to src/adapter/outbound/support/src/test/java/dev/caskeleton/adapter/outbound/support/runtime/RuntimeProfileSnapshotTest.java index 0a1fc1df..fd04cbf7 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/RuntimeProfileSnapshotTest.java +++ b/src/adapter/outbound/support/src/test/java/dev/caskeleton/adapter/outbound/support/runtime/RuntimeProfileSnapshotTest.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.runtime; +package dev.caskeleton.adapter.outbound.support.runtime; import static org.assertj.core.api.Assertions.assertThat; diff --git a/src/app-bootstrap/build.gradle b/src/app-bootstrap/build.gradle index 133a993a..4069fd87 100644 --- a/src/app-bootstrap/build.gradle +++ b/src/app-bootstrap/build.gradle @@ -5,6 +5,8 @@ plugins { id 'ca.config-contract' id 'ca.auxiliary-source-set' id 'ca.bootrun-dotenv' + id 'ca.strict-qualification' + id 'ca.dependency-policy' } def contractRegistriesDirectory = rootProject.projectDir.parentFile.toPath() @@ -83,19 +85,48 @@ dependencies { implementation project(':domain-core') implementation project(':application-core') implementation project(':application-notification') - implementation project(':application-fileserver') implementation project(':adapter:outbound:persistence-jpa') // The JPA rule pack, for the production architecture suite. Test scope only: the rules are // ArchUnit assertions, and the composition root is the one place that can see every runtime // leaf at once — which is what makes it the right consumer and the wrong shipper. + // Fileserver is not selected by the minimal composition (see the dependencyPolicy block at the + // end of this file). These lanes select it, because they are what proves the capability still + // assembles and still stays off — a contract that cannot be verified from an artifact that does + // not contain it. Object storage already works exactly this way. + testImplementation project(':composition:fileserver-platform') + // The leaf as well as the composition: a handful of bootstrap tests name the adapter's own + // types — the off-state gating inventory and the entity-scan registration among them — and a + // composition that re-exported them would be an `api` edge this module does not want. + testImplementation project(':adapter:outbound:fileserver') + testImplementation project(':application-fileserver') + integrationTestImplementation project(':composition:fileserver-platform') + integrationTestImplementation project(':adapter:inbound:web-fileserver') + testImplementation(testFixtures(project(':adapter:outbound:persistence-jpa'))) testImplementation(testFixtures(project(':adapter:inbound:web'))) + // The three capabilities above are runtimeOnly for main, and these tests name their types — + // the import filters, the deployment-mode enum, the settings records. Declared here rather than + // widened back to `implementation`, so the composition root's own sources still cannot reach + // them. The Mongo exclusions are repeated because MongoShippedCompositionContractTest asserts + // the shape of the classpath it runs on, not only the shape of the shipped one. + testImplementation(project(':adapter:outbound:persistence-mongo')) { + exclude group: 'org.springframework.boot', module: 'spring-boot-starter-data-mongodb-reactive' + exclude group: 'org.mongodb', module: 'mongodb-driver-reactivestreams' + } + testImplementation project(':adapter:outbound:httpclient') + testImplementation project(':adapter:inbound:graphql') // Shipped so an operator can enable it with one environment variable. An adapter that is // absent is not the same contract as one that is off: absence cannot be reversed at deploy time, // and it hides every gating defect, because code that is not there holds no beans whatever its // conditions say. - implementation(project(':adapter:outbound:persistence-mongo')) { + // + // runtimeOnly, not implementation: no source under src/main names a type from this leaf, so the + // composition root has no compile-time business with it, and saying so in the build makes that + // a rule the compiler keeps rather than a habit. It also states which capabilities a fork can + // drop from its artifact by deleting one line — the step the composition-ownership work has to + // reach for the capabilities bootstrap still imports. + runtimeOnly(project(':adapter:outbound:persistence-mongo')) { // Reactive Mongo is not in the shipped Stable scope: there is no reactive port, no resource // budget for a second client, and no qualification. Leaving the starter on the runtime // classpath would let Boot's reactive auto-configuration build a second client and pool from @@ -118,14 +149,15 @@ dependencies { implementation project(':adapter:outbound:cache-redis') implementation project(':adapter:outbound:redis-runtime') implementation project(':adapter:outbound:notification') - implementation project(':adapter:outbound:fileserver') - implementation project(':adapter:outbound:httpclient') + // runtimeOnly for the same reason as persistence-mongo: no main source names an HTTP client type. + runtimeOnly project(':adapter:outbound:httpclient') implementation project(':adapter:outbound:identifier') // Shipped so an operator can enable the transport with one environment variable. The platform // configuration carried no master condition at all, so this edge is only safe now that // GraphQlRootAutoConfiguration owns the switch and the import filter holds Spring GraphQL's own // auto-configurations back — without both, adding the jar would publish /graphql. - implementation project(':adapter:inbound:graphql') + // runtimeOnly: the switch and the import filter are the leaf's, and no main source names either. + runtimeOnly project(':adapter:inbound:graphql') implementation project(':adapter:inbound:web') implementation project(':shared-contract') implementation 'org.springframework.boot:spring-boot-starter' @@ -319,3 +351,40 @@ tasks.register('bootRunH2', org.springframework.boot.gradle.tasks.run.BootRun) { // The environment configuration contract. Owned here because the question it answers — what must a // deployment of this application be given — is the composition root's, and reached through // `configContractCheck` rather than through every leaf's `check`. + +// The Build Composition contract. +// +// Three questions the repository kept answering with one answer: +// +// Does this repository support Fileserver? -> the capability catalog, modules.json +// Does this build ship Fileserver? -> here +// Is the shipped Fileserver switched on? -> app.fileserver-platform.enabled +// +// Only the second one is a dependency question, and until now nothing asked it. Lowering a +// capability to `runtimeOnly` answered a different question — it left the compile classpath and +// stayed in the jar — so "we do not ship it" and "we ship it switched off" were the same build. +// They are not the same artifact, and they are not the same risk: code that is absent holds no +// beans, opens no ports and carries no CVE, whatever its conditions say. +// +// Declared as an absence on `runtimeClasspath` rather than as a test, because `runtimeClasspath` is +// what `bootJar` packages. `ca.dependency-policy` already resolves a named configuration and fails +// on a forbidden coordinate, so this needs no verifier of its own — which is the point: a build +// composition rule that required new build tooling would be trading one coupling for another. +// +// A fork that wants the capability adds the project dependency back and deletes the matching line +// here, the same two-line act that object storage already documents in docs/capability-status.md. +dependencyPolicy { + absent 'dev.caskeleton:fileserver', + 'Fileserver is an optional capability. The minimal composition does not ship it; a deployment that wants it selects :composition:fileserver-platform.' + absent 'dev.caskeleton:application-fileserver', + 'Fileserver use cases ship with the capability that drives them, not with every application.' + // The capability is four modules, so the contract names four. Listing only the ones that were + // easy to remove would have left the rule true and the artifact unchanged: `application-fileserver` + // stayed on the classpath through `adapter:inbound:web`, `adapter:outbound:persistence-jpa` and + // `adapter:outbound:identifier` long after the composition root stopped naming Fileserver, because + // the capability's code was inside those three leaves rather than merely wired by bootstrap. + absent 'dev.caskeleton:web-fileserver', + 'The Fileserver HTTP surface ships with the capability, not with every application that has an HTTP API.' + absent 'dev.caskeleton:persistence-fileserver', + 'The Fileserver schema and stores ship with the capability, not with every application that has a database.' +} diff --git a/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/ArchRuleDiscoveryContractTest.java b/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/ArchRuleDiscoveryContractTest.java index 7c5f3288..496720a5 100644 --- a/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/ArchRuleDiscoveryContractTest.java +++ b/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/ArchRuleDiscoveryContractTest.java @@ -102,7 +102,12 @@ class ArchRuleDiscoveryContractTest { "DOMAIN_EVENTS_ARE_TRANSPORT_FREE", "DOMAIN_HAS_NO_LOGGER", "DOMAIN_IS_PURE", - "FILESERVER_CONFIGURATIONS_DECLARE_AT_MOST_EIGHT_BEANS", + // FILESERVER_CONFIGURATIONS_DECLARE_AT_MOST_EIGHT_BEANS is deliberately not here any + // more. BOOT-007 governs the Fileserver composition, and that composition is no longer + // app-bootstrap's: it is :composition:fileserver-platform, which owns the rule now and + // runs it without allowEmptyShould. Kept in this suite it would have analysed an empty + // package and passed for having nothing to look at — the removal is recorded here + // rather than made by deleting a field, which is what BOOT-012 asks. "EXTERNAL_OUTBOUND_CALLS_REQUIRE_EXTERNAL_OUTBOUND_ALLOWED_CAPABILITY", "IDENTIFIER_ADAPTER_DOES_NOT_DEPEND_ON_OTHER_ADAPTERS_OR_BOOTSTRAP", "INBOUND_ADAPTERS_DEPEND_ON_PORTS_NOT_APPLICATION_SERVICES", diff --git a/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/ForbiddenApiArchitectureTest.java b/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/ForbiddenApiArchitectureTest.java index 71fde10c..a0ba4d69 100644 --- a/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/ForbiddenApiArchitectureTest.java +++ b/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/ForbiddenApiArchitectureTest.java @@ -67,7 +67,8 @@ class ForbiddenApiArchitectureTest { // tenancy.shared package of its own and only began tripping this rule when that leaf // joined the composition root's analysis scope. "dev.caskeleton.adapter.outbound.mongo.advanced.tenancy.shared", - // The registered master switches and their strict parse. Operational rather than domain: + // The registered master switches and their strict parse. Operational rather than + // domain: // it names environment keys and rejects unreadable values, and it lives here because // the environment post-processor needs it before a Spring context exists, so it must // not depend on Spring. diff --git a/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/RuntimeProfileAccessArchitectureTest.java b/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/RuntimeProfileAccessArchitectureTest.java index 443a96f9..e64ab8db 100644 --- a/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/RuntimeProfileAccessArchitectureTest.java +++ b/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/RuntimeProfileAccessArchitectureTest.java @@ -5,7 +5,7 @@ import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.noClasses; import com.tngtech.archunit.junit.AnalyzeClasses; import com.tngtech.archunit.junit.ArchTest; import com.tngtech.archunit.lang.ArchRule; -import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import org.springframework.core.env.Environment; /** BOOT-002: Spring active-profile extraction has one composition-root owner. */ diff --git a/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/StartupFailureContractArchitectureTest.java b/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/StartupFailureContractArchitectureTest.java index afeb5af5..5658228c 100644 --- a/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/StartupFailureContractArchitectureTest.java +++ b/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/StartupFailureContractArchitectureTest.java @@ -62,8 +62,15 @@ class StartupFailureContractArchitectureTest { * concern (BOOT-007) and the key digest moved to a type of its own. The rule caught the move, * which is the behaviour to want from it: an allowlist that silently followed a class around * would stop being a statement about which code is exempt. + * + *

It has moved again, out of the composition root entirely: the Redis semantic wiring is owned + * by {@code adapter:outbound:cache-redis} now, and fails closed through the support leaf's {@code + * CapabilityStartupValidationException} rather than through {@code StartupFailures}. The entry is + * kept, pointing at the new name, because the rule scans every class it can see and an allowlist + * that quietly emptied itself would be the same silence in the other direction. */ - private static final String REDIS_KEYS = "dev.caskeleton.bootstrap.autoconfigure.redis.RedisKeys"; + private static final String REDIS_KEYS = + "dev.caskeleton.adapter.outbound.cache.redis.capability.RedisKeys"; /** * {@code StartupFailures} itself — it constructs the typed exceptions this rule exists to diff --git a/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/fileserver/FileserverCompositionIntegrationTest.java b/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/fileserver/FileserverCompositionIntegrationTest.java index 6dea7552..1b9aaf58 100644 --- a/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/fileserver/FileserverCompositionIntegrationTest.java +++ b/src/app-bootstrap/src/integrationTest/java/dev/caskeleton/bootstrap/integration/fileserver/FileserverCompositionIntegrationTest.java @@ -8,9 +8,9 @@ import dev.caskeleton.adapter.inbound.web.fileserver.mapper.RawUploadRequestMapp import dev.caskeleton.adapter.outbound.persistence.transaction.SpringTransactionPort; import dev.caskeleton.application.transaction.TransactionPort; import dev.caskeleton.bootstrap.async.AsyncContextTaskDecorator; -import dev.caskeleton.bootstrap.autoconfigure.fileserver.FileserverPlatformAutoConfiguration; import dev.caskeleton.bootstrap.concurrency.DomainContextConfig; import dev.caskeleton.bootstrap.integration.PostgreSqlTestContainer; +import dev.caskeleton.composition.fileserver.FileserverPlatformAutoConfiguration; import dev.caskeleton.shared.concurrency.DomainContextPropagator; import java.io.IOException; import java.io.UncheckedIOException; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/CaSkeletonApplication.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/CaSkeletonApplication.java index 6d1e8616..07e26c0e 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/CaSkeletonApplication.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/CaSkeletonApplication.java @@ -58,13 +58,17 @@ import org.springframework.context.annotation.FilterType; @ConfigurationPropertiesScan( basePackages = { "dev.caskeleton.bootstrap.async", - "dev.caskeleton.bootstrap.autoconfigure.fileserver", "dev.caskeleton.bootstrap.concurrency", "dev.caskeleton.bootstrap.runtime", "dev.caskeleton.bootstrap.security", "dev.caskeleton.bootstrap.settings", "dev.caskeleton.adapter.inbound.web", - "dev.caskeleton.adapter.outbound.cache.redis", + // Not the whole redis tree. `...cache.redis.capability` holds RedisCapabilitySettings, which + // the capability's own gated root binds with @EnableConfigurationProperties; scanning it here + // bound the settings while every switch was off, which is the one thing the off-state + // contract forbids — and the shipped-composition test caught it by name the moment the + // capability moved into this package. + "dev.caskeleton.adapter.outbound.cache.redis.sdk", "dev.caskeleton.adapter.outbound.objectstorage", "dev.caskeleton.application", "dev.caskeleton.domain", @@ -93,6 +97,12 @@ public class CaSkeletonApplication { "dev\\.caskeleton\\.bootstrap\\.autoconfigure\\..*" + "|dev\\.caskeleton\\.bootstrap\\.notification\\..*" + "|dev\\.caskeleton\\.adapter\\.inbound\\.web\\.fileserver\\.admin\\..*" + + "|dev\\.caskeleton\\.adapter\\.outbound\\.fileserver\\.platform\\.autoconfigure\\..*" + // Capability composition modules. They are never in `basePackages`, so the scan + // cannot reach them anyway — named here because the parity test asks the regex, + // not the scan, whether an imported child could ever be found twice. + + "|dev\\.caskeleton\\.composition\\..*" + + "|dev\\.caskeleton\\.adapter\\.outbound\\.cache\\.redis\\.capability\\..*" + "|dev\\.caskeleton\\.adapter\\.outbound\\.httpclient\\.autoconfigure\\..*" + "|dev\\.caskeleton\\.adapter\\.outbound\\.mongo\\..*" + "|dev\\.caskeleton\\.adapter\\.outbound\\.messaging\\..*" diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/activation/AdapterActivationEndpoint.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/activation/AdapterActivationEndpoint.java index 91e9ee4f..744e377a 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/activation/AdapterActivationEndpoint.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/activation/AdapterActivationEndpoint.java @@ -1,7 +1,7 @@ package dev.caskeleton.bootstrap.activation; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import dev.caskeleton.bootstrap.autoconfigure.jpa.DataSourceRequirement; -import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot; import dev.caskeleton.shared.activation.MasterSwitch; import java.util.LinkedHashMap; import java.util.Map; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/activation/CapabilityDependencyValidator.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/activation/CapabilityDependencyValidator.java index 642cff13..44a317a6 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/activation/CapabilityDependencyValidator.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/activation/CapabilityDependencyValidator.java @@ -1,6 +1,6 @@ package dev.caskeleton.bootstrap.activation; -import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import dev.caskeleton.bootstrap.runtime.startup.StartupPhase; import dev.caskeleton.bootstrap.runtime.startup.StartupValidationContext; import dev.caskeleton.shared.activation.MasterSwitch; @@ -60,11 +60,20 @@ public final class CapabilityDependencyValidator { + MasterSwitch.PERSISTENCE_JPA.property() + "=true or turn the outbox off."); } - if (outbox && !messaging) { + // Only a *relaying* outbox needs somewhere to publish. An outbox with the relay off writes rows + // inside the application's own transactions and publishes nothing, which is the configuration + // an + // operator uses to park events until a transport exists — the very state + // OutboxRelayBrokerRequirementValidator documents as one of the two coherent ones. Requiring + // messaging for the capability rather than for the relay contradicted that, and in a + // broker-neutral artifact it made the outbox unreachable: messaging on demands a broker, and a + // broker demands a starter the default composition deliberately does not ship. + if (outbox && relay && !messaging) { violations.reject( - "ca-skeleton.outbox.enabled=true needs somewhere to publish; set " + "ca-skeleton.outbox.relay-enabled=true needs somewhere to publish; set " + MasterSwitch.MESSAGING.property() - + "=true or turn the outbox off."); + + "=true, or set ca-skeleton.outbox.relay-enabled=false to keep writing rows without" + + " a transport."); } if (relay && !outbox) { violations.reject( diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/activation/RuntimeEnvironmentProfileValidator.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/activation/RuntimeEnvironmentProfileValidator.java index 70393a4b..6d5ef5af 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/activation/RuntimeEnvironmentProfileValidator.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/activation/RuntimeEnvironmentProfileValidator.java @@ -1,6 +1,6 @@ package dev.caskeleton.bootstrap.activation; -import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import dev.caskeleton.bootstrap.runtime.startup.StartupFailures; import dev.caskeleton.bootstrap.runtime.startup.StartupOrder; import dev.caskeleton.shared.runtime.RuntimeEnvironment; @@ -18,9 +18,9 @@ import org.springframework.core.env.ConfigurableEnvironment; * meant an in-memory database that loses every write on restart. The failure had no symptom until * the data was already gone. * - *

Feature selection is not expressed here. That is what the registered master switches are for, and a - * supplementary profile used as a feature flag is how a profile list stops being a statement about - * where the application is running. + *

Feature selection is not expressed here. That is what the registered master switches are for, + * and a supplementary profile used as a feature flag is how a profile list stops being a statement + * about where the application is running. * *

Scoped to the deployable artifact, which means contexts whose main class is {@link * dev.caskeleton.bootstrap.CaSkeletonApplication}. Slice tests boot minimal applications with no diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformAutoConfiguration.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformAutoConfiguration.java deleted file mode 100644 index ca9332ce..00000000 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformAutoConfiguration.java +++ /dev/null @@ -1,49 +0,0 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; - -import org.springframework.boot.autoconfigure.AutoConfiguration; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; -import org.springframework.core.env.Environment; - -/** - * Master-gated Fileserver platform entry point. - * - *

This class owns only activation and strict settings binding. Concern-specific assembly stays - * in package-private child configurations reachable exclusively through this gated root. - */ -@AutoConfiguration -@ConditionalOnProperty( - prefix = FileserverPlatformSettings.PREFIX, - name = "enabled", - havingValue = "true") -@Import({ - FileserverCorePolicyConfiguration.class, - FileserverWebAssemblyConfiguration.class, - FileserverHttpDownloadConfiguration.class, - FileserverNginxConfiguration.class, - FileserverProtocolConfiguration.class, - FileserverObservabilityConfiguration.class, - FileserverStorageConfiguration.class, - FileserverSecurityConfiguration.class, - FileserverServiceConfiguration.class, - FileserverCleanupConfiguration.class, - FileserverAdminPlaneConfiguration.class, - FileserverStartupConfiguration.class -}) -public class FileserverPlatformAutoConfiguration { - - /** - * Binds the platform settings once the master switch has already been proven true. - * - *

Binding is deliberately not delegated to {@code @ConfigurationPropertiesScan}: that would - * bind — and reject — Fileserver detail settings in deployments that never switched the - * capability on. - */ - @Bean - @ConditionalOnMissingBean - FileserverPlatformSettings fileserverPlatformSettings(Environment environment) { - return FileserverPlatformSettingsBinder.bind(environment); - } -} diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverServiceConfiguration.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverServiceConfiguration.java deleted file mode 100644 index c4886b33..00000000 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverServiceConfiguration.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; - -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; - -/** Application-service composition aggregator split by runtime concern. */ -@Configuration(proxyBeanMethods = false) -@Import({ - FileserverUploadServiceConfiguration.class, - FileserverDownloadLifecycleConfiguration.class, - FileserverMaintenanceServiceConfiguration.class -}) -class FileserverServiceConfiguration {} diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStorageConfiguration.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStorageConfiguration.java deleted file mode 100644 index f7b82083..00000000 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStorageConfiguration.java +++ /dev/null @@ -1,14 +0,0 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; - -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; - -/** Storage composition aggregator; concrete concerns remain separately reviewable. */ -@Configuration(proxyBeanMethods = false) -@Import({ - FileserverLocalStorageCoreConfiguration.class, - FileserverStorageGatewayConfiguration.class, - FileserverStorageOperationsConfiguration.class, - FileserverVerificationConfiguration.class -}) -class FileserverStorageConfiguration {} diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/jpa/JpaDangerousConfigurationGuard.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/jpa/JpaDangerousConfigurationGuard.java index 4a3a20f4..7f647fbc 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/jpa/JpaDangerousConfigurationGuard.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/jpa/JpaDangerousConfigurationGuard.java @@ -1,7 +1,7 @@ package dev.caskeleton.bootstrap.autoconfigure.jpa; import dev.caskeleton.adapter.outbound.persistence.migration.FlywaySchemaPolicy; -import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import dev.caskeleton.bootstrap.runtime.startup.StartupFailures; import java.util.List; import java.util.Objects; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisActivationValidator.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisActivationValidator.java index 0c84346e..b6d073a5 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisActivationValidator.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisActivationValidator.java @@ -66,8 +66,7 @@ public class RedisActivationValidator implements SmartInitializingSingleton { private void validateIdempotencyKeyVersion() { if (!"redis" .equalsIgnoreCase( - environment.getProperty( - "ca-skeleton.capabilities.idempotency.provider", "disabled"))) { + environment.getProperty("ca-skeleton.capabilities.idempotency.provider", "disabled"))) { return; } int keyVersion = diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/tracing/TracingConfig.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/tracing/TracingConfig.java index d68513cf..5d1b8ff0 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/tracing/TracingConfig.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/tracing/TracingConfig.java @@ -1,6 +1,6 @@ package dev.caskeleton.bootstrap.autoconfigure.tracing; -import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import dev.caskeleton.shared.runtime.RuntimeEnvironment; import dev.caskeleton.shared.tracing.SpanErrorRecorder; import io.micrometer.core.instrument.MeterRegistry; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/tracing/TracingSamplingEnvironmentPostProcessor.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/tracing/TracingSamplingEnvironmentPostProcessor.java index 6b0452ce..8c12f23e 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/tracing/TracingSamplingEnvironmentPostProcessor.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/tracing/TracingSamplingEnvironmentPostProcessor.java @@ -1,6 +1,6 @@ package dev.caskeleton.bootstrap.autoconfigure.tracing; -import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import dev.caskeleton.bootstrap.runtime.startup.StartupOrder; import java.util.List; import java.util.Map; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/logging/ResolvedProfileLoggingContextListener.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/logging/ResolvedProfileLoggingContextListener.java index b8fc4a6e..dbb3b830 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/logging/ResolvedProfileLoggingContextListener.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/logging/ResolvedProfileLoggingContextListener.java @@ -1,7 +1,7 @@ package dev.caskeleton.bootstrap.logging; import ch.qos.logback.classic.LoggerContext; -import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import java.util.List; import org.slf4j.ILoggerFactory; import org.slf4j.LoggerFactory; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/JpaSchemaSafetyValidator.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/JpaSchemaSafetyValidator.java index cfe4b670..c5c1c54b 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/JpaSchemaSafetyValidator.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/JpaSchemaSafetyValidator.java @@ -1,5 +1,6 @@ package dev.caskeleton.bootstrap.runtime; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import dev.caskeleton.bootstrap.runtime.startup.StartupFailures; import java.util.Locale; import java.util.Set; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/PersistenceVendorProdSafetyValidator.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/PersistenceVendorProdSafetyValidator.java index 6ef5126a..b7e86e6e 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/PersistenceVendorProdSafetyValidator.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/PersistenceVendorProdSafetyValidator.java @@ -1,5 +1,6 @@ package dev.caskeleton.bootstrap.runtime; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import dev.caskeleton.bootstrap.runtime.startup.StartupFailures; import java.util.Locale; import org.springframework.beans.factory.SmartInitializingSingleton; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/PostgreSqlTransportSecurityValidator.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/PostgreSqlTransportSecurityValidator.java index e353ec3e..986ba89f 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/PostgreSqlTransportSecurityValidator.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/PostgreSqlTransportSecurityValidator.java @@ -1,5 +1,6 @@ package dev.caskeleton.bootstrap.runtime; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import dev.caskeleton.bootstrap.runtime.startup.StartupFailures; import java.util.ArrayList; import java.util.List; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidator.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidator.java index 6c6b0ffe..c0322e4a 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidator.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/SecretSourceValidator.java @@ -1,5 +1,6 @@ package dev.caskeleton.bootstrap.runtime; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import dev.caskeleton.application.outbound.SecretSourcePort; import dev.caskeleton.bootstrap.runtime.startup.StartupPhase; import dev.caskeleton.bootstrap.runtime.startup.StartupValidationContext; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/StartupSafetyValidator.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/StartupSafetyValidator.java index b42831e5..d05f6e87 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/StartupSafetyValidator.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/StartupSafetyValidator.java @@ -21,8 +21,7 @@ public class StartupSafetyValidator implements SmartInitializingSingleton { private final RuntimeSafetySettings settings; private final ListableBeanFactory beanFactory; - public StartupSafetyValidator( - RuntimeSafetySettings settings, ListableBeanFactory beanFactory) { + public StartupSafetyValidator(RuntimeSafetySettings settings, ListableBeanFactory beanFactory) { this.settings = settings; this.beanFactory = beanFactory; } @@ -60,6 +59,4 @@ public class StartupSafetyValidator implements SmartInitializingSingleton { invalid.failIfViolated( "APP_MULTI_INSTANCE_ENABLED=true requires the cross-instance DistributedLockPort"); } - - } diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/startup/FlywayProdSafetyValidator.java b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/startup/FlywayProdSafetyValidator.java index 267c8fe7..80057168 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/startup/FlywayProdSafetyValidator.java +++ b/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/runtime/startup/FlywayProdSafetyValidator.java @@ -1,6 +1,6 @@ package dev.caskeleton.bootstrap.runtime.startup; -import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import org.springframework.beans.factory.SmartInitializingSingleton; import org.springframework.core.env.Environment; diff --git a/src/app-bootstrap/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports b/src/app-bootstrap/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports deleted file mode 100644 index b59649e5..00000000 --- a/src/app-bootstrap/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -dev.caskeleton.bootstrap.autoconfigure.fileserver.FileserverAdminManagementContextConfiguration diff --git a/src/app-bootstrap/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/src/app-bootstrap/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index d31c553b..818ac665 100644 --- a/src/app-bootstrap/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/src/app-bootstrap/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -1,10 +1,8 @@ dev.caskeleton.bootstrap.autoconfigure.common.BootstrapClockAutoConfiguration -dev.caskeleton.bootstrap.autoconfigure.fileserver.FileserverPlatformAutoConfiguration dev.caskeleton.bootstrap.autoconfigure.jpa.PersistenceJpaRootAutoConfiguration dev.caskeleton.bootstrap.autoconfigure.messaging.DisabledMessagingSentinelAutoConfiguration dev.caskeleton.bootstrap.activation.AdapterActivationAutoConfiguration dev.caskeleton.bootstrap.autoconfigure.notification.NotificationApplicationCompositionAutoConfiguration -dev.caskeleton.bootstrap.autoconfigure.redis.RedisCapabilityConfig dev.caskeleton.bootstrap.autoconfigure.outbox.OutboxConfig dev.caskeleton.bootstrap.autoconfigure.lock.DistributedLockConfig dev.caskeleton.bootstrap.autoconfigure.idempotency.IdempotencyProviderSelectionConfig diff --git a/src/app-bootstrap/src/main/resources/config/httpclient.yml b/src/app-bootstrap/src/main/resources/config/httpclient.yml index bbd276da..440d7549 100644 --- a/src/app-bootstrap/src/main/resources/config/httpclient.yml +++ b/src/app-bootstrap/src/main/resources/config/httpclient.yml @@ -10,3 +10,6 @@ app: httpclient: enabled: ${APP_HTTPCLIENT_ENABLED:false} + # Platform-level, not per-client: how long a retired runtime generation keeps draining after a + # certificate rotation before its pool is closed under whatever is still in flight. + rotation-drain-timeout: ${APP_HTTPCLIENT_ROTATION_DRAIN_TIMEOUT:30s} diff --git a/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/activation/BootstrapCapabilityReachabilitySystemTest.java b/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/activation/BootstrapCapabilityReachabilitySystemTest.java index 73a6d380..84b869ef 100644 --- a/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/activation/BootstrapCapabilityReachabilitySystemTest.java +++ b/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/activation/BootstrapCapabilityReachabilitySystemTest.java @@ -1,24 +1,20 @@ package dev.caskeleton.bootstrap.activation; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import dev.caskeleton.adapter.outbound.cache.redis.capability.RedisCapabilitySettings; import dev.caskeleton.adapter.outbound.cache.redis.sdk.config.RedisSdkSettings; import dev.caskeleton.adapter.outbound.httpclient.autoconfigure.HttpClientPlatformSettings; import dev.caskeleton.adapter.outbound.httpclient.service.HttpServiceRegistry; -import dev.caskeleton.adapter.outbound.messaging.kafka.KafkaSender; import dev.caskeleton.application.idempotency.IdempotencyExecutor; import dev.caskeleton.application.idempotency.v2.IdempotencyExecutorV2; import dev.caskeleton.bootstrap.autoconfigure.lock.MeteredDistributedLockPort; import dev.caskeleton.bootstrap.autoconfigure.outbox.OutboxMetrics; import dev.caskeleton.bootstrap.autoconfigure.outbox.OutboxRelayScheduler; -import dev.caskeleton.bootstrap.autoconfigure.redis.RedisCapabilitySettings; import io.micrometer.tracing.Tracer; -import java.lang.reflect.Proxy; import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.support.BeanDefinitionRegistry; -import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.core.ResolvableType; import org.springframework.scheduling.config.TaskManagementConfigUtils; /** @@ -121,63 +117,43 @@ class BootstrapCapabilityReachabilitySystemTest { @Test void outboxRootIsReachableFromTheShippedCompositionWhenEnabled() { - var builder = - ShippedCompositionHarness.shippedComposition("local") - .initializers(BootstrapCapabilityReachabilitySystemTest::registerNoOpKafkaSeams); - + // No broker, and none needed: `relay-enabled=false` is one of the two coherent outbox + // configurations, and it is the one a broker-neutral artifact can run. This test used to select + // Kafka and hand-register no-op Kafka seams, which only worked while the shipped composition + // still carried the Kafka provider configuration. It does not — the broker starter is a build + // decision the deployment makes — so selecting one here was asserting a composition this + // artifact cannot produce. try (ConfigurableApplicationContext context = - builder.run( - ShippedCompositionHarness.allOffWithH2( - "reachability_outbox", - "--ca-skeleton.outbox.enabled=true", - "--ca-skeleton.outbox.relay-enabled=false", - "--app.messaging.enabled=true", - "--app.messaging.broker=kafka", - "--app.messaging.kafka.brokers[0]=unused.invalid:9092", - "--spring.kafka.bootstrap-servers=unused.invalid:9092"))) { + ShippedCompositionHarness.shippedComposition("local") + .run( + ShippedCompositionHarness.allOffWithH2( + "reachability_outbox", + "--ca-skeleton.outbox.enabled=true", + "--ca-skeleton.outbox.relay-enabled=false"))) { assertThat(context.containsBean("outboxLeaderElection")).isTrue(); assertThat(context.getBeansOfType(OutboxMetrics.class)).hasSize(1); assertThat(context.getBeansOfType(OutboxRelayScheduler.class)).isEmpty(); } } - private static void registerNoOpKafkaSeams(ConfigurableApplicationContext context) { - Class producer = loadKafkaProducerType(); - RootBeanDefinition definition = new RootBeanDefinition(); - definition.setTargetType( - ResolvableType.forClassWithGenerics(producer, byte[].class, byte[].class)); - definition.setInstanceSupplier(BootstrapCapabilityReachabilitySystemTest::noOpKafkaProducer); - ((BeanDefinitionRegistry) context.getBeanFactory()) - .registerBeanDefinition("kafkaSeamProducer", definition); - context - .getBeanFactory() - .registerSingleton("reachabilityKafkaSender", (KafkaSender) message -> {}); - } - - private static Class loadKafkaProducerType() { - try { - return Class.forName("org.apache.kafka.clients.producer.Producer"); - } catch (ClassNotFoundException missingKafkaClient) { - throw new LinkageError("shipped Kafka client is not loadable", missingKafkaClient); - } - } - - private static Object noOpKafkaProducer() { - Class producer = loadKafkaProducerType(); - return Proxy.newProxyInstance( - producer.getClassLoader(), - new Class[] {producer}, - (proxy, method, arguments) -> { - if (method.getName().equals("toString")) { - return "reachability-noop-kafka-producer"; - } - if (method.getName().equals("hashCode")) { - return System.identityHashCode(proxy); - } - if (method.getName().equals("equals")) { - return proxy == arguments[0]; - } - return null; - }); + @Test + void shippedCompositionRefusesABrokerItDidNotCompose() { + // The build composition question, asked of the artifact rather than of a build file. The core + // messaging starter is broker-neutral and neither broker starter ships, so selecting one is a + // deployment asking for a transport it did not compose. Before the selector checked for the + // provider configuration it checked only for the client library — which a deployment can hold + // transitively — and the refusal arrived as Spring reporting a missing .class file. + assertThatThrownBy( + () -> + ShippedCompositionHarness.shippedComposition("local") + .run( + ShippedCompositionHarness.allOffWithH2( + "refuses_uncomposed_broker", + "--app.messaging.enabled=true", + "--app.messaging.broker=kafka"))) + .rootCause() + .isInstanceOf(IllegalStateException.class) + .hasMessageContaining("messaging-spring-boot-starter-kafka") + .hasMessageContaining("broker-neutral"); } } diff --git a/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/activation/DependencyErrorStartupContractTest.java b/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/activation/DependencyErrorStartupContractTest.java index 74d1fc77..97a90f4f 100644 --- a/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/activation/DependencyErrorStartupContractTest.java +++ b/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/activation/DependencyErrorStartupContractTest.java @@ -43,9 +43,18 @@ class DependencyErrorStartupContractTest { } @Test - @DisplayName("the outbox without a broker is refused, naming the messaging switch") - void outboxWithoutMessagingNamesTheMessagingSwitch() { - assertRefusedNaming(List.of("--ca-skeleton.outbox.enabled=true"), "app.messaging.enabled"); + @DisplayName("the relay without a broker is refused, naming the messaging switch") + void relayingOutboxWithoutMessagingNamesTheMessagingSwitch() { + // The relay, not the capability. An outbox with the relay off writes rows and publishes + // nothing, which is how an operator parks events until a transport exists; demanding messaging + // for the capability refused that configuration and, in a broker-neutral artifact, left the + // outbox with no reachable configuration at all. + assertRefusedNaming( + List.of( + "--ca-skeleton.outbox.enabled=true", + "--ca-skeleton.outbox.relay-enabled=true", + "--ca-skeleton.persistence-jpa.enabled=true"), + "app.messaging.enabled"); } @Test diff --git a/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/activation/FiveAdapterOffInventoryTest.java b/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/activation/FiveAdapterOffInventoryTest.java index 44c73127..9e8574c8 100644 --- a/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/activation/FiveAdapterOffInventoryTest.java +++ b/src/app-bootstrap/src/systemTest/java/dev/caskeleton/bootstrap/activation/FiveAdapterOffInventoryTest.java @@ -13,7 +13,8 @@ import org.junit.jupiter.api.Test; import org.springframework.context.ConfigurableApplicationContext; /** - * With all registered master switches off, the application must hold nothing that belongs to any of them. + * With all registered master switches off, the application must hold nothing that belongs to any of + * them. * *

This boots the real composition root rather than an {@code ApplicationContextRunner}, because * the two things most likely to defeat a master switch are exactly the two a runner does not have: diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/adapter/outbound/DisabledAdapterSentinelTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/adapter/outbound/DisabledAdapterSentinelTest.java index 497ee36d..01441488 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/adapter/outbound/DisabledAdapterSentinelTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/adapter/outbound/DisabledAdapterSentinelTest.java @@ -5,8 +5,8 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import dev.caskeleton.adapter.outbound.messaging.core.DisabledMessagePublisher; import dev.caskeleton.adapter.outbound.messaging.core.OutboundMessage; import dev.caskeleton.adapter.outbound.notification.core.RoutingNotifier; -import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.application.notification.Notification; +import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.shared.error.AdapterDisabledException; import java.util.List; import java.util.Map; @@ -39,7 +39,9 @@ class DisabledAdapterSentinelTest { void unwiredNotificationEmailFailsFast() { // router-fail-fast: no providers, no routes → AdapterDisabledException on first call assertThatThrownBy( - () -> new RoutingNotifier(List.of(), Map.of()).notify(NotificationChannel.EMAIL, STUB_NOTIFICATION)) + () -> + new RoutingNotifier(List.of(), Map.of()) + .notify(NotificationChannel.EMAIL, STUB_NOTIFICATION)) .isInstanceOf(AdapterDisabledException.class) .extracting("adapterName") .isEqualTo("notification"); diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/adapter/outbound/OptionalAdapterBeanGatingTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/adapter/outbound/OptionalAdapterBeanGatingTest.java index 80ee33b6..1d3feece 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/adapter/outbound/OptionalAdapterBeanGatingTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/adapter/outbound/OptionalAdapterBeanGatingTest.java @@ -27,8 +27,8 @@ import dev.caskeleton.adapter.outbound.notification.slack.webhook.SlackClient; import dev.caskeleton.adapter.outbound.notification.slack.webhook.SlackNotificationAdapterConfig; import dev.caskeleton.adapter.outbound.support.OutboundSupportConfig; import dev.caskeleton.application.filepublication.FilePublicationPort; -import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.application.notification.Notification; +import dev.caskeleton.application.notification.NotificationChannel; import dev.caskeleton.application.notification.NotificationPort; import dev.caskeleton.application.outbox.OutboxMessagePublishPort; import dev.caskeleton.application.outbox.OutboxRelayFailureReportPort; @@ -103,7 +103,8 @@ class OptionalAdapterBeanGatingTest { // notification D4: zero providers boot fine, unbound route fails fast in RoutingNotifier NotificationPort notificationPort = context.getBean(NotificationPort.class); assertThat(notificationPort).isInstanceOf(RoutingNotifier.class); - assertThatThrownBy(() -> notificationPort.notify(NotificationChannel.EMAIL, STUB_NOTIFICATION)) + assertThatThrownBy( + () -> notificationPort.notify(NotificationChannel.EMAIL, STUB_NOTIFICATION)) .isInstanceOf(AdapterDisabledException.class) .extracting("adapterName") .isEqualTo("notification"); diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/activation/AdapterActivationReportShapeTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/activation/AdapterActivationReportShapeTest.java index 9c830e9b..eec86179 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/activation/AdapterActivationReportShapeTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/activation/AdapterActivationReportShapeTest.java @@ -64,7 +64,7 @@ class AdapterActivationReportShapeTest { } environment.setProperty("ca-skeleton.outbox.enabled", "true"); environment.setProperty("ca-skeleton.capabilities.idempotency.provider", "jdbc"); - environment.setProperty("ca-skeleton.lock.multi-instance-enabled", "true"); + environment.setProperty("ca-skeleton.runtime.multi-instance-enabled", "true"); environment.setProperty("app.fileserver-platform.enabled", "true"); environment.setProperty("spring.datasource.url", "jdbc:postgresql://secret-host:5432/db"); environment.setProperty("spring.datasource.password", "hunter2"); diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/activation/CapabilityDependencyValidatorTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/activation/CapabilityDependencyValidatorTest.java index 1cb5ba03..07a9b568 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/activation/CapabilityDependencyValidatorTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/activation/CapabilityDependencyValidatorTest.java @@ -26,9 +26,12 @@ class CapabilityDependencyValidatorTest { } @Test - @DisplayName("the outbox needs both a database and a broker, and names each") - void outboxNeedsPersistenceAndMessaging() { - MockEnvironment environment = allOff().withProperty("ca-skeleton.outbox.enabled", "true"); + @DisplayName("the outbox needs a database, and a relaying outbox also needs a broker") + void outboxNeedsPersistenceAndARelayingOutboxNeedsMessaging() { + MockEnvironment environment = + allOff() + .withProperty("ca-skeleton.outbox.enabled", "true") + .withProperty("ca-skeleton.outbox.relay-enabled", "true"); List violations = CapabilityDependencyValidator.violations(environment); @@ -38,6 +41,22 @@ class CapabilityDependencyValidatorTest { .anySatisfy(v -> assertThat(v).contains("app.messaging.enabled")); } + @Test + @DisplayName("an outbox with the relay off stores rows and demands no transport") + void outboxWithoutARelayDoesNotDemandMessaging() { + // The two coherent configurations OutboxRelayBrokerRequirementValidator names are "a relay with + // a broker" and "no relay". Requiring messaging for the capability rather than for the relay + // refused the second one, and in a broker-neutral artifact — which is what the default build + // composition produces — it left the outbox with no reachable configuration at all. + MockEnvironment environment = + allOff() + .withProperty("ca-skeleton.outbox.enabled", "true") + .withProperty("ca-skeleton.outbox.relay-enabled", "false") + .withProperty("ca-skeleton.persistence-jpa.enabled", "true"); + + assertThat(CapabilityDependencyValidator.violations(environment)).isEmpty(); + } + @Test @DisplayName("the relay is not a capability switch") void relayWithoutTheCapabilityIsRejected() { @@ -203,7 +222,10 @@ class CapabilityDependencyValidatorTest { @DisplayName( "requireSatisfied raises one typed adapter-enablement failure containing every dependency") void requireSatisfiedAggregatesThroughTheTypedStartupContext() { - MockEnvironment environment = allOff().withProperty("ca-skeleton.outbox.enabled", "true"); + MockEnvironment environment = + allOff() + .withProperty("ca-skeleton.outbox.enabled", "true") + .withProperty("ca-skeleton.outbox.relay-enabled", "true"); assertThatThrownBy(() -> CapabilityDependencyValidator.requireSatisfied(environment)) .isInstanceOfSatisfying( diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/jpa/PersistenceJpaRootAutoConfigurationOrderingTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/jpa/PersistenceJpaRootAutoConfigurationOrderingTest.java index 7e2e05c7..6bfd47ad 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/jpa/PersistenceJpaRootAutoConfigurationOrderingTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/jpa/PersistenceJpaRootAutoConfigurationOrderingTest.java @@ -16,8 +16,6 @@ class PersistenceJpaRootAutoConfigurationOrderingTest { assertThat(Arrays.asList(root.after())).isEmpty(); assertThat(root.afterName()) .noneMatch( - name -> - name.startsWith( - "dev.caskeleton.adapter.outbound.persistence.autoconfigure.")); + name -> name.startsWith("dev.caskeleton.adapter.outbound.persistence.autoconfigure.")); } } diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/outbox/OutboxCanonicalTransportRequirementValidatorTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/outbox/OutboxCanonicalTransportRequirementValidatorTest.java index 622c4b8a..cad3387e 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/outbox/OutboxCanonicalTransportRequirementValidatorTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/outbox/OutboxCanonicalTransportRequirementValidatorTest.java @@ -3,7 +3,6 @@ package dev.caskeleton.bootstrap.autoconfigure.outbox; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import dev.caskeleton.application.messaging.event.IntegrationEventEncoderPort; import dev.caskeleton.application.messaging.event.IntegrationEventPublishPort; import dev.caskeleton.application.outbox.OutboxPublishOutcome; import java.util.concurrent.CompletableFuture; @@ -52,7 +51,9 @@ class OutboxCanonicalTransportRequirementValidatorTest { event -> CompletableFuture.completedFuture(OutboxPublishOutcome.CONFIRMED); assertThatCode( - () -> new OutboxCanonicalTransportRequirementValidator(settings, publisher, draft -> null).validate()) + () -> + new OutboxCanonicalTransportRequirementValidator(settings, publisher, draft -> null) + .validate()) .doesNotThrowAnyException(); } } diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisActivationValidatorTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisActivationValidatorTest.java index 5c7c1d96..29e5ae23 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisActivationValidatorTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/redis/RedisActivationValidatorTest.java @@ -143,8 +143,7 @@ class RedisActivationValidatorTest { assertThat(context).hasFailed(); assertThat(context.getStartupFailure()) .isInstanceOf(RequiredAdapterDisabledException.class) - .hasStackTraceContaining( - "ca-skeleton.capabilities.idempotency.key-version=2") + .hasStackTraceContaining("ca-skeleton.capabilities.idempotency.key-version=2") .hasStackTraceContaining("unsupported without dual-read"); }); } diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/BootstrapCapabilityAutoConfigurationReachabilityTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/BootstrapCapabilityAutoConfigurationReachabilityTest.java index b6912e0b..10297a20 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/BootstrapCapabilityAutoConfigurationReachabilityTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/BootstrapCapabilityAutoConfigurationReachabilityTest.java @@ -19,7 +19,12 @@ class BootstrapCapabilityAutoConfigurationReachabilityTest { private static final List REQUIRED_ROOTS = List.of( - "dev.caskeleton.bootstrap.autoconfigure.redis.RedisCapabilityConfig", + // Redis is no longer here. Its semantic wiring — the cache, rate-limit, lease and + // idempotency ports and the key policy they share — moved into + // `adapter:outbound:cache-redis`, which now ships its own registration and its own + // reachability test. What stayed in the composition root is the part that is genuinely + // cross-capability: the readiness-group append and the activation validator that reads + // the bootstrap-owned secret policy. "dev.caskeleton.bootstrap.autoconfigure.outbox.OutboxConfig", "dev.caskeleton.bootstrap.autoconfigure.lock.DistributedLockConfig", "dev.caskeleton.bootstrap.autoconfigure.idempotency.IdempotencyProviderSelectionConfig", diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/CapabilityStatusDocumentTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/CapabilityStatusDocumentTest.java new file mode 100644 index 00000000..9e191a94 --- /dev/null +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/CapabilityStatusDocumentTest.java @@ -0,0 +1,74 @@ +package dev.caskeleton.bootstrap.contract; + +import static org.assertj.core.api.Assertions.assertThat; + +import dev.caskeleton.shared.activation.MasterSwitch; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +/** + * Every master switch has a row in the capability status document. + * + *

The document separates three questions the review found conflated everywhere — is the + * capability implemented, does the shipped artifact assemble it, has it been proven against a real + * provider. Those are judgements about evidence, so the document is written rather than generated; + * what a test can hold is that a capability cannot be added without stating them. A switch with no + * row is a capability whose deployment status nobody has answered. + * + *

Deliberately the only automated check on that file. Re-deriving its cells would make a parser + * the source of truth for a judgement, which is the shape of verification this repository's own + * review says to stop adding. + */ +class CapabilityStatusDocumentTest { + + private static final String DOCUMENT = "docs/capability-status.md"; + + @Test + @DisplayName("every master switch is accounted for in the capability status document") + void everyMasterSwitchHasARow() { + String document = read(); + + for (MasterSwitch masterSwitch : MasterSwitch.values()) { + assertThat(document) + .as( + "%s names %s but %s does not say whether it is implemented, wired and qualified", + MasterSwitch.class.getSimpleName(), masterSwitch.environmentVariable(), DOCUMENT) + .contains(masterSwitch.environmentVariable()); + } + } + + @Test + @DisplayName("the document states what decides each column") + void theDocumentNamesItsOwnSources() { + // Without this the table degrades into three columns of "yes" that nobody can check. Each + // column has to point at the thing that decides it, not at an opinion. + assertThat(read()) + .contains("config/architecture/modules.json") + .contains("AutoConfiguration.imports") + .contains("a workflow that executes it"); + } + + private static String read() { + Path document = repositoryRoot().resolve(DOCUMENT); + assertThat(Files.isRegularFile(document)).as("%s", document).isTrue(); + try { + return Files.readString(document); + } catch (IOException failure) { + throw new UncheckedIOException("cannot read " + document, failure); + } + } + + private static Path repositoryRoot() { + for (Path path = Path.of("").toAbsolutePath(); path != null; path = path.getParent()) { + if (Files.isRegularFile(path.resolve("AGENTS.md")) + && Files.isRegularFile(path.resolve("src/settings.gradle"))) { + return path; + } + } + throw new IllegalStateException("repository root not found"); + } +} diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ConditionalTransportQualificationContractTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ConditionalTransportQualificationContractTest.java index 20128a51..f1f458a2 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ConditionalTransportQualificationContractTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/ConditionalTransportQualificationContractTest.java @@ -70,8 +70,7 @@ class ConditionalTransportQualificationContractTest { assertThat(scan).isNotNull(); assertThat(scan.basePackages()) .doesNotContain( - "dev.caskeleton.adapter.inbound.grpc", - "dev.caskeleton.adapter.inbound.websocket"); + "dev.caskeleton.adapter.inbound.grpc", "dev.caskeleton.adapter.inbound.websocket"); } @Test diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/DeveloperExperienceContractTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/DeveloperExperienceContractTest.java index c8ccba5d..8b42a0c2 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/DeveloperExperienceContractTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/DeveloperExperienceContractTest.java @@ -274,6 +274,29 @@ class DeveloperExperienceContractTest { "./gradlew :app-bootstrap:test --tests 'dev.caskeleton.bootstrap.architecture.*'"); } + @Test + void everyOptionalPlatformIntegrationLaneHasAnExecutingWorkflowCaller() throws IOException { + // `grpc-operation-ledger-jpa` declares a Testcontainers PostgreSQL lane that certifies the + // atomic claim durable mutation idempotency rests on. It was registered in `strictTestLanes`, + // fails closed, and ran nowhere: the optional build's `ci` reaches `checkAll`, `qualityCheck` + // and the dependency verifier, and none of those runs a lane whose category is INTEGRATION. + // A lane nobody runs is not coverage, so both halves are pinned here — the aggregate that + // covers the category, and the workflow that executes the aggregate. + assertThat(read("src/optional-platforms/build.gradle")) + .as("the optional platform build must aggregate its integration-category lanes") + .contains("tasks.register('integrationCheck')") + .contains(":integrationTestLaneCheck"); + + assertThat(read("src/grpc/grpc-operation-ledger-jpa/build.gradle")) + .as("the operation ledger lane this contract protects must still be declared") + .contains("lane('integrationTest')") + .contains("integration()"); + + assertThat(read(".github/workflows/integration-main.yml")) + .as("a workflow must actually execute the optional platform integration aggregate") + .contains("./gradlew -p optional-platforms integrationCheck"); + } + @Test void dockerBuildConsumesOnlyTheGradleStagedExecutableJar() throws IOException { String dockerfile = "src/Dockerfile"; diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/MongoShippedCompositionContractTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/MongoShippedCompositionContractTest.java index 8f0003ca..65751a06 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/MongoShippedCompositionContractTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/MongoShippedCompositionContractTest.java @@ -20,8 +20,7 @@ class MongoShippedCompositionContractTest { // The default app-bootstrap explicitly excludes the reactive-streams Mongo driver. Without it, // Boot cannot construct the ReactiveMongoTemplate bean required by ReactiveExecution. - assertThat( - ClassUtils.isPresent("com.mongodb.reactivestreams.client.MongoClient", classLoader)) + assertThat(ClassUtils.isPresent("com.mongodb.reactivestreams.client.MongoClient", classLoader)) .isFalse(); } } diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/OperationalErrorRegistryContractTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/OperationalErrorRegistryContractTest.java new file mode 100644 index 00000000..d2d2fb7a --- /dev/null +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/OperationalErrorRegistryContractTest.java @@ -0,0 +1,143 @@ +package dev.caskeleton.bootstrap.contract; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.yaml.snakeyaml.LoaderOptions; +import org.yaml.snakeyaml.Yaml; +import org.yaml.snakeyaml.constructor.SafeConstructor; + +/** + * {@code OperationalError} and {@code docs/registries/error-codes.yaml} describe the same set. + * + *

This was a Gradle task in the {@code build-tools} included build, with a hand-written YAML + * parser inside it. The contract is worth keeping and the placement was not: comparing two + * checked-in files needs no dependency resolution, no task graph and no included build, and the + * review's Phase 6 asks for exactly this kind of verification to move back to a test. Reading the + * registry with a real YAML parser rather than a line-prefix scanner is the other thing the move + * buys — the scanner accepted a row whose fields were indented differently. + * + *

Held here rather than in {@code shared-contract}, which owns the enum, because {@code + * shared-contract} is Java-stdlib-only by policy and this repository already parses the same + * registry here for the runbook coverage contract. + */ +class OperationalErrorRegistryContractTest { + + private static final String REGISTRY = "docs/registries/error-codes.yaml"; + + private static final String SOURCE = + "src/shared-contract/src/main/java/dev/caskeleton/shared/error/OperationalError.java"; + + /** One constant: NAME(Category.X, status, retryable). */ + private static final Pattern ENUM_ENTRY = + Pattern.compile( + "(?m)^\\s*([A-Z][A-Z0-9_]+)\\s*\\(Category\\.([A-Z_]+),\\s*(\\d+),\\s*(true|false)\\)"); + + private record Contract(String category, int httpStatus, boolean retryable) {} + + @Test + @DisplayName("the enum and the registry name the same operational errors, with the same metadata") + void theEnumAndTheRegistryAgree() { + Map declared = declaredInCode(); + Map registered = declaredInRegistry(); + + assertThat(declared) + .as("OperationalError declares no constants; the scan is broken") + .isNotEmpty(); + + Set codeOnly = new TreeSet<>(declared.keySet()); + codeOnly.removeAll(registered.keySet()); + assertThat(codeOnly).as("OperationalError entries missing from %s", REGISTRY).isEmpty(); + + Set registryOnly = new TreeSet<>(registered.keySet()); + registryOnly.removeAll(declared.keySet()); + assertThat(registryOnly).as("%s rows with no OperationalError constant", REGISTRY).isEmpty(); + + declared.forEach( + (name, expected) -> + assertThat(registered.get(name)) + .as("%s: category, HTTP status and retryability must match the registry", name) + .isEqualTo(expected)); + } + + private static Map declaredInCode() { + Map declared = new LinkedHashMap<>(); + Matcher matcher = ENUM_ENTRY.matcher(read(SOURCE)); + while (matcher.find()) { + declared.put( + matcher.group(1), + new Contract( + matcher.group(2), + Integer.parseInt(matcher.group(3)), + Boolean.parseBoolean(matcher.group(4)))); + } + return declared; + } + + @SuppressWarnings("unchecked") + private static Map declaredInRegistry() { + LoaderOptions options = new LoaderOptions(); + options.setAllowDuplicateKeys(false); + Object loaded = new Yaml(new SafeConstructor(options)).load(read(REGISTRY)); + assertThat(loaded).as("%s must be a YAML mapping", REGISTRY).isInstanceOf(Map.class); + + Map registered = new LinkedHashMap<>(); + for (Object section : ((Map) loaded).values()) { + if (!(section instanceof List rows)) { + continue; + } + for (Object row : rows) { + if (!(row instanceof Map entry) || !(entry.get("code") instanceof String code)) { + continue; + } + Object category = entry.get("category"); + Object status = entry.get("http_status"); + Object retryable = entry.get("retryable"); + if (category == null || status == null || retryable == null) { + continue; + } + Contract previous = + registered.put( + code, + new Contract( + String.valueOf(category), + ((Number) status).intValue(), + Boolean.parseBoolean(String.valueOf(retryable)))); + assertThat(previous).as("%s declares %s more than once", REGISTRY, code).isNull(); + } + } + return registered; + } + + private static String read(String relativePath) { + Path path = repositoryRoot().resolve(relativePath); + assertThat(Files.isRegularFile(path)).as("%s", path).isTrue(); + try { + return Files.readString(path); + } catch (IOException failure) { + throw new UncheckedIOException("cannot read " + path, failure); + } + } + + private static Path repositoryRoot() { + for (Path path = Path.of("").toAbsolutePath(); path != null; path = path.getParent()) { + if (Files.isRegularFile(path.resolve("AGENTS.md")) + && Files.isRegularFile(path.resolve("src/settings.gradle"))) { + return path; + } + } + throw new IllegalStateException("repository root not found"); + } +} diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/PiiTokenBodyForbiddenContractTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/PiiTokenBodyForbiddenContractTest.java index 498f9a9a..7001ff66 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/PiiTokenBodyForbiddenContractTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/PiiTokenBodyForbiddenContractTest.java @@ -11,7 +11,6 @@ import dev.caskeleton.bootstrap.logging.LogMaskingPatterns; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.regex.Matcher; import java.util.regex.Pattern; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; @@ -128,5 +127,4 @@ class PiiTokenBodyForbiddenContractTest { private static long countUnmasked(String text) { return UNMASKED_SECRET.matcher(text).results().count(); } - } diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/RedisOptionalityContractTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/RedisOptionalityContractTest.java index 5f59689a..e26c81a6 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/RedisOptionalityContractTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/RedisOptionalityContractTest.java @@ -42,11 +42,21 @@ class RedisOptionalityContractTest { .isNotNull(); assertThat(scan.basePackages()) .as( - "the scan that would make an annotated Redis settings class unconditional; the " - + "composition root now names the packages it scans rather than scanning " - + "dev.caskeleton.adapter wholesale, so this asserts the Redis package is still " - + "covered — the hazard this test guards is unchanged, only its address is") - .contains("dev.caskeleton.adapter.outbound.cache.redis"); + "the scan that would make an annotated Redis SDK settings class unconditional; this " + + "asserts the hazard still exists, so the assertion below is about something") + .contains("dev.caskeleton.adapter.outbound.cache.redis.sdk"); + assertThat(scan.basePackages()) + .as( + "the capability package must stay outside the scan. RedisCapabilitySettings is " + + "annotated @ConfigurationProperties and is bound by the gated " + + "RedisCapabilityConfig; when the capability moved into the leaf under the wider " + + "`...cache.redis` prefix the scan bound it with every switch off, which is the " + + "one thing the off-state contract forbids") + .doesNotContain("dev.caskeleton.adapter.outbound.cache.redis") + .noneMatch( + basePackage -> + "dev.caskeleton.adapter.outbound.cache.redis.capability" + .startsWith(basePackage + ".")); assertThat(CaSkeletonApplication.class.getAnnotation(SpringBootConfiguration.class)) .as( "the composition root is spelled out as @SpringBootConfiguration + " diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/messaging/MessagingMembershipQualificationTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/messaging/MessagingMembershipQualificationTest.java index 796fdd61..ed1fcec6 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/messaging/MessagingMembershipQualificationTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/contract/messaging/MessagingMembershipQualificationTest.java @@ -34,7 +34,8 @@ class MessagingMembershipQualificationTest { } @Test - @DisplayName("the default composition ships the broker-neutral core, not either broker capability") + @DisplayName( + "the default composition ships the broker-neutral core, not either broker capability") void defaultCompositionShipsOnlyTheBrokerNeutralCore() { String bootstrap = read(repositoryRoot().resolve("src/app-bootstrap/build.gradle")); @@ -50,9 +51,7 @@ class MessagingMembershipQualificationTest { @DisplayName("the core starter has no production edge to either broker leaf") void coreStarterIsBrokerNeutral() { String starter = - read( - repositoryRoot() - .resolve("src/messaging/messaging-spring-boot-starter/build.gradle")); + read(repositoryRoot().resolve("src/messaging/messaging-spring-boot-starter/build.gradle")); assertThat(starter) .doesNotContain( diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/BootstrapStructuredRuntimeLoggingTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/BootstrapStructuredRuntimeLoggingTest.java index caa5bd8e..8bc783d8 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/BootstrapStructuredRuntimeLoggingTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/BootstrapStructuredRuntimeLoggingTest.java @@ -9,13 +9,10 @@ import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.read.ListAppender; -import dev.caskeleton.application.fileserver.cleanup.CleanupBatchResult; -import dev.caskeleton.application.fileserver.cleanup.CleanupService; import dev.caskeleton.application.lock.DistributedLock; import dev.caskeleton.application.lock.DistributedLockPort; import dev.caskeleton.application.outbox.PublishPendingOutboxEventsCommand; import dev.caskeleton.application.outbox.PublishPendingOutboxEventsUseCase; -import dev.caskeleton.bootstrap.autoconfigure.fileserver.FileserverCleanupWorker; import dev.caskeleton.bootstrap.autoconfigure.lock.MeteredDistributedLockPort; import dev.caskeleton.bootstrap.autoconfigure.outbox.OutboxMetrics; import dev.caskeleton.bootstrap.autoconfigure.outbox.OutboxRelayScheduler; @@ -32,46 +29,6 @@ import org.springframework.beans.factory.support.DefaultListableBeanFactory; class BootstrapStructuredRuntimeLoggingTest { - @Test - void fileserverCleanupSuccessCarriesBoundedOutcomeFields() { - CleanupService cleanup = (maxItems, maxBytes) -> new CleanupBatchResult(1, 2, 3, 4, 5L); - - try (CapturedLogger captured = capture(FileserverCleanupWorker.class)) { - new FileserverCleanupWorker(cleanup, 10, 1_024L).runBatch(); - - ILoggingEvent event = captured.singleEvent(); - assertThat(event.getLevel()).isEqualTo(Level.INFO); - assertThat(event.getFormattedMessage()).contains("deleted=1").contains("reclaimedBytes=5"); - assertThat(renderedArguments(event)) - .contains("capability=fileserver") - .contains("operation=cleanup") - .contains("cleanup.deleted=1") - .contains("cleanup.failed=4") - .contains("cleanup.reclaimed_bytes=5"); - } - } - - @Test - void fileserverCleanupFailureCarriesRetryDisposition() { - CleanupService cleanup = - (maxItems, maxBytes) -> { - throw new IllegalStateException("storage unavailable"); - }; - - try (CapturedLogger captured = capture(FileserverCleanupWorker.class)) { - new FileserverCleanupWorker(cleanup, 10, 1_024L).runBatch(); - - ILoggingEvent event = captured.singleEvent(); - assertThat(event.getLevel()).isEqualTo(Level.WARN); - assertThat(renderedArguments(event)) - .contains("capability=fileserver") - .contains("operation=cleanup") - .contains("warning.kind=scheduled-task-failed") - .contains("retry.disposition=next-run"); - assertThat(event.getThrowableProxy()).isNotNull(); - } - } - @Test void outboxRelayUnexpectedFailureCarriesNextTickDispositionWithoutInventedErrorCode() { PublishPendingOutboxEventsUseCase relay = mock(PublishPendingOutboxEventsUseCase.class); diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/startup/MigrationStartupRunnerTest.java b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/startup/MigrationStartupRunnerTest.java index d4e4eeca..27b9f2bf 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/startup/MigrationStartupRunnerTest.java +++ b/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/runtime/startup/MigrationStartupRunnerTest.java @@ -33,8 +33,7 @@ import org.springframework.context.SmartLifecycle; */ class MigrationStartupRunnerTest { - private final RuntimeSafetySettings settings = - new RuntimeSafetySettings(false, true); + private final RuntimeSafetySettings settings = new RuntimeSafetySettings(false, true); private final MigrationStartupRunner runner = new MigrationStartupRunner(settings); @Test diff --git a/src/application-core/build.gradle b/src/application-core/build.gradle index 48887ba6..fda8205e 100644 --- a/src/application-core/build.gradle +++ b/src/application-core/build.gradle @@ -1,6 +1,7 @@ plugins { id 'ca.java-library' id 'java-test-fixtures' + id 'ca.strict-qualification' } // Framework-free application use-case contract. Runtime dependencies are project-only; diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/ResolvedComponents.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/ResolvedComponents.java new file mode 100644 index 00000000..f1fc2b0d --- /dev/null +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/ResolvedComponents.java @@ -0,0 +1,47 @@ +package dev.caskeleton.buildlogic; + +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.LinkedHashSet; +import java.util.Set; +import org.gradle.api.artifacts.result.ResolvedComponentResult; +import org.gradle.api.artifacts.result.ResolvedDependencyResult; + +/** + * Walks a resolution result from its root component. + * + *

The architecture tasks used to hold a {@link org.gradle.api.artifacts.Configuration} and call + * {@code getIncoming().getResolutionResult().getAllComponents()} inside the task action. That is + * live build state: Gradle cannot serialise it, so the configuration cache refused to store the + * task, and it resolves a configuration at execution time from whatever project happens to run the + * action. A {@code Provider} taken from {@code getRootComponent()} is the + * supported carrier — it is resolved while the owning project is still configuring, and what the + * task keeps is a value. + * + *

This walk therefore replaces {@code getAllComponents()}, which has no equivalent on the root + * component. The visited set is not an optimisation: a dependency graph is a DAG only in intent, + * and a cycle here would be an infinite loop rather than a diagnosis. + */ +public final class ResolvedComponents { + + private ResolvedComponents() {} + + /** Every component reachable from {@code root}, including {@code root} itself. */ + public static Set reachableFrom(ResolvedComponentResult root) { + Set visited = new LinkedHashSet<>(); + Deque pending = new ArrayDeque<>(); + pending.add(root); + while (!pending.isEmpty()) { + ResolvedComponentResult component = pending.removeFirst(); + if (!visited.add(component)) { + continue; + } + for (var dependency : component.getDependencies()) { + if (dependency instanceof ResolvedDependencyResult resolved) { + pending.add(resolved.getSelected()); + } + } + } + return visited; + } +} diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/ArchitectureModuleRule.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/ArchitectureModuleRule.java deleted file mode 100644 index 08ba2653..00000000 --- a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/ArchitectureModuleRule.java +++ /dev/null @@ -1,19 +0,0 @@ -package dev.caskeleton.buildlogic.architecture; - -import java.util.List; -import java.util.Objects; -import java.util.Set; -import org.gradle.api.artifacts.Configuration; - -record ArchitectureModuleRule( - String moduleName, - Set allowedDependencies, - List productionConfigurations, - Configuration compileClasspath) { - ArchitectureModuleRule { - Objects.requireNonNull(moduleName, "moduleName"); - allowedDependencies = Set.copyOf(allowedDependencies); - productionConfigurations = List.copyOf(productionConfigurations); - Objects.requireNonNull(compileClasspath, "compileClasspath"); - } -} diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/ArchitecturePlugin.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/ArchitecturePlugin.java index 957dafd6..1f7de28e 100644 --- a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/ArchitecturePlugin.java +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/ArchitecturePlugin.java @@ -6,11 +6,17 @@ import java.io.IOException; import java.io.UncheckedIOException; import java.util.ArrayList; import java.util.HashSet; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.Set; +import java.util.TreeSet; import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; +import org.gradle.api.artifacts.ProjectDependency; +import org.gradle.api.artifacts.result.ResolvedComponentResult; +import org.gradle.api.provider.Provider; public final class ArchitecturePlugin implements Plugin { private static final List PRODUCTION_DECLARATIONS = @@ -54,7 +60,6 @@ public final class ArchitecturePlugin implements Plugin { .getTasks() .register( "verifyApplicationCoreDependencyPurity", - VerifyApplicationCoreDependencyPurityTask.class, task -> { task.setGroup("verification"); task.setDescription( @@ -83,7 +88,12 @@ public final class ArchitecturePlugin implements Plugin { root.getSubprojects().stream() .filter(sub -> sub.getChildProjects().isEmpty()) .forEach(sub -> declaredModules.add(sub.getPath().replaceFirst("^:", ""))); - List rules = new ArrayList<>(); + // One task per module, registered in the project that owns the configurations. The + // root task used to walk every other project and resolve its `compileClasspath`, + // which asks Gradle for state another project holds the lock on — with + // `org.gradle.parallel=true` that is a hard failure, and it is why the flag was + // turned off instead of the verification moved. + List moduleTaskPaths = new ArrayList<>(); for (ModuleRegistry.Module module : modules) { Project owner = root.project(module.gradlePath()); Set allowed = new HashSet<>(); @@ -93,51 +103,90 @@ public final class ArchitecturePlugin implements Plugin { allowed.add(dependency.gradlePath().replaceFirst("^:", "")); } } - List configurations = - PRODUCTION_DECLARATIONS.stream() - .map(name -> owner.getConfigurations().findByName(name)) - .filter(java.util.Objects::nonNull) - .toList(); - Configuration compileClasspath = - owner.getConfigurations().getByName("compileClasspath"); - rules.add( - new ArchitectureModuleRule( - module.gradlePath().replaceFirst("^:", ""), - allowed, - configurations, - compileClasspath)); + Set declaredEdges = declaredProjectEdges(owner); + Provider compileClasspathRoot = + owner + .getConfigurations() + .getByName("compileClasspath") + .getIncoming() + .getResolutionResult() + .getRootComponent(); + String moduleName = module.gradlePath().replaceFirst("^:", ""); + owner + .getTasks() + .register( + "verifyModuleDependencyDirection", + VerifyModuleDependencyDirectionTask.class, + task -> { + task.setGroup("verification"); + task.setDescription( + "Verifies this module's declared and compile-visible project edges" + + " against the architecture registry."); + task.getModuleName().set(moduleName); + task.getAllowedDependencies().set(allowed); + task.getDeclaredProjectEdges().set(declaredEdges); + task.getCompileClasspathRoot().set(compileClasspathRoot); + }); + moduleTaskPaths.add(module.gradlePath() + ":verifyModuleDependencyDirection"); } clean.configure( task -> { task.getDeclaredModules().set(declaredModules); - task.setRules(rules); + task.getGovernedModules() + .set( + modules.stream() + .map(module -> module.gradlePath().replaceFirst("^:", "")) + .toList()); + task.dependsOn(moduleTaskPaths); }); - List applicationProjects = - modules.stream() - .filter(module -> module.id().startsWith("application-")) - .map(module -> root.project(module.gradlePath())) - .toList(); - List production = - applicationProjects.stream() - .flatMap( - application -> - PRODUCTION_DECLARATIONS.stream() - .map(name -> application.getConfigurations().findByName(name))) - .filter(java.util.Objects::nonNull) - .toList(); - List classpaths = - applicationProjects.stream() - .flatMap( - application -> - APPLICATION_CLASSPATHS.stream() - .map(name -> application.getConfigurations().getByName(name))) - .toList(); - purity.configure( - task -> { - task.setProductionConfigurations(production); - task.setResolvedConfigurations(classpaths); - }); + // Same ownership rule as the direction check: the task that resolves an + // application module's classpaths lives in that module. + List purityTaskPaths = new ArrayList<>(); + for (ModuleRegistry.Module module : modules) { + if (!module.id().startsWith("application-")) { + continue; + } + Project application = root.project(module.gradlePath()); + Map> production = new LinkedHashMap<>(); + for (String name : PRODUCTION_DECLARATIONS) { + Configuration configuration = application.getConfigurations().findByName(name); + if (configuration != null) { + production.put(name, productionDeclarations(configuration)); + } + } + Map> classpathRoots = + new LinkedHashMap<>(); + for (String name : APPLICATION_CLASSPATHS) { + classpathRoots.put( + name, + application + .getConfigurations() + .getByName(name) + .getIncoming() + .getResolutionResult() + .getRootComponent()); + } + String applicationPath = module.gradlePath(); + application + .getTasks() + .register( + "verifyModuleDependencyPurity", + VerifyApplicationCoreDependencyPurityTask.class, + task -> { + task.setGroup("verification"); + task.setDescription( + "Verifies this application module declares only project production" + + " dependencies and carries no diagnostic framework."); + task.getModulePath().set(applicationPath); + task.getProductionDeclarations().set(production); + classpathRoots.forEach( + (name, rootComponent) -> + task.getResolvedClasspathRoots().put(name, rootComponent)); + }); + purityTaskPaths.add(module.gradlePath() + ":verifyModuleDependencyPurity"); + } + purity.configure(task -> task.dependsOn(purityTaskPaths)); List sourceRoots = new ArrayList<>(); root.getSubprojects().stream() @@ -176,6 +225,52 @@ public final class ArchitecturePlugin implements Plugin { }); } + /** + * This module's declared {@code project(...)} edges, read while the owning project is configured. + * + *

Read here rather than in the task action: a {@link Configuration} cannot be stored in the + * configuration cache, and every declaration this reads is final by {@code projectsEvaluated}. + */ + private static Set declaredProjectEdges(Project owner) { + Set edges = new TreeSet<>(); + for (String name : PRODUCTION_DECLARATIONS) { + Configuration configuration = owner.getConfigurations().findByName(name); + if (configuration == null) { + continue; + } + configuration + .getDependencies() + .withType(ProjectDependency.class) + .forEach(dependency -> edges.add(dependency.getPath().replaceFirst("^:", ""))); + } + return edges; + } + + /** + * One production configuration's declarations, tagged by kind. + * + *

The tag, not a filter, is what is captured: deciding which kind is a violation is the purity + * task's rule, and moving it here would put the rule in the collector. + */ + private static List productionDeclarations(Configuration configuration) { + List declarations = new ArrayList<>(); + configuration + .getDependencies() + .forEach( + dependency -> { + if (dependency instanceof ProjectDependency projectDependency) { + declarations.add( + VerifyApplicationCoreDependencyPurityTask.PROJECT_DECLARATION + + ":" + + projectDependency.getPath()); + } else { + String group = dependency.getGroup() == null ? "" : dependency.getGroup(); + declarations.add("module:" + group + ":" + dependency.getName()); + } + }); + return List.copyOf(declarations); + } + private static List registryViolations( ModuleRegistry registry, List modules) { List violations = new ArrayList<>(); diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/VerifyApplicationCoreDependencyPurityTask.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/VerifyApplicationCoreDependencyPurityTask.java index 23bb20fb..34954adb 100644 --- a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/VerifyApplicationCoreDependencyPurityTask.java +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/VerifyApplicationCoreDependencyPurityTask.java @@ -1,75 +1,87 @@ package dev.caskeleton.buildlogic.architecture; +import dev.caskeleton.buildlogic.ResolvedComponents; import java.util.ArrayList; import java.util.List; +import java.util.Map; import org.gradle.api.DefaultTask; import org.gradle.api.GradleException; -import org.gradle.api.artifacts.Configuration; -import org.gradle.api.artifacts.ProjectDependency; import org.gradle.api.artifacts.component.ModuleComponentIdentifier; +import org.gradle.api.artifacts.result.ResolvedComponentResult; +import org.gradle.api.provider.MapProperty; +import org.gradle.api.provider.Property; +import org.gradle.api.tasks.Input; import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.TaskAction; import org.gradle.work.DisableCachingByDefault; -@DisableCachingByDefault(because = "Verification inspects and resolves live application module configurations") -public class VerifyApplicationCoreDependencyPurityTask extends DefaultTask { - private List productionConfigurations = List.of(); - private List resolvedConfigurations = List.of(); +/** + * One application module's purity check, run by the project that owns the configurations. + * + *

Registered per {@code application-*} module rather than once at the root. The root form + * resolved four classpaths in each of those projects from outside them, which Gradle refuses under + * {@code org.gradle.parallel=true} — "Resolution of the configuration ':application-core: + * runtimeClasspath' was attempted without an exclusive lock" — and that refusal, not the check + * itself, is what kept the flag off. + * + *

The task holds no {@code Configuration} either. It was the last configuration-cache problem in + * the whole {@code ci} graph: a {@code Configuration} is live build state, so storing the task + * failed outright rather than degrading. What it keeps now is the declared dependencies as strings + * and each classpath's resolved root component. + */ +@DisableCachingByDefault(because = "Verification inspects an application module's declarations and resolved classpaths") +public abstract class VerifyApplicationCoreDependencyPurityTask extends DefaultTask { + /** Marks a declared dependency that is a {@code project(...)} edge. */ + static final String PROJECT_DECLARATION = "project"; + + /** The Gradle path of the application module this task governs, for the success line. */ + @Input + public abstract Property getModulePath(); + + /** + * Production declarations per configuration name. + * + *

Each entry is {@code ":"} — {@code project:} for a project edge, and + * {@code module::} for anything else. The rule that only the first kind is allowed + * stays here, in the task, rather than in the plugin that collects them. + */ + @Input + public abstract MapProperty> getProductionDeclarations(); + + /** Resolved root component per classpath configuration name. */ @Internal - public List getProductionConfigurations() { - return productionConfigurations; - } - - public void setProductionConfigurations(List value) { - productionConfigurations = List.copyOf(value); - } - - @Internal - public List getResolvedConfigurations() { - return resolvedConfigurations; - } - - public void setResolvedConfigurations(List value) { - resolvedConfigurations = List.copyOf(value); - } + public abstract MapProperty getResolvedClasspathRoots(); @TaskAction public void verifyPurity() { List violations = new ArrayList<>(); - for (Configuration configuration : productionConfigurations) { - configuration.getDependencies().forEach( - dependency -> { - if (!(dependency instanceof ProjectDependency)) { - String group = dependency.getGroup() == null ? "" : dependency.getGroup(); - violations.add( - configuration.getName() - + ": non-project production dependency " - + group - + ":" - + dependency.getName()); - } - }); + for (Map.Entry> entry : getProductionDeclarations().get().entrySet()) { + for (String declaration : entry.getValue()) { + if (!declaration.startsWith(PROJECT_DECLARATION + ":")) { + violations.add( + entry.getKey() + + ": non-project production dependency " + + declaration.substring(declaration.indexOf(':') + 1)); + } + } } - for (Configuration configuration : resolvedConfigurations) { - configuration - .getIncoming() - .getResolutionResult() - .getAllComponents() - .forEach( - component -> { - if (component.getId() instanceof ModuleComponentIdentifier module - && forbiddenGroup(module.getGroup())) { - violations.add( - configuration.getName() - + ": forbidden resolved dependency " - + module.getGroup() - + ":" - + module.getModule() - + ":" - + module.getVersion()); - } - }); + for (Map.Entry entry : + getResolvedClasspathRoots().get().entrySet()) { + for (ResolvedComponentResult component : + ResolvedComponents.reachableFrom(entry.getValue())) { + if (component.getId() instanceof ModuleComponentIdentifier module + && forbiddenGroup(module.getGroup())) { + violations.add( + entry.getKey() + + ": forbidden resolved dependency " + + module.getGroup() + + ":" + + module.getModule() + + ":" + + module.getVersion()); + } + } } if (!violations.isEmpty()) { violations.sort(String::compareTo); @@ -81,7 +93,9 @@ public class VerifyApplicationCoreDependencyPurityTask extends DefaultTask { } getLogger() .lifecycle( - "verifyApplicationCoreDependencyPurity: OK — application-* production declarations are project-only and application classpaths contain no Spring/logging/metrics frameworks."); + "verifyApplicationCoreDependencyPurity: OK — {} production declarations are" + + " project-only and its classpaths contain no Spring/logging/metrics frameworks.", + getModulePath().get()); } private static boolean forbiddenGroup(String group) { diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/VerifyCleanArchitectureDependenciesTask.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/VerifyCleanArchitectureDependenciesTask.java index 1180927f..dbe80145 100644 --- a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/VerifyCleanArchitectureDependenciesTask.java +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/VerifyCleanArchitectureDependenciesTask.java @@ -1,26 +1,35 @@ package dev.caskeleton.buildlogic.architecture; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.TreeSet; import org.gradle.api.DefaultTask; import org.gradle.api.GradleException; -import org.gradle.api.artifacts.ProjectDependency; -import org.gradle.api.artifacts.component.ProjectComponentIdentifier; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.ListProperty; import org.gradle.api.provider.SetProperty; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputFile; -import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.TaskAction; import org.gradle.work.DisableCachingByDefault; -@DisableCachingByDefault(because = "Verification inspects live declarations and resolved compile classpaths") +/** + * The repository-wide half of the dependency contract. + * + *

Two questions only, and both are answered from the registry rather than from any project's + * configurations: is the registry internally consistent, and does the set of modules it governs + * match the set of leaves the build actually declares. A leaf that exists and is ungoverned is the + * failure this catches — a new module cannot be added and quietly escape the direction rules. + * + *

Whether a given module's edges are allowed is {@link VerifyModuleDependencyDirectionTask}'s + * job, one task per module, in the project that owns the configurations. That split is the whole + * point: this task used to resolve every other project's {@code compileClasspath} itself, which + * needs a lock it does not hold, and made {@code org.gradle.parallel=true} fail rather than merely + * be unused. + */ +@DisableCachingByDefault(because = "Verification of live build structure emits no reusable output") public abstract class VerifyCleanArchitectureDependenciesTask extends DefaultTask { - private List rules = List.of(); @InputFile public abstract RegularFileProperty getRegistryFile(); @@ -28,17 +37,13 @@ public abstract class VerifyCleanArchitectureDependenciesTask extends DefaultTas @Input public abstract ListProperty getRegistryViolations(); + /** Every leaf the build declares. */ @Input public abstract SetProperty getDeclaredModules(); - @Internal - public List getRules() { - return rules; - } - - public void setRules(List rules) { - this.rules = List.copyOf(rules); - } + /** Every module the registry governs. */ + @Input + public abstract ListProperty getGovernedModules(); @TaskAction public void verifyDependencies() { @@ -50,8 +55,7 @@ public abstract class VerifyCleanArchitectureDependenciesTask extends DefaultTas } Set declared = getDeclaredModules().get(); - Set governed = new HashSet<>(); - rules.forEach(rule -> governed.add(rule.moduleName())); + Set governed = new HashSet<>(getGovernedModules().get()); Set missingFromBuild = new TreeSet<>(governed); missingFromBuild.removeAll(declared); Set missingFromPolicy = new TreeSet<>(declared); @@ -68,47 +72,8 @@ public abstract class VerifyCleanArchitectureDependenciesTask extends DefaultTas throw new GradleException( "Gradle modules " + missingFromPolicy - + " are not covered by verifyCleanArchitectureDependencies. Add an explicit dependency policy before using them."); - } - - List dependencyViolations = new ArrayList<>(); - for (ArchitectureModuleRule rule : rules) { - Set actual = new HashSet<>(); - for (var configuration : rule.productionConfigurations()) { - configuration - .getDependencies() - .withType(ProjectDependency.class) - .forEach(dependency -> actual.add(dependency.getPath().replaceFirst("^:", ""))); - } - rule.compileClasspath() - .getIncoming() - .getResolutionResult() - .getAllComponents() - .forEach( - component -> { - if (component.getId() instanceof ProjectComponentIdentifier project) { - String projectPath = project.getProjectPath().replaceFirst("^:", ""); - if (!projectPath.equals(rule.moduleName())) { - actual.add(projectPath); - } - } - }); - Set forbidden = new TreeSet<>(actual); - forbidden.removeAll(rule.allowedDependencies()); - if (!forbidden.isEmpty()) { - dependencyViolations.add( - "Module ':" - + rule.moduleName() - + "' has forbidden project dependencies " - + forbidden - + ". Allowed dependencies are " - + new TreeSet<>(rule.allowedDependencies())); - } - } - if (!dependencyViolations.isEmpty()) { - throw new GradleException( - String.join("\n", dependencyViolations) - + "\nDirect and compile-visible production project edges must be explicitly registered."); + + " are not covered by verifyCleanArchitectureDependencies. Add an explicit dependency" + + " policy before using them."); } } } diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/VerifyModuleDependencyDirectionTask.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/VerifyModuleDependencyDirectionTask.java new file mode 100644 index 00000000..f22bbf98 --- /dev/null +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/architecture/VerifyModuleDependencyDirectionTask.java @@ -0,0 +1,89 @@ +package dev.caskeleton.buildlogic.architecture; + +import dev.caskeleton.buildlogic.ResolvedComponents; +import java.util.HashSet; +import java.util.Set; +import java.util.TreeSet; +import org.gradle.api.DefaultTask; +import org.gradle.api.GradleException; +import org.gradle.api.artifacts.component.ProjectComponentIdentifier; +import org.gradle.api.artifacts.result.ResolvedComponentResult; +import org.gradle.api.provider.Property; +import org.gradle.api.provider.SetProperty; +import org.gradle.api.tasks.Input; +import org.gradle.api.tasks.Internal; +import org.gradle.api.tasks.TaskAction; +import org.gradle.work.DisableCachingByDefault; + +/** + * One module's own dependency-direction check, run by the project that owns the configurations. + * + *

This used to be a loop inside the root task, which reached into every other project and + * resolved its {@code compileClasspath}. That is the one thing a task must not do: a configuration + * belongs to its project, and resolving it from somewhere else asks Gradle for state it holds under + * another project's lock. With {@code org.gradle.parallel=true} that is not a style objection — the + * root task failed outright, which is why the flag was turned back off rather than the verification + * moved. Here the task and the configurations are in the same project, so the check costs the build + * nothing to parallelise. + * + *

The task keeps no {@code Configuration}. It keeps the declared project edges as strings and the + * compile classpath's resolved root component, both established while the owning project is + * configuring. Holding the configurations themselves is what made this task unstorable in the + * configuration cache. + * + *

The root task keeps what is genuinely repository-wide — the registry's own consistency, and + * whether the set of governed modules matches the set of declared ones — and depends on every one of + * these. + */ +@DisableCachingByDefault(because = "Verification inspects live declarations and a resolved classpath") +public abstract class VerifyModuleDependencyDirectionTask extends DefaultTask { + + /** The registry name of the module this task governs. */ + @Input + public abstract Property getModuleName(); + + /** The module ids this module's registry entry permits. */ + @Input + public abstract SetProperty getAllowedDependencies(); + + /** Project paths this module declares in {@code api/implementation/compileOnly/runtimeOnly}. */ + @Input + public abstract SetProperty getDeclaredProjectEdges(); + + /** Root of this module's resolved {@code compileClasspath}. */ + @Internal + public abstract Property getCompileClasspathRoot(); + + @TaskAction + public void verify() { + String moduleName = getModuleName().get(); + Set allowed = getAllowedDependencies().get(); + + Set actual = new HashSet<>(getDeclaredProjectEdges().get()); + // Declared edges are not the whole story: an `api(project(...))` two leaves away is visible to + // this module's compiler and is therefore a real edge, whatever this build file says. + for (ResolvedComponentResult component : + ResolvedComponents.reachableFrom(getCompileClasspathRoot().get())) { + if (component.getId() instanceof ProjectComponentIdentifier project) { + String projectPath = project.getProjectPath().replaceFirst("^:", ""); + if (!projectPath.equals(moduleName)) { + actual.add(projectPath); + } + } + } + + Set forbidden = new TreeSet<>(actual); + forbidden.removeAll(allowed); + if (!forbidden.isEmpty()) { + throw new GradleException( + "Module ':" + + moduleName + + "' has forbidden project dependencies " + + forbidden + + ". Allowed dependencies are " + + new TreeSet<>(allowed) + + ".\nDirect and compile-visible production project edges must be explicitly" + + " registered."); + } + } +} diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/bootstrap/DeveloperBootstrapPlugin.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/bootstrap/DeveloperBootstrapPlugin.java index a671d24f..71f01fa5 100644 --- a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/bootstrap/DeveloperBootstrapPlugin.java +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/bootstrap/DeveloperBootstrapPlugin.java @@ -13,6 +13,11 @@ import org.gradle.api.tasks.TaskProvider; public final class DeveloperBootstrapPlugin implements Plugin { private static final String GROUP = "developer experience"; + /** Selects the compose overlay merged onto docker-compose.yml. */ + public static final String PROFILE_PROPERTY = "bootstrapProfile"; + + private static final String DEFAULT_PROFILE = "local"; + @Override public void apply(Project project) { if (project != project.getRootProject()) { @@ -20,8 +25,31 @@ public final class DeveloperBootstrapPlugin implements Plugin { } File repositoryDirectory = project.getProjectDir().getParentFile(); + + // Which environment this bootstrap brings up. `local` stays the default, so the four-stage + // contract a developer already knows is unchanged when nothing is passed. + // + // A property rather than a `scripts/run ` wrapper: the ordered lifecycle — compile, Docker + // preflight, dependency wait, migrate-and-start, health smoke — already lives here, and a shell + // script would either duplicate it or become a second entry point that drifts from it. The only + // thing the environment decides is which overlay merges onto the base compose file. + String profile = String.valueOf(project.findProperty(PROFILE_PROPERTY)); + if ("null".equals(profile)) { + profile = DEFAULT_PROFILE; + } + File overlay = new File(repositoryDirectory, "docker-compose." + profile + ".yml"); + if (!overlay.isFile()) { + throw new GradleException( + "bootstrap: -P" + + PROFILE_PROPERTY + + "=" + + profile + + " names no overlay; expected " + + overlay.getName() + + " beside docker-compose.yml. Available: " + + availableProfiles(repositoryDirectory)); + } File baseComposeFile = new File(repositoryDirectory, "docker-compose.yml"); - File localComposeFile = new File(repositoryDirectory, "docker-compose.local.yml"); List composeCommand = List.of( "docker", @@ -29,7 +57,8 @@ public final class DeveloperBootstrapPlugin implements Plugin { "-f", baseComposeFile.getAbsolutePath(), "-f", - localComposeFile.getAbsolutePath()); + overlay.getAbsolutePath()); + String bootstrapProfile = profile; TaskProvider compile = project @@ -79,7 +108,9 @@ public final class DeveloperBootstrapPlugin implements Plugin { task -> { task.setGroup(GROUP); task.setDescription( - "Stage 2/4: starts the local PostgreSQL dependency and waits for readiness."); + "Stage 2/4: starts the " + + bootstrapProfile + + " PostgreSQL dependency and waits for readiness."); task.dependsOn(dockerPreflight); task.commandLine(command(composeCommand, "up", "-d", "--wait", "db")); }); @@ -120,11 +151,37 @@ public final class DeveloperBootstrapPlugin implements Plugin { "bootstrap", task -> { task.setGroup(GROUP); - task.setDescription("Runs the complete four-stage local bootstrap contract."); + task.setDescription( + "Runs the complete four-stage bootstrap contract for the " + + bootstrapProfile + + " environment. Select another with -P" + + PROFILE_PROPERTY + + "=."); task.dependsOn(smoke); }); } + /** The overlay names that exist beside the base compose file, for the failure message. */ + private static List availableProfiles(File repositoryDirectory) { + File[] files = repositoryDirectory.listFiles(); + if (files == null) { + return List.of(); + } + List profiles = new ArrayList<>(); + for (File file : files) { + String name = file.getName(); + // The base file is `docker-compose.yml`, which matches both affixes and names no profile. + int start = "docker-compose.".length(); + int end = name.length() - ".yml".length(); + if (file.isFile() && name.startsWith("docker-compose.") && name.endsWith(".yml") + && end > start) { + profiles.add(name.substring(start, end)); + } + } + profiles.sort(String::compareTo); + return List.copyOf(profiles); + } + private static List command(List prefix, String... arguments) { List command = new ArrayList<>(prefix.size() + arguments.length); command.addAll(prefix); diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/dependency/DependencyPolicyCheck.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/dependency/DependencyPolicyCheck.java index 5b95c6f1..04151aee 100644 --- a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/dependency/DependencyPolicyCheck.java +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/dependency/DependencyPolicyCheck.java @@ -2,17 +2,25 @@ package dev.caskeleton.buildlogic.dependency; import java.util.List; import java.util.Objects; -import org.gradle.api.artifacts.Configuration; -record DependencyPolicyCheck( +/** + * One configuration's declared policy, as data. + * + *

It used to carry the {@link org.gradle.api.artifacts.Configuration} itself, so the task + * resolved the graph in its own action. The configuration cache cannot store a {@code + * Configuration}, and the resolved root component the task is handed instead is the same graph + * established while the declaring project is still configuring. + * + *

Public because the configuration cache reconstructs a record through its canonical + * constructor, and a package-private record has a package-private one. + */ +public record DependencyPolicyCheck( String configurationName, - Configuration configuration, List absences, List absencePatterns, List presences) { - DependencyPolicyCheck { + public DependencyPolicyCheck { Objects.requireNonNull(configurationName, "configurationName"); - Objects.requireNonNull(configuration, "configuration"); absences = List.copyOf(absences); absencePatterns = List.copyOf(absencePatterns); presences = List.copyOf(presences); diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/dependency/DependencyPolicyPlugin.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/dependency/DependencyPolicyPlugin.java index 6e804d86..bc2de934 100644 --- a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/dependency/DependencyPolicyPlugin.java +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/dependency/DependencyPolicyPlugin.java @@ -1,13 +1,17 @@ package dev.caskeleton.buildlogic.dependency; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; +import java.util.Map; import java.util.Set; import org.gradle.api.GradleException; import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; +import org.gradle.api.artifacts.result.ResolvedComponentResult; +import org.gradle.api.provider.Provider; import org.gradle.language.base.plugins.LifecycleBasePlugin; public final class DependencyPolicyPlugin implements Plugin { @@ -41,6 +45,7 @@ public final class DependencyPolicyPlugin implements Plugin { patterns.forEach(declaration -> names.add(declaration.configuration())); presences.forEach(declaration -> names.add(declaration.configuration())); List checks = new ArrayList<>(); + Map> roots = new LinkedHashMap<>(); for (String name : names) { Configuration configuration = project.getConfigurations().findByName(name); if (configuration == null) { @@ -57,10 +62,11 @@ public final class DependencyPolicyPlugin implements Plugin { + name + "', which cannot be resolved"); } + roots.put( + name, configuration.getIncoming().getResolutionResult().getRootComponent()); checks.add( new DependencyPolicyCheck( name, - configuration, forConfiguration(absences, name), patterns.stream() .filter(declaration -> declaration.configuration().equals(name)) @@ -73,6 +79,7 @@ public final class DependencyPolicyPlugin implements Plugin { task -> { task.setOwnerPath(project.getPath()); task.setChecks(checks); + roots.forEach((name, root) -> task.getResolvedRoots().put(name, root)); }); project .getTasks() diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/dependency/VerifyDependencyPolicyTask.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/dependency/VerifyDependencyPolicyTask.java index 31bb906f..2dcf3265 100644 --- a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/dependency/VerifyDependencyPolicyTask.java +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/dependency/VerifyDependencyPolicyTask.java @@ -1,19 +1,23 @@ package dev.caskeleton.buildlogic.dependency; +import dev.caskeleton.buildlogic.ResolvedComponents; import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.regex.Pattern; import org.gradle.api.DefaultTask; import org.gradle.api.GradleException; import org.gradle.api.artifacts.ModuleVersionIdentifier; +import org.gradle.api.artifacts.result.ResolvedComponentResult; +import org.gradle.api.provider.MapProperty; import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.TaskAction; import org.gradle.work.DisableCachingByDefault; @DisableCachingByDefault(because = "Verification depends on the live resolved dependency graph") -public class VerifyDependencyPolicyTask extends DefaultTask { +public abstract class VerifyDependencyPolicyTask extends DefaultTask { private List checks = List.of(); private String ownerPath = ":"; @@ -35,11 +39,16 @@ public class VerifyDependencyPolicyTask extends DefaultTask { this.ownerPath = ownerPath; } + /** Resolved root component per declared configuration name. */ + @Internal + public abstract MapProperty getResolvedRoots(); + @TaskAction public void verifyPolicy() { List violations = new ArrayList<>(); + Map roots = getResolvedRoots().get(); for (DependencyPolicyCheck check : checks) { - Set resolved = resolvedModules(check); + Set resolved = resolvedModules(roots.get(check.configurationName())); verifyExactAbsences(check, resolved, violations); verifyPatternAbsences(check, resolved, violations); verifyPresences(check, resolved, violations); @@ -53,20 +62,14 @@ public class VerifyDependencyPolicyTask extends DefaultTask { } } - private static Set resolvedModules(DependencyPolicyCheck check) { + private static Set resolvedModules(ResolvedComponentResult root) { Set resolved = new HashSet<>(); - check - .configuration() - .getIncoming() - .getResolutionResult() - .getAllComponents() - .forEach( - component -> { - ModuleVersionIdentifier version = component.getModuleVersion(); - if (version != null) { - resolved.add(version.getGroup() + ":" + version.getName()); - } - }); + for (ResolvedComponentResult component : ResolvedComponents.reachableFrom(root)) { + ModuleVersionIdentifier version = component.getModuleVersion(); + if (version != null) { + resolved.add(version.getGroup() + ":" + version.getName()); + } + } return resolved; } diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/java/JavaConventionsPlugin.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/java/JavaConventionsPlugin.java index ee2714b1..a309ce34 100644 --- a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/java/JavaConventionsPlugin.java +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/java/JavaConventionsPlugin.java @@ -25,10 +25,17 @@ public final class JavaConventionsPlugin implements Plugin { public void apply(Project project) { project.getPluginManager().apply("java"); project.getPluginManager().apply("io.spring.dependency-management"); + // Two, not five. `ca.strict-test-lane` supplies the per-leaf `*TestLaneCheck` aggregates that the + // root's repository-wide tasks depend on by path, so every Java leaf has to have them or the + // root task graph cannot be built; `ca.test-jvm-agents` attaches the Mockito startup agent to + // every `Test` task, and a leaf that quietly lost it would self-attach instead. + // + // The other three governed nothing here. `ca.api-surface` is configured by three leaves, + // `ca.dependency-policy` by two and `ca.strict-qualification` by nine, and applying them to + // every Java leaf put an extension on all of them and a `verifyDependencyPolicy` task that + // checks an empty policy on all of them. A leaf that wants one now says so, which is also the + // only way to read a build file and learn which governance applies to it. project.getPluginManager().apply("ca.strict-test-lane"); - project.getPluginManager().apply("ca.api-surface"); - project.getPluginManager().apply("ca.dependency-policy"); - project.getPluginManager().apply("ca.strict-qualification"); project.getPluginManager().apply("ca.test-jvm-agents"); var catalog = project.getExtensions().getByType(VersionCatalogsExtension.class).named("libs"); diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/RuntimeCompositionCheck.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/RuntimeCompositionCheck.java deleted file mode 100644 index cab344c8..00000000 --- a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/RuntimeCompositionCheck.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.caskeleton.buildlogic.runtime; - -import java.util.Objects; -import org.gradle.api.artifacts.Configuration; - -record RuntimeCompositionCheck( - String compositionId, String projectPath, Configuration runtimeClasspath) { - RuntimeCompositionCheck { - Objects.requireNonNull(compositionId, "compositionId"); - Objects.requireNonNull(projectPath, "projectPath"); - Objects.requireNonNull(runtimeClasspath, "runtimeClasspath"); - } -} diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/RuntimeMembershipPlugin.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/RuntimeMembershipPlugin.java index ed63cbb1..9b51567a 100644 --- a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/RuntimeMembershipPlugin.java +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/RuntimeMembershipPlugin.java @@ -12,6 +12,8 @@ import org.gradle.api.GradleException; import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; +import org.gradle.api.artifacts.result.ResolvedComponentResult; +import org.gradle.api.provider.Provider; public final class RuntimeMembershipPlugin implements Plugin { @Override @@ -46,18 +48,18 @@ public final class RuntimeMembershipPlugin implements Plugin { .getTasks() .register( "verifyRuntimeModuleRegistry", - VerifyRuntimeModuleRegistryTask.class, task -> { task.setGroup("verification"); task.setDescription( "Verifies resolved composition runtime project dependencies are registered application modules."); - task.getRegistryFile().fileValue(registryFile); - task.getRegisteredProjectPaths().set(registeredPaths); }); project.getGradle().projectsEvaluated( ignored -> { - List checks = new ArrayList<>(); + // One task per composition root, in the composition root. Resolving + // `:app-bootstrap:runtimeClasspath` from the build root is the same cross-project + // resolution that made `org.gradle.parallel=true` fail. + List compositionTaskPaths = new ArrayList<>(); for (String compositionId : compositionIds) { ModuleRegistry.Module composition = registry.byId(compositionId); Project compositionProject = root.findProject(composition.gradlePath()); @@ -77,11 +79,28 @@ public final class RuntimeMembershipPlugin implements Plugin { + compositionId + "' has no runtimeClasspath configuration."); } - checks.add( - new RuntimeCompositionCheck( - compositionId, compositionProject.getPath(), runtimeClasspath)); + String compositionPath = compositionProject.getPath(); + Provider runtimeClasspathRoot = + runtimeClasspath.getIncoming().getResolutionResult().getRootComponent(); + compositionProject + .getTasks() + .register( + "verifyCompositionRuntimeMembership", + VerifyCompositionRuntimeMembershipTask.class, + task -> { + task.setGroup("verification"); + task.setDescription( + "Verifies this composition root resolves only registered application" + + " modules."); + task.getCompositionId().set(compositionId); + task.getRegisteredProjectPaths().set(registeredPaths); + task.getCompositionProjectPath().set(compositionPath); + task.getRuntimeClasspathRoot().set(runtimeClasspathRoot); + }); + compositionTaskPaths.add( + composition.gradlePath() + ":verifyCompositionRuntimeMembership"); } - verify.configure(task -> task.setChecks(checks)); + verify.configure(task -> task.dependsOn(compositionTaskPaths)); }); project diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/VerifyCompositionRuntimeMembershipTask.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/VerifyCompositionRuntimeMembershipTask.java new file mode 100644 index 00000000..801af83d --- /dev/null +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/VerifyCompositionRuntimeMembershipTask.java @@ -0,0 +1,78 @@ +package dev.caskeleton.buildlogic.runtime; + +import dev.caskeleton.buildlogic.ResolvedComponents; +import java.util.HashSet; +import java.util.Set; +import java.util.TreeSet; +import org.gradle.api.DefaultTask; +import org.gradle.api.GradleException; +import org.gradle.api.artifacts.component.ProjectComponentIdentifier; +import org.gradle.api.artifacts.result.ResolvedComponentResult; +import org.gradle.api.provider.Property; +import org.gradle.api.provider.SetProperty; +import org.gradle.api.tasks.Input; +import org.gradle.api.tasks.Internal; +import org.gradle.api.tasks.TaskAction; +import org.gradle.work.DisableCachingByDefault; + +/** + * One composition root's runtime membership check, run by the project that owns the classpath. + * + *

Registered in the composition root rather than at the build root. The build-root form resolved + * {@code :app-bootstrap:runtimeClasspath} from outside that project, which Gradle refuses once + * project execution is parallel — the same reason the dependency-direction and application-purity + * checks moved. The question is unchanged: does what this artifact actually resolves consist only of + * modules the registry knows about. + * + *

What the task keeps is the resolved root component, not the {@code Configuration}. A + * {@code Configuration} is live build state that the configuration cache cannot store, and a task + * that resolves one in its action resolves it from whichever project runs the action. + */ +@DisableCachingByDefault(because = "Verification resolves a live runtime classpath") +public abstract class VerifyCompositionRuntimeMembershipTask extends DefaultTask { + + /** The registry id of the composition root this task governs. */ + @Input + public abstract Property getCompositionId(); + + /** Every project path the registry registers as an application module. */ + @Input + public abstract SetProperty getRegisteredProjectPaths(); + + /** The composition root's own Gradle path, which is never an unregistered member of itself. */ + @Input + public abstract Property getCompositionProjectPath(); + + /** Root of this composition root's resolved {@code runtimeClasspath}. */ + @Internal + public abstract Property getRuntimeClasspathRoot(); + + @TaskAction + public void verify() { + String ownPath = getCompositionProjectPath().get(); + Set registered = getRegisteredProjectPaths().get(); + Set resolved = new HashSet<>(); + for (ResolvedComponentResult component : + ResolvedComponents.reachableFrom(getRuntimeClasspathRoot().get())) { + if (component.getId() instanceof ProjectComponentIdentifier project + && !project.getProjectPath().equals(ownPath)) { + resolved.add(project.getProjectPath()); + } + } + + Set unregistered = new TreeSet<>(resolved); + unregistered.removeAll(registered); + if (!unregistered.isEmpty()) { + throw new GradleException( + "Runtime composition '" + + getCompositionId().get() + + "' resolves unregistered application projects " + + unregistered + + "."); + } + getLogger() + .lifecycle( + "verifyCompositionRuntimeMembership: {} resolves only registered application projects", + getCompositionId().get()); + } +} diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/VerifyRuntimeModuleRegistryTask.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/VerifyRuntimeModuleRegistryTask.java deleted file mode 100644 index 6844e34a..00000000 --- a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/runtime/VerifyRuntimeModuleRegistryTask.java +++ /dev/null @@ -1,71 +0,0 @@ -package dev.caskeleton.buildlogic.runtime; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; -import org.gradle.api.DefaultTask; -import org.gradle.api.GradleException; -import org.gradle.api.artifacts.component.ProjectComponentIdentifier; -import org.gradle.api.file.RegularFileProperty; -import org.gradle.api.provider.SetProperty; -import org.gradle.api.tasks.Input; -import org.gradle.api.tasks.InputFile; -import org.gradle.api.tasks.Internal; -import org.gradle.api.tasks.TaskAction; -import org.gradle.work.DisableCachingByDefault; - -@DisableCachingByDefault(because = "Verification resolves live runtime classpaths") -public abstract class VerifyRuntimeModuleRegistryTask extends DefaultTask { - private List checks = List.of(); - - @InputFile - public abstract RegularFileProperty getRegistryFile(); - - @Input - public abstract SetProperty getRegisteredProjectPaths(); - - @Internal - List getChecks() { - return checks; - } - - void setChecks(List checks) { - this.checks = List.copyOf(checks); - } - - @TaskAction - public void verifyRuntimeRegistry() { - Set registered = getRegisteredProjectPaths().get(); - for (RuntimeCompositionCheck check : checks) { - Set actualProjectPaths = new HashSet<>(); - check - .runtimeClasspath() - .getIncoming() - .getResolutionResult() - .getAllComponents() - .forEach( - component -> { - if (component.getId() instanceof ProjectComponentIdentifier project - && !project.getProjectPath().equals(check.projectPath())) { - actualProjectPaths.add(project.getProjectPath()); - } - }); - Set unregistered = new TreeSet<>(actualProjectPaths); - unregistered.removeAll(registered); - if (!unregistered.isEmpty()) { - throw new GradleException( - "Runtime composition '" - + check.compositionId() - + "' resolves unregistered application projects " - + unregistered - + "."); - } - } - getLogger() - .lifecycle( - "verifyRuntimeModuleRegistry: {} composition root(s) resolve only registered application projects", - checks.size()); - } -} diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/strictlane/ExclusiveRealServerLaneService.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/strictlane/ExclusiveRealServerLaneService.java new file mode 100644 index 00000000..f49c983b --- /dev/null +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/strictlane/ExclusiveRealServerLaneService.java @@ -0,0 +1,24 @@ +package dev.caskeleton.buildlogic.strictlane; + +import org.gradle.api.services.BuildService; +import org.gradle.api.services.BuildServiceParameters; + +/** + * One slot, shared by every lane that starts a real server or container. + * + *

Turning on {@code org.gradle.parallel} made three {@code ReactiveWebThrottleIT} cases and a + * WebSocket shutdown contract fail on socket timeouts, and pass when run alone. Those lanes start an + * embedded Tomcat, Jetty or Reactor Netty and then assert on timing — a permit released at the wrong + * moment, a capacity refusal that has to arrive inside a five-second read timeout, connections + * closed rather than dropped during shutdown. Several of them at once means the machine decides the + * result, not the code, and a gate whose result depends on the machine is the kind this repository's + * own review says gets switched off within a quarter. + * + *

Ordering them inside one leaf was not enough: the contention is across leaves. A build service + * with {@code maxParallelUsages = 1} is Gradle's answer to "these tasks must not overlap", and it + * scopes to exactly the lanes that need it — every strict lane whose category is not {@code TEST}. + * The hermetic unit lanes, which are the bulk of the build and the reason to run in parallel at all, + * are untouched. + */ +public abstract class ExclusiveRealServerLaneService + implements BuildService {} diff --git a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/strictlane/StrictTestLanePlugin.java b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/strictlane/StrictTestLanePlugin.java index 75b4e567..d93a763a 100644 --- a/src/build-logic/src/main/java/dev/caskeleton/buildlogic/strictlane/StrictTestLanePlugin.java +++ b/src/build-logic/src/main/java/dev/caskeleton/buildlogic/strictlane/StrictTestLanePlugin.java @@ -135,6 +135,20 @@ public final class StrictTestLanePlugin implements Plugin { StrictTestLaneSpec lane, Test test) { SourceSet sourceSet = java.getSourceSets().getByName(lane.getSourceSet()); + if (lane.getCategory() != TestLaneCategory.TEST) { + // Everything that is not a hermetic unit lane starts a server, a container or both, and + // several of those at once under `org.gradle.parallel` makes the machine decide the result. + // One slot for all of them, build-wide — ordering them inside a leaf was not enough, because + // the web and websocket lanes contend with each other across leaves. + test.usesService( + project + .getGradle() + .getSharedServices() + .registerIfAbsent( + "exclusiveRealServerLane", + ExclusiveRealServerLaneService.class, + specification -> specification.getMaxParallelUsages().set(1))); + } test.setGroup( lane.getGroup() == null || lane.getGroup().isBlank() ? "verification" : lane.getGroup()); test.setDescription(lane.getDescription()); diff --git a/src/build-logic/src/test/java/dev/caskeleton/bootstrap/contract/RuntimeMembershipFunctionalTest.java b/src/build-logic/src/test/java/dev/caskeleton/bootstrap/contract/RuntimeMembershipFunctionalTest.java index 2bfab6bf..147f8cab 100644 --- a/src/build-logic/src/test/java/dev/caskeleton/bootstrap/contract/RuntimeMembershipFunctionalTest.java +++ b/src/build-logic/src/test/java/dev/caskeleton/bootstrap/contract/RuntimeMembershipFunctionalTest.java @@ -21,9 +21,14 @@ final class RuntimeMembershipFunctionalTest { BuildResult result = run(fixture.projectDirectory(), "verifyRuntimeModuleRegistry"); + // The aggregate no longer does the resolving, so it no longer reports a count: one task per + // composition root does, in the project that owns the classpath, and each names itself. Asserting + // the per-root line is also the stronger claim — a count of one says nothing about which root. assertThat(result.getOutput()) + .contains(":app-bootstrap:verifyCompositionRuntimeMembership") .contains( - "verifyRuntimeModuleRegistry: 1 composition root(s) resolve only registered application projects"); + "verifyCompositionRuntimeMembership: app-bootstrap resolves only registered application" + + " projects"); } @Test diff --git a/src/build-logic/src/test/java/dev/caskeleton/buildlogic/bootstrap/DeveloperBootstrapPluginFunctionalTest.java b/src/build-logic/src/test/java/dev/caskeleton/buildlogic/bootstrap/DeveloperBootstrapPluginFunctionalTest.java index aa598754..63eec479 100644 --- a/src/build-logic/src/test/java/dev/caskeleton/buildlogic/bootstrap/DeveloperBootstrapPluginFunctionalTest.java +++ b/src/build-logic/src/test/java/dev/caskeleton/buildlogic/bootstrap/DeveloperBootstrapPluginFunctionalTest.java @@ -25,7 +25,37 @@ final class DeveloperBootstrapPluginFunctionalTest { .contains("bootstrapDependencies") .contains("bootstrapMigrateAndStart") .contains("bootstrapSmoke") - .contains("bootstrap - Runs the complete four-stage local bootstrap contract."); + .contains("bootstrap - Runs the complete four-stage bootstrap contract for the local") + .contains("-PbootstrapProfile="); + } + + @Test + void theEnvironmentIsSelectableAndTheDefaultIsLocal(@TempDir Path temporaryDirectory) + throws IOException { + Path projectDirectory = fixture(temporaryDirectory); + + BuildResult devRun = + run(projectDirectory, "tasks", "--group=developer experience", "-PbootstrapProfile=dev"); + + assertThat(devRun.getOutput()) + .contains("bootstrap contract for the dev") + .contains("starts the dev PostgreSQL dependency"); + } + + @Test + void aProfileWithNoOverlayIsRefusedAndTheMessageListsTheRealOnes( + @TempDir Path temporaryDirectory) throws IOException { + // The failure a developer is most likely to hit is a typo, and the answer they need is which + // names exist — read off the directory rather than from a list somebody has to maintain. + Path projectDirectory = fixture(temporaryDirectory); + + BuildResult failure = + runAndFail(projectDirectory, "tasks", "-PbootstrapProfile=staging"); + + assertThat(failure.getOutput()) + .contains("names no overlay") + .contains("docker-compose.staging.yml") + .contains("[dev, local]"); } @Test @@ -46,6 +76,11 @@ final class DeveloperBootstrapPluginFunctionalTest { Path repositoryRoot = temporaryDirectory.resolve("repository"); Path projectDirectory = repositoryRoot.resolve("src"); Files.createDirectories(projectDirectory.resolve("app-bootstrap")); + // The bootstrap merges an overlay onto the base compose file and refuses a profile that names + // none, so the fixture has to carry the two the repository carries. + Files.writeString(repositoryRoot.resolve("docker-compose.yml"), "services: {}\n", UTF_8); + Files.writeString(repositoryRoot.resolve("docker-compose.local.yml"), "services: {}\n", UTF_8); + Files.writeString(repositoryRoot.resolve("docker-compose.dev.yml"), "services: {}\n", UTF_8); Files.writeString( projectDirectory.resolve("settings.gradle"), "rootProject.name='fixture'\ninclude 'app-bootstrap'\n", @@ -61,6 +96,21 @@ final class DeveloperBootstrapPluginFunctionalTest { return projectDirectory; } + private static BuildResult runAndFail(Path projectDirectory, String... arguments) { + return GradleRunner.create() + .withProjectDir(projectDirectory.toFile()) + .withPluginClasspath() + .withArguments(withConsole(arguments)) + .buildAndFail(); + } + + private static String[] withConsole(String... arguments) { + String[] fullArguments = new String[arguments.length + 1]; + fullArguments[0] = "--console=plain"; + System.arraycopy(arguments, 0, fullArguments, 1, arguments.length); + return fullArguments; + } + private static BuildResult run(Path projectDirectory, String... arguments) { String[] fullArguments = new String[arguments.length + 1]; fullArguments[0] = "--console=plain"; diff --git a/src/build-tools/src/main/java/dev/caskeleton/buildtools/config/ConfigContractPlugin.java b/src/build-tools/src/main/java/dev/caskeleton/buildtools/config/ConfigContractPlugin.java index af3cc1fd..b9dba92c 100644 --- a/src/build-tools/src/main/java/dev/caskeleton/buildtools/config/ConfigContractPlugin.java +++ b/src/build-tools/src/main/java/dev/caskeleton/buildtools/config/ConfigContractPlugin.java @@ -7,23 +7,11 @@ import org.gradle.api.Project; public final class ConfigContractPlugin implements Plugin { @Override public void apply(Project project) { + // No verifyOperationalErrorRegistry here any more. Comparing OperationalError with + // docs/registries/error-codes.yaml needs no dependency resolution, no task graph and no + // included build, so it is app-bootstrap's OperationalErrorRegistryContractTest — which also + // gets to use a real YAML parser instead of the line-prefix scanner this task carried. Project root = project.getRootProject(); - project - .getTasks() - .register( - "verifyOperationalErrorRegistry", - VerifyOperationalErrorRegistryTask.class, - task -> { - task.setGroup("verification"); - task.setDescription( - "Verifies OperationalError and docs/registries/error-codes.yaml stay exactly aligned."); - task.getRegistryFile() - .fileValue(root.file("../docs/registries/error-codes.yaml")); - task.getOperationalErrorSource() - .fileValue( - root.file( - "shared-contract/src/main/java/dev/caskeleton/shared/error/OperationalError.java")); - }); project .getTasks() .register( diff --git a/src/build-tools/src/main/java/dev/caskeleton/buildtools/config/VerifyOperationalErrorRegistryTask.java b/src/build-tools/src/main/java/dev/caskeleton/buildtools/config/VerifyOperationalErrorRegistryTask.java deleted file mode 100644 index 2f409a58..00000000 --- a/src/build-tools/src/main/java/dev/caskeleton/buildtools/config/VerifyOperationalErrorRegistryTask.java +++ /dev/null @@ -1,156 +0,0 @@ -package dev.caskeleton.buildtools.config; - -import java.io.IOException; -import java.io.UncheckedIOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.gradle.api.DefaultTask; -import org.gradle.api.GradleException; -import org.gradle.api.file.RegularFileProperty; -import org.gradle.api.tasks.InputFile; -import org.gradle.api.tasks.TaskAction; -import org.gradle.work.DisableCachingByDefault; - -/** Keeps the skeleton-wide OperationalError enum and error-codes registry exactly aligned. */ -@DisableCachingByDefault(because = "Verification reads two small live repository contracts") -public abstract class VerifyOperationalErrorRegistryTask extends DefaultTask { - - private static final Pattern ENUM_ENTRY = - Pattern.compile( - "(?m)^\\s*([A-Z][A-Z0-9_]+)\\s*\\(Category\\.([A-Z_]+),\\s*(\\d+),\\s*(true|false)\\)"); - - @InputFile - public abstract RegularFileProperty getRegistryFile(); - - @InputFile - public abstract RegularFileProperty getOperationalErrorSource(); - - @TaskAction - public void verify() { - String registry = read(getRegistryFile().get().getAsFile().toPath()); - String source = read(getOperationalErrorSource().get().getAsFile().toPath()); - - Map code = parseEnum(source); - Map registered = parseRegistry(registry); - - TreeSet violations = new TreeSet<>(); - Set codeOnly = new TreeSet<>(code.keySet()); - codeOnly.removeAll(registered.keySet()); - if (!codeOnly.isEmpty()) { - violations.add("code-only OperationalError entries: " + codeOnly); - } - - Set registryOnly = new TreeSet<>(registered.keySet()); - registryOnly.removeAll(code.keySet()); - if (!registryOnly.isEmpty()) { - violations.add("registry-only operational entries: " + registryOnly); - } - - code.forEach( - (name, expected) -> { - Contract actual = registered.get(name); - if (actual != null && !actual.equals(expected)) { - violations.add( - name - + " metadata differs: code=" - + expected - + ", registry=" - + actual); - } - }); - - if (!violations.isEmpty()) { - throw new GradleException( - "verifyOperationalErrorRegistry: " - + violations.size() - + " violation(s):\n " - + String.join("\n ", violations)); - } - - getLogger() - .lifecycle( - "verifyOperationalErrorRegistry: OK — {} OperationalError entries match error-codes.yaml.", - code.size()); - } - - private static Map parseEnum(String source) { - Map result = new LinkedHashMap<>(); - Matcher matcher = ENUM_ENTRY.matcher(source); - while (matcher.find()) { - result.put( - matcher.group(1), - new Contract( - matcher.group(2), - Integer.parseInt(matcher.group(3)), - Boolean.parseBoolean(matcher.group(4)))); - } - if (result.isEmpty()) { - throw new GradleException("verifyOperationalErrorRegistry: no OperationalError constants found"); - } - return result; - } - - private static Map parseRegistry(String yaml) { - Map result = new LinkedHashMap<>(); - String current = null; - String category = null; - Integer status = null; - Boolean retryable = null; - - for (String raw : yaml.split("\\R")) { - String line = raw.trim(); - if (line.startsWith("- code:")) { - if (current != null) { - putRegistryRow(result, current, category, status, retryable); - } - current = line.substring("- code:".length()).trim(); - category = null; - status = null; - retryable = null; - } else if (current != null && line.startsWith("category:")) { - category = line.substring("category:".length()).trim(); - } else if (current != null && line.startsWith("http_status:")) { - status = Integer.valueOf(line.substring("http_status:".length()).trim()); - } else if (current != null && line.startsWith("retryable:")) { - retryable = Boolean.valueOf(line.substring("retryable:".length()).trim()); - } - } - if (current != null) { - putRegistryRow(result, current, category, status, retryable); - } - return result; - } - - private static void putRegistryRow( - Map result, - String code, - String category, - Integer status, - Boolean retryable) { - if (category == null || status == null || retryable == null) { - throw new GradleException( - "verifyOperationalErrorRegistry: incomplete registry row for " + code); - } - Contract previous = result.put(code, new Contract(category, status, retryable)); - if (previous != null) { - throw new GradleException( - "verifyOperationalErrorRegistry: duplicate registry code " + code); - } - } - - private static String read(java.nio.file.Path path) { - try { - return Files.readString(path, StandardCharsets.UTF_8); - } catch (IOException exception) { - throw new UncheckedIOException("failed to read " + path, exception); - } - } - - private record Contract(String category, int httpStatus, boolean retryable) {} -} diff --git a/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/JpaEvidencePlugin.java b/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/JpaEvidencePlugin.java index dec2ed16..20c173e3 100644 --- a/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/JpaEvidencePlugin.java +++ b/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/JpaEvidencePlugin.java @@ -35,25 +35,6 @@ public final class JpaEvidencePlugin implements Plugin { "jpaEvidenceExecution", JpaEvidenceExecutionService.class, ignored -> {}); buildEventsListenerRegistry.onTaskCompletion(executionService); - TaskProvider verifySetConfigParameterBinding = - project - .getTasks() - .register( - "verifySetConfigParameterBinding", - VerifySetConfigParameterBindingTask.class, - task -> { - task.setGroup("verification"); - task.setDescription( - "Rejects non-parameterized PostgreSQL set_config values anywhere in this leaf."); - task.getMainSource() - .set(project.getLayout().getProjectDirectory().dir("src/main/java")); - }); - - project - .getTasks() - .matching(task -> task.getName().equals("check")) - .configureEach(task -> task.dependsOn(verifySetConfigParameterBinding)); - TaskProvider generate = project .getTasks() diff --git a/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/JpaQualificationPlugin.java b/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/JpaQualificationPlugin.java index 568b3e0f..25fc2318 100644 --- a/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/JpaQualificationPlugin.java +++ b/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/JpaQualificationPlugin.java @@ -72,7 +72,15 @@ public final class JpaQualificationPlugin implements Plugin { tree -> { tree.include("**/src/main/java/**/*.java"); tree.exclude("**/build/**"); + // The leaves that own JPA persistence implementations, excluded + // because they are the implementation rather than an adopter of + // one. There are two: the Fileserver capability's entities, + // repositories and adapters moved out of persistence-jpa into their + // own leaf, and a module cannot be an unsupported consumer of the + // types it declares. This is ownership, not an allowance — the + // baseline file still governs every other module's imports. tree.exclude("adapter/outbound/persistence-jpa/**"); + tree.exclude("adapter/outbound/persistence-fileserver/**"); })); task.getBaseline() .fileValue(root.file("../docs/architecture/jpa-adopter-api-surface.txt")); diff --git a/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/SetConfigParameterBindingResult.java b/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/SetConfigParameterBindingResult.java deleted file mode 100644 index 1ec718e9..00000000 --- a/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/SetConfigParameterBindingResult.java +++ /dev/null @@ -1,9 +0,0 @@ -package dev.caskeleton.buildtools.jpa; - -import java.util.List; - -public record SetConfigParameterBindingResult(List violations) { - public SetConfigParameterBindingResult { - violations = List.copyOf(violations); - } -} diff --git a/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/SetConfigParameterBindingVerifier.java b/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/SetConfigParameterBindingVerifier.java deleted file mode 100644 index e2f4110b..00000000 --- a/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/SetConfigParameterBindingVerifier.java +++ /dev/null @@ -1,45 +0,0 @@ -package dev.caskeleton.buildtools.jpa; - -import java.io.File; -import java.io.IOException; -import java.io.UncheckedIOException; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; - -public final class SetConfigParameterBindingVerifier { - private SetConfigParameterBindingVerifier() {} - - public static SetConfigParameterBindingResult verify(File mainSource) { - List violations = new ArrayList<>(); - if (!mainSource.isDirectory()) { - return new SetConfigParameterBindingResult(violations); - } - try (var paths = Files.walk(mainSource.toPath())) { - for (var source : - paths.filter(Files::isRegularFile) - .filter(path -> path.getFileName().toString().endsWith(".java")) - .sorted(Comparator.naturalOrder()) - .toList()) { - List lines = Files.readAllLines(source); - for (int index = 0; index < lines.size(); index++) { - String line = lines.get(index); - String trimmed = line.trim(); - if (trimmed.startsWith("//") - || trimmed.startsWith("*") - || trimmed.startsWith("/*")) { - continue; - } - if (line.contains("set_config('") && !line.contains("?")) { - violations.add( - source.toFile() + ":" + (index + 1) + ": set_config value is not parameterized"); - } - } - } - } catch (IOException exception) { - throw new UncheckedIOException("cannot scan JPA source tree " + mainSource, exception); - } - return new SetConfigParameterBindingResult(violations); - } -} diff --git a/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/VerifySetConfigParameterBindingTask.java b/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/VerifySetConfigParameterBindingTask.java deleted file mode 100644 index ac6e7178..00000000 --- a/src/build-tools/src/main/java/dev/caskeleton/buildtools/jpa/VerifySetConfigParameterBindingTask.java +++ /dev/null @@ -1,31 +0,0 @@ -package dev.caskeleton.buildtools.jpa; - -import org.gradle.api.DefaultTask; -import org.gradle.api.GradleException; -import org.gradle.api.file.DirectoryProperty; -import org.gradle.api.tasks.InputDirectory; -import org.gradle.api.tasks.TaskAction; -import org.gradle.work.DisableCachingByDefault; - -@DisableCachingByDefault(because = "Repository source verification emits no reusable output") -public abstract class VerifySetConfigParameterBindingTask extends DefaultTask { - @InputDirectory - public abstract DirectoryProperty getMainSource(); - - @TaskAction - public void verifySetConfigParameterBinding() { - SetConfigParameterBindingResult result = - SetConfigParameterBindingVerifier.verify(getMainSource().get().getAsFile()); - if (!result.violations().isEmpty()) { - throw new GradleException( - "verifySetConfigParameterBinding: " - + result.violations().size() - + " violation(s):\n " - + String.join("\n ", result.violations())); - } - getLogger() - .lifecycle( - "verifySetConfigParameterBinding: OK — every set_config value in {} binds a parameter.", - getMainSource().get().getAsFile()); - } -} diff --git a/src/build-tools/src/test/java/dev/caskeleton/buildtools/jpa/SetConfigParameterBindingVerifierTest.java b/src/build-tools/src/test/java/dev/caskeleton/buildtools/jpa/SetConfigParameterBindingVerifierTest.java deleted file mode 100644 index d6c79cc4..00000000 --- a/src/build-tools/src/test/java/dev/caskeleton/buildtools/jpa/SetConfigParameterBindingVerifierTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package dev.caskeleton.buildtools.jpa; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import java.nio.file.Files; -import java.nio.file.Path; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; - -class SetConfigParameterBindingVerifierTest { - @Test - void parameterizedSetConfigIsAccepted(@TempDir Path temp) throws Exception { - write(temp.resolve("Safe.java"), "jdbc.query(\"select set_config('app.tenant_id', ?, true)\");\n"); - - SetConfigParameterBindingResult result = SetConfigParameterBindingVerifier.verify(temp.toFile()); - - assertTrue(result.violations().isEmpty()); - } - - @Test - void nonParameterizedSetConfigReportsFileAndLine(@TempDir Path temp) throws Exception { - Path source = temp.resolve("nested/Unsafe.java"); - write( - source, - "class Unsafe {\n" - + " void one() {}\n" - + " String sql = \"select set_config('app.tenant_id', 'literal', true)\";\n" - + "}\n"); - - SetConfigParameterBindingResult result = SetConfigParameterBindingVerifier.verify(temp.toFile()); - - assertEquals(1, result.violations().size()); - assertTrue(result.violations().getFirst().contains("Unsafe.java:3: set_config value is not parameterized")); - } - - @Test - void commentOnlyMentionsAreIgnored(@TempDir Path temp) throws Exception { - write( - temp.resolve("Comments.java"), - "// set_config('tenant', 'literal', true)\n" - + "/* set_config('tenant', 'literal', true) */\n" - + " * set_config('tenant', 'literal', true)\n"); - - SetConfigParameterBindingResult result = SetConfigParameterBindingVerifier.verify(temp.toFile()); - - assertTrue(result.violations().isEmpty()); - } - - private static void write(Path path, String content) throws Exception { - Files.createDirectories(path.getParent()); - Files.writeString(path, content); - } -} diff --git a/src/build.gradle b/src/build.gradle index 2d907c11..0050f422 100644 --- a/src/build.gradle +++ b/src/build.gradle @@ -99,9 +99,11 @@ tasks.register('qualityCheck') { tasks.register('configContractCheck') { group = 'verification' - description = 'Runs environment and operational error registry contracts owned by the composition root.' + description = 'Runs the environment contract owned by the composition root.' + // verifyEnvKeys only. The operational-error registry contract compared two checked-in files and + // needed nothing from the build, so it is a test in app-bootstrap now + // (OperationalErrorRegistryContractTest) and runs with that leaf's `check`. dependsOn ':app-bootstrap:verifyEnvKeys' - dependsOn ':app-bootstrap:verifyOperationalErrorRegistry' } tasks.register('integrationCheck') { diff --git a/src/composition/fileserver-platform/build.gradle b/src/composition/fileserver-platform/build.gradle new file mode 100644 index 00000000..d20132d5 --- /dev/null +++ b/src/composition/fileserver-platform/build.gradle @@ -0,0 +1,53 @@ +plugins { + id 'ca.spring-library' + id 'ca.spring-config' +} + +// The Fileserver capability's cross-adapter assembly. +// +// It exists because one capability spans four leaves that must not see each other: the HTTP surface +// in `adapter:inbound:web`, the storage and platform policy in `adapter:outbound:fileserver`, the +// quota/recovery tables in `adapter:outbound:persistence-jpa`, and identifier generation. An +// outbound adapter reaching an inbound one is the direction the architecture exists to forbid, so +// something has to hold the assembly — and until now that something was the composition root, which +// is why every application shipped Fileserver whether or not it wanted it. +// +// This module is not a composition root. It composes one capability; it does not run. What decides +// whether an application ships Fileserver is one project dependency in `app-bootstrap/build.gradle`, +// and its absence is enforced there by `dependencyPolicy`. +// +// It is deliberately thin: cross-adapter wiring only. A configuration that knows one leaf belongs to +// that leaf — the fileserver platform's own settings, storage gateway, verification and security +// wiring already moved into `adapter:outbound:fileserver` and must not come back here. +dependencies { + implementation project(':application-core') + implementation project(':application-fileserver') + implementation project(':shared-contract') + implementation project(':adapter:inbound:web-fileserver') + // The web platform itself as well, for `web.auth`: the admin plane composes the capability's + // admin endpoints with the platform's authorization types. That edge is the reason this module + // exists — an adapter reaching a sibling adapter is what it is here to take on. + implementation project(':adapter:inbound:web') + implementation project(':adapter:outbound:fileserver') + implementation project(':adapter:outbound:persistence-fileserver') + implementation project(':adapter:outbound:support') + + implementation 'org.springframework.boot:spring-boot-autoconfigure' + implementation 'org.springframework.boot:spring-boot-starter-actuator' + implementation 'org.springframework:spring-jdbc' + implementation 'org.springframework:spring-context' + implementation 'org.slf4j:slf4j-api' + // The cleanup worker logs structured key/value pairs. Same encoder the rest of the runtime uses. + implementation libs.logstash.logback.encoder +} + +dependencies { + testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'org.springframework.boot:spring-boot-test' + testImplementation 'ch.qos.logback:logback-classic' + testImplementation libs.logstash.logback.encoder +} + +dependencies { + testImplementation libs.archunit.junit5 +} diff --git a/src/composition/fileserver-platform/gradle.lockfile b/src/composition/fileserver-platform/gradle.lockfile new file mode 100644 index 00000000..c8cf8de0 --- /dev/null +++ b/src/composition/fileserver-platform/gradle.lockfile @@ -0,0 +1,229 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +biz.aQute.bnd:biz.aQute.bnd.annotation:7.1.0=compileClasspath,testCompileClasspath +ch.qos.logback:logback-classic:1.5.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +ch.qos.logback:logback-core:1.5.38=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-annotations:2.21=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.21.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.21.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.21.5=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.21.5=runtimeClasspath,testRuntimeClasspath +com.fasterxml.jackson:jackson-bom:2.21.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml:classmate:1.7.3=runtimeClasspath,testRuntimeClasspath +com.github.ben-manes.caffeine:caffeine:3.2.4=annotationProcessor,testAnnotationProcessor +com.github.kevinstern:software-and-algorithms:1.0=annotationProcessor,testAnnotationProcessor +com.github.spotbugs:spotbugs-annotations:4.10.2=spotbugs +com.github.spotbugs:spotbugs:4.10.2=spotbugs +com.github.stephenc.jcip:jcip-annotations:1.0-1=spotbugs +com.google.auto.service:auto-service-annotations:1.0.1=annotationProcessor,testAnnotationProcessor +com.google.auto.value:auto-value-annotations:1.9=annotationProcessor,testAnnotationProcessor +com.google.auto:auto-common:1.2.2=annotationProcessor,testAnnotationProcessor +com.google.code.findbugs:jsr305:3.0.2=checkstyle,spotbugs +com.google.code.gson:gson:2.13.2=spotbugs +com.google.errorprone:error_prone_annotation:2.49.0=annotationProcessor,testAnnotationProcessor +com.google.errorprone:error_prone_annotations:2.38.0=compileClasspath,testCompileClasspath +com.google.errorprone:error_prone_annotations:2.41.0=spotbugs +com.google.errorprone:error_prone_annotations:2.47.0=checkstyle +com.google.errorprone:error_prone_annotations:2.49.0=annotationProcessor,testAnnotationProcessor +com.google.errorprone:error_prone_check_api:2.49.0=annotationProcessor,testAnnotationProcessor +com.google.errorprone:error_prone_core:2.49.0=annotationProcessor,testAnnotationProcessor +com.google.googlejavaformat:google-java-format:1.35.0=annotationProcessor,testAnnotationProcessor +com.google.guava:failureaccess:1.0.3=annotationProcessor,checkstyle,testAnnotationProcessor +com.google.guava:guava:33.5.0-jre=annotationProcessor,testAnnotationProcessor +com.google.guava:guava:33.6.0-jre=checkstyle +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,checkstyle,testAnnotationProcessor +com.google.j2objc:j2objc-annotations:3.1=annotationProcessor,checkstyle,testAnnotationProcessor +com.google.protobuf:protobuf-java:4.33.2=annotationProcessor,testAnnotationProcessor +com.h3xstream.findsecbugs:findsecbugs-plugin:1.14.0=spotbugsPlugins +com.jayway.jsonpath:json-path:2.10.0=testCompileClasspath,testRuntimeClasspath +com.nimbusds:nimbus-jose-jwt:10.4=runtimeClasspath,testRuntimeClasspath +com.puppycrawl.tools:checkstyle:13.5.0=checkstyle +com.sun.istack:istack-commons-runtime:4.1.2=runtimeClasspath,testRuntimeClasspath +com.tngtech.archunit:archunit-junit5-api:1.3.0=testCompileClasspath,testRuntimeClasspath +com.tngtech.archunit:archunit-junit5-engine-api:1.3.0=testRuntimeClasspath +com.tngtech.archunit:archunit-junit5-engine:1.3.0=testRuntimeClasspath +com.tngtech.archunit:archunit-junit5:1.3.0=testCompileClasspath,testRuntimeClasspath +com.tngtech.archunit:archunit:1.3.0=testCompileClasspath,testRuntimeClasspath +com.vaadin.external.google:android-json:0.0.20131108.vaadin1=testCompileClasspath,testRuntimeClasspath +com.zaxxer:HikariCP:7.0.2=runtimeClasspath,testRuntimeClasspath +commons-beanutils:commons-beanutils:1.11.0=checkstyle +commons-collections:commons-collections:3.2.2=checkstyle +commons-io:commons-io:2.21.0=spotbugs +commons-logging:commons-logging:1.3.6=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +info.picocli:picocli:4.7.7=checkstyle +io.github.eisop:dataflow-errorprone:3.41.0-eisop1=annotationProcessor,testAnnotationProcessor +io.github.java-diff-utils:java-diff-utils:4.12=annotationProcessor,testAnnotationProcessor +io.micrometer:micrometer-commons:1.16.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.micrometer:micrometer-core:1.16.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.micrometer:micrometer-jakarta9:1.16.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.micrometer:micrometer-observation:1.16.7=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +io.projectreactor:reactor-core:3.8.7=runtimeClasspath,testRuntimeClasspath +io.swagger.core.v3:swagger-annotations-jakarta:2.2.38=runtimeClasspath,testRuntimeClasspath +io.swagger.core.v3:swagger-core-jakarta:2.2.38=runtimeClasspath,testRuntimeClasspath +io.swagger.core.v3:swagger-models-jakarta:2.2.38=runtimeClasspath,testRuntimeClasspath +jakarta.activation:jakarta.activation-api:2.1.4=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.annotation:jakarta.annotation-api:3.0.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +jakarta.inject:jakarta.inject-api:2.0.1=runtimeClasspath,testRuntimeClasspath +jakarta.persistence:jakarta.persistence-api:3.2.0=runtimeClasspath,testRuntimeClasspath +jakarta.transaction:jakarta.transaction-api:2.0.1=runtimeClasspath,testRuntimeClasspath +jakarta.validation:jakarta.validation-api:3.1.1=runtimeClasspath,testRuntimeClasspath +jakarta.xml.bind:jakarta.xml.bind-api:4.0.5=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +javax.inject:javax.inject:1=annotationProcessor,testAnnotationProcessor +jaxen:jaxen:2.0.6=spotbugs +net.bytebuddy:byte-buddy-agent:1.17.8=testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy:1.17.8=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +net.logstash.logback:logstash-logback-encoder:8.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +net.minidev:accessors-smart:2.6.0=testCompileClasspath,testRuntimeClasspath +net.minidev:json-smart:2.6.0=testCompileClasspath,testRuntimeClasspath +net.sf.saxon:Saxon-HE:12.9=checkstyle,spotbugs +org.antlr:antlr4-runtime:4.13.2=checkstyle,runtimeClasspath,testRuntimeClasspath +org.apache.bcel:bcel:6.12.0=spotbugs +org.apache.commons:commons-lang3:3.20.0=checkstyle,runtimeClasspath,spotbugs,testRuntimeClasspath +org.apache.commons:commons-text:1.15.0=spotbugs +org.apache.commons:commons-text:1.3=checkstyle +org.apache.httpcomponents:httpclient:4.5.13=checkstyle +org.apache.httpcomponents:httpcore:4.4.16=checkstyle +org.apache.logging.log4j:log4j-api:2.25.5=compileClasspath,runtimeClasspath,spotbugs,testCompileClasspath,testRuntimeClasspath +org.apache.logging.log4j:log4j-core:2.25.5=spotbugs +org.apache.logging.log4j:log4j-to-slf4j:2.25.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.maven.doxia:doxia-core:1.12.0=checkstyle +org.apache.maven.doxia:doxia-logging-api:1.12.0=checkstyle +org.apache.maven.doxia:doxia-module-xdoc:1.12.0=checkstyle +org.apache.maven.doxia:doxia-sink-api:1.12.0=checkstyle +org.apache.tomcat.embed:tomcat-embed-core:11.0.24=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.tomcat.embed:tomcat-embed-el:11.0.24=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.tomcat.embed:tomcat-embed-websocket:11.0.24=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.xbean:xbean-reflect:3.7=checkstyle +org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath +org.aspectj:aspectjweaver:1.9.25.1=runtimeClasspath,testRuntimeClasspath +org.assertj:assertj-core:3.27.7=testCompileClasspath,testRuntimeClasspath +org.awaitility:awaitility:4.3.0=testCompileClasspath,testRuntimeClasspath +org.codehaus.plexus:plexus-classworlds:2.6.0=checkstyle +org.codehaus.plexus:plexus-component-annotations:2.1.0=checkstyle +org.codehaus.plexus:plexus-container-default:2.1.0=checkstyle +org.codehaus.plexus:plexus-utils:3.3.0=checkstyle +org.dom4j:dom4j:2.2.0=spotbugs +org.eclipse.angus:angus-activation:2.0.3=runtimeClasspath,testRuntimeClasspath +org.glassfish.jaxb:jaxb-core:4.0.9=runtimeClasspath,testRuntimeClasspath +org.glassfish.jaxb:jaxb-runtime:4.0.9=runtimeClasspath,testRuntimeClasspath +org.glassfish.jaxb:txw2:4.0.9=runtimeClasspath,testRuntimeClasspath +org.hamcrest:hamcrest:3.0=testCompileClasspath,testRuntimeClasspath +org.hdrhistogram:HdrHistogram:2.2.2=runtimeClasspath,testRuntimeClasspath +org.hibernate.models:hibernate-models:1.0.1=runtimeClasspath,testRuntimeClasspath +org.hibernate.orm:hibernate-core:7.2.24.Final=runtimeClasspath,testRuntimeClasspath +org.hibernate.validator:hibernate-validator:9.0.1.Final=runtimeClasspath,testRuntimeClasspath +org.javassist:javassist:3.28.0-GA=checkstyle +org.jboss.logging:jboss-logging:3.6.3.Final=runtimeClasspath,testRuntimeClasspath +org.jspecify:jspecify:1.0.1=annotationProcessor,checkstyle,compileClasspath,runtimeClasspath,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-api:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-engine:6.0.3=testRuntimeClasspath +org.junit.jupiter:junit-jupiter-params:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-commons:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-engine:6.0.3=testRuntimeClasspath +org.junit.platform:junit-platform-launcher:6.0.3=testRuntimeClasspath +org.junit:junit-bom:6.0.3=testCompileClasspath,testRuntimeClasspath +org.junit:junit-bom:6.1.0=spotbugs +org.latencyutils:LatencyUtils:2.0.3=runtimeClasspath,testRuntimeClasspath +org.mockito:mockito-core:5.20.0=mockitoAgent,testCompileClasspath,testRuntimeClasspath +org.mockito:mockito-junit-jupiter:5.20.0=testCompileClasspath,testRuntimeClasspath +org.objenesis:objenesis:3.3=testRuntimeClasspath +org.openapitools:jackson-databind-nullable:0.2.6=runtimeClasspath,testRuntimeClasspath +org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testRuntimeClasspath +org.osgi:org.osgi.annotation.bundle:2.0.0=compileClasspath,testCompileClasspath +org.osgi:org.osgi.annotation.versioning:1.1.2=compileClasspath,testCompileClasspath +org.osgi:org.osgi.resource:1.0.0=compileClasspath,testCompileClasspath +org.osgi:org.osgi.service.serviceloader:1.0.0=compileClasspath,testCompileClasspath +org.ow2.asm:asm-analysis:9.10.1=spotbugs +org.ow2.asm:asm-commons:9.10.1=spotbugs +org.ow2.asm:asm-tree:9.10.1=spotbugs +org.ow2.asm:asm-util:9.10.1=spotbugs +org.ow2.asm:asm:9.10.1=spotbugs +org.ow2.asm:asm:9.7.1=testCompileClasspath,testRuntimeClasspath +org.pcollections:pcollections:4.0.1=annotationProcessor,testAnnotationProcessor +org.reactivestreams:reactive-streams:1.0.4=runtimeClasspath,testRuntimeClasspath +org.reflections:reflections:0.10.2=checkstyle +org.skyscreamer:jsonassert:1.5.3=testCompileClasspath,testRuntimeClasspath +org.slf4j:jul-to-slf4j:2.0.18=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:2.0.18=compileClasspath,runtimeClasspath,spotbugs,spotbugsSlf4j,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-simple:2.0.17=spotbugsSlf4j +org.slf4j:slf4j-simple:2.0.18=checkstyle +org.springdoc:springdoc-openapi-starter-common:3.0.0=runtimeClasspath,testRuntimeClasspath +org.springdoc:springdoc-openapi-starter-webmvc-api:3.0.0=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-actuator-autoconfigure:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-actuator:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-autoconfigure:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-configuration-processor:4.0.8=annotationProcessor +org.springframework.boot:spring-boot-data-commons:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-data-jpa:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-health:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-hibernate:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-http-converter:4.0.8=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-jackson:4.0.8=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-jdbc:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-jpa:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-micrometer-metrics:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-micrometer-observation:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-persistence:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-resttestclient:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-security-oauth2-resource-server:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-security:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-servlet:4.0.8=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-sql:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-actuator:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-data-jpa:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-jackson-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-jackson:4.0.8=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-jdbc:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-logging:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-micrometer-metrics:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-oauth2-resource-server:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-security:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-tomcat-runtime:4.0.8=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-tomcat:4.0.8=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-validation:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-web:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-webmvc-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter-webmvc:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-starter:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-test-autoconfigure:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-tomcat:4.0.8=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-transaction:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-validation:4.0.8=runtimeClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-web-server:4.0.8=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-webmvc-test:4.0.8=testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot-webmvc:4.0.8=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.boot:spring-boot:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework.data:spring-data-commons:4.0.7=runtimeClasspath,testRuntimeClasspath +org.springframework.data:spring-data-jpa:4.0.7=runtimeClasspath,testRuntimeClasspath +org.springframework.security:spring-security-config:7.0.7=runtimeClasspath,testRuntimeClasspath +org.springframework.security:spring-security-core:7.0.7=runtimeClasspath,testRuntimeClasspath +org.springframework.security:spring-security-crypto:7.0.7=runtimeClasspath,testRuntimeClasspath +org.springframework.security:spring-security-oauth2-core:7.0.7=runtimeClasspath,testRuntimeClasspath +org.springframework.security:spring-security-oauth2-jose:7.0.7=runtimeClasspath,testRuntimeClasspath +org.springframework.security:spring-security-oauth2-resource-server:7.0.7=runtimeClasspath,testRuntimeClasspath +org.springframework.security:spring-security-web:7.0.7=runtimeClasspath,testRuntimeClasspath +org.springframework.session:spring-session-core:4.0.5=runtimeClasspath,testRuntimeClasspath +org.springframework:spring-aop:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-aspects:7.0.9=runtimeClasspath,testRuntimeClasspath +org.springframework:spring-beans:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-context:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-core:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-expression:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-jdbc:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-orm:7.0.9=runtimeClasspath,testRuntimeClasspath +org.springframework:spring-test:7.0.9=testCompileClasspath,testRuntimeClasspath +org.springframework:spring-tx:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-web:7.0.9=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.springframework:spring-webflux:7.0.9=runtimeClasspath,testRuntimeClasspath +org.springframework:spring-webmvc:7.0.9=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.xmlresolver:xmlresolver:5.3.3=checkstyle,spotbugs +org.xmlunit:xmlunit-core:2.10.4=testCompileClasspath,testRuntimeClasspath +org.yaml:snakeyaml:2.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +tools.jackson.core:jackson-core:3.1.5=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +tools.jackson.core:jackson-databind:3.1.5=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +tools.jackson:jackson-bom:3.1.5=runtimeClasspath,testCompileClasspath,testRuntimeClasspath +empty= diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverAdminManagementContextConfiguration.java b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverAdminManagementContextConfiguration.java similarity index 96% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverAdminManagementContextConfiguration.java rename to src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverAdminManagementContextConfiguration.java index 7f627386..86d7181c 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverAdminManagementContextConfiguration.java +++ b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverAdminManagementContextConfiguration.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import dev.caskeleton.adapter.inbound.web.fileserver.admin.FileserverAdminController; import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverAdminPlaneConfiguration.java b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverAdminPlaneConfiguration.java similarity index 92% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverAdminPlaneConfiguration.java rename to src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverAdminPlaneConfiguration.java index e7aacc92..131b5416 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverAdminPlaneConfiguration.java +++ b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverAdminPlaneConfiguration.java @@ -1,6 +1,7 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import dev.caskeleton.adapter.inbound.web.auth.RestrictedPathRule; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverCleanupConfiguration.java b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverCleanupConfiguration.java similarity index 93% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverCleanupConfiguration.java rename to src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverCleanupConfiguration.java index a1f7d7e4..84717fa6 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverCleanupConfiguration.java +++ b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverCleanupConfiguration.java @@ -1,5 +1,6 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; import dev.caskeleton.application.fileserver.cleanup.CleanupService; import java.time.Duration; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverCleanupWorker.java b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverCleanupWorker.java similarity index 98% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverCleanupWorker.java rename to src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverCleanupWorker.java index 2613787e..3a6eace5 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverCleanupWorker.java +++ b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverCleanupWorker.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import static net.logstash.logback.argument.StructuredArguments.kv; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverCorePolicyConfiguration.java b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverCorePolicyConfiguration.java similarity index 91% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverCorePolicyConfiguration.java rename to src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverCorePolicyConfiguration.java index b061eb9d..e09d31f7 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverCorePolicyConfiguration.java +++ b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverCorePolicyConfiguration.java @@ -1,7 +1,8 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import dev.caskeleton.adapter.inbound.web.fileserver.config.FileserverWebProperties; import dev.caskeleton.adapter.inbound.web.fileserver.config.TransferExecutorProperties; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; import dev.caskeleton.application.fileserver.api.StorageNamespace; import dev.caskeleton.application.fileserver.upload.UploadPolicy; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverHttpDownloadConfiguration.java b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverHttpDownloadConfiguration.java similarity index 95% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverHttpDownloadConfiguration.java rename to src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverHttpDownloadConfiguration.java index b52f4f39..fd5fa2ed 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverHttpDownloadConfiguration.java +++ b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverHttpDownloadConfiguration.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import dev.caskeleton.adapter.inbound.web.fileserver.http.DefaultHttpRangeResolver; import dev.caskeleton.adapter.inbound.web.fileserver.http.HttpContentDispositionFactory; @@ -9,6 +9,7 @@ import dev.caskeleton.adapter.inbound.web.fileserver.http.HttpRangeResolver; import dev.caskeleton.adapter.inbound.web.fileserver.http.MvcConditionalRequestFactory; import dev.caskeleton.adapter.inbound.web.fileserver.http.MvcDownloadResponseWriter; import dev.caskeleton.adapter.inbound.web.fileserver.http.ZeroCopyEligibility; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverLocalStorageCoreConfiguration.java b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverLocalStorageCoreConfiguration.java similarity index 92% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverLocalStorageCoreConfiguration.java rename to src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverLocalStorageCoreConfiguration.java index 60e9bb2d..0c0d6cce 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverLocalStorageCoreConfiguration.java +++ b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverLocalStorageCoreConfiguration.java @@ -1,12 +1,13 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalBlockingContentStore; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageCapabilityProbe; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageProbeResult; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageProperties; import dev.caskeleton.adapter.outbound.persistence.fileserver.FileserverSchemaActivation; +import dev.caskeleton.adapter.outbound.support.CapabilityStartupValidationException; import dev.caskeleton.application.fileserver.api.content.PublishMode; -import dev.caskeleton.bootstrap.runtime.startup.StartupFailures; import java.nio.file.Path; import java.util.Locale; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; @@ -62,7 +63,7 @@ class FileserverLocalStorageCoreConfiguration { LocalStorageProbeResult fileserverStorageProbeResult(LocalStorageProperties properties) { LocalStorageProbeResult result = new LocalStorageCapabilityProbe(properties).run(); if (!result.mandatoryChecksPassed()) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "fileserver storage root failed a mandatory capability probe: " + result.failures() + "; the capability refuses to start rather than publish files it cannot place " @@ -90,7 +91,7 @@ class FileserverLocalStorageCoreConfiguration { for (Path forbidden : storage.forbiddenRootAncestors()) { Path ancestor = forbidden.toAbsolutePath().normalize(); if (root.startsWith(ancestor)) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( "fileserver storage root must not live under a configured forbidden ancestor"); } } @@ -101,7 +102,7 @@ class FileserverLocalStorageCoreConfiguration { try { return PublishMode.valueOf(canonical); } catch (IllegalArgumentException unknown) { - throw StartupFailures.envValidation( + throw new CapabilityStartupValidationException( FileserverPlatformSettings.PREFIX + ".storage.publish-mode must be one of atomic-move-required, " + "atomic-move-preferred, metadata-pointer", diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverNginxConfiguration.java b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverNginxConfiguration.java similarity index 90% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverNginxConfiguration.java rename to src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverNginxConfiguration.java index 8786553a..ad788135 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverNginxConfiguration.java +++ b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverNginxConfiguration.java @@ -1,9 +1,10 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import dev.caskeleton.adapter.inbound.web.fileserver.nginx.DefaultNginxInternalUriMapper; import dev.caskeleton.adapter.inbound.web.fileserver.nginx.NginxDelegationProperties; import dev.caskeleton.adapter.inbound.web.fileserver.nginx.NginxDownloadStrategy; import dev.caskeleton.adapter.inbound.web.fileserver.nginx.NginxInternalUriMapper; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverPlatformAutoConfiguration.java b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverPlatformAutoConfiguration.java new file mode 100644 index 00000000..556e5008 --- /dev/null +++ b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverPlatformAutoConfiguration.java @@ -0,0 +1,44 @@ +package dev.caskeleton.composition.fileserver; + +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Import; + +/** + * The Fileserver platform's application-owned half: the HTTP surface and startup policy. + * + *

This used to import nineteen further configurations that assembled {@code + * adapter:outbound:fileserver}'s own storage, verification, upload and cleanup graph. Those moved + * into that leaf, behind its own {@code FileserverCapabilityAutoConfiguration}, so the composition + * root no longer names a capability's implementation classes — it composes the HTTP transport, + * which is {@code adapter:inbound:web}'s, with the leaf's published beans. + * + *

Ordering is by bean dependency, not by {@code @AutoConfiguration(after = ...)} naming a leaf + * type. Spring resolves {@code FileserverPlatformSettings} whichever order the two roots are + * processed in, and an {@code after} pointing at a leaf-internal class is exactly the + * export-surface hole the architecture suite rejects. + */ +@AutoConfiguration +@ConditionalOnProperty( + prefix = FileserverPlatformSettings.PREFIX, + name = "enabled", + havingValue = "true") +@Import({ + FileserverCorePolicyConfiguration.class, + FileserverWebAssemblyConfiguration.class, + FileserverHttpDownloadConfiguration.class, + FileserverNginxConfiguration.class, + FileserverProtocolConfiguration.class, + FileserverAdminPlaneConfiguration.class, + FileserverStartupConfiguration.class, + // Three that could not move: they compose a sibling adapter into the capability — the JPA + // metadata store, the identifier generator — or use the repository's structured-logging + // arguments, which this leaf's dependency allowance does not include. Composing two adapters is + // the composition root's job by definition, so these are where they belong rather than where + // they were left. + FileserverLocalStorageCoreConfiguration.class, + FileserverUploadServiceConfiguration.class, + FileserverCleanupConfiguration.class +}) +public class FileserverPlatformAutoConfiguration {} diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverProtocolConfiguration.java b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverProtocolConfiguration.java similarity index 94% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverProtocolConfiguration.java rename to src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverProtocolConfiguration.java index 73e34585..77679871 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverProtocolConfiguration.java +++ b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverProtocolConfiguration.java @@ -1,9 +1,10 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import dev.caskeleton.adapter.inbound.web.fileserver.draft12.Draft12Properties; import dev.caskeleton.adapter.inbound.web.fileserver.tus.TusChecksumVerifier; import dev.caskeleton.adapter.inbound.web.fileserver.tus.TusProperties; import dev.caskeleton.adapter.inbound.web.fileserver.tus.TusRequestParser; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; import java.util.List; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStartupConfiguration.java b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverStartupConfiguration.java similarity index 90% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStartupConfiguration.java rename to src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverStartupConfiguration.java index c13b16bd..352c6e30 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverStartupConfiguration.java +++ b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverStartupConfiguration.java @@ -1,13 +1,16 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import dev.caskeleton.adapter.inbound.web.fileserver.nginx.NginxInternalUriMapper; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverStartupCheck; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverStartupValidator; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageProbeResult; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalStorageProperties; import dev.caskeleton.adapter.outbound.fileserver.platform.security.UnenforcedFileAccessPolicy; +import dev.caskeleton.adapter.outbound.support.runtime.RuntimeProfileSnapshot; import dev.caskeleton.application.fileserver.api.metadata.FileMetadataStore; import dev.caskeleton.application.fileserver.api.security.FileAccessPolicy; import dev.caskeleton.application.fileserver.upload.FileVerificationService; -import dev.caskeleton.bootstrap.runtime.RuntimeProfileSnapshot; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverUploadServiceConfiguration.java b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverUploadServiceConfiguration.java similarity index 94% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverUploadServiceConfiguration.java rename to src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverUploadServiceConfiguration.java index b470a91d..98c260a8 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverUploadServiceConfiguration.java +++ b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverUploadServiceConfiguration.java @@ -1,7 +1,9 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverMetricsSupport; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; +import dev.caskeleton.adapter.outbound.fileserver.platform.identifier.RandomUploadIdentifierFactory; import dev.caskeleton.adapter.outbound.fileserver.platform.local.LocalBlockingContentStore; -import dev.caskeleton.adapter.outbound.identifier.RandomUploadIdentifierFactory; import dev.caskeleton.application.fileserver.api.metadata.FileMetadataStore; import dev.caskeleton.application.fileserver.api.metadata.FileQuotaService; import dev.caskeleton.application.fileserver.api.metadata.UploadSessionStore; diff --git a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverWebAssemblyConfiguration.java b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverWebAssemblyConfiguration.java similarity index 90% rename from src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverWebAssemblyConfiguration.java rename to src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverWebAssemblyConfiguration.java index 58573453..a8530d09 100644 --- a/src/app-bootstrap/src/main/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverWebAssemblyConfiguration.java +++ b/src/composition/fileserver-platform/src/main/java/dev/caskeleton/composition/fileserver/FileserverWebAssemblyConfiguration.java @@ -1,9 +1,10 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import dev.caskeleton.adapter.inbound.web.fileserver.mapper.MultipartUploadRequestMapper; import dev.caskeleton.adapter.inbound.web.fileserver.mapper.RawUploadRequestMapper; import dev.caskeleton.adapter.inbound.web.fileserver.problem.FileserverProblemFactory; import dev.caskeleton.adapter.inbound.web.fileserver.security.FileserverRequestContextFactory; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/composition/fileserver-platform/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports b/src/composition/fileserver-platform/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports new file mode 100644 index 00000000..91c707fb --- /dev/null +++ b/src/composition/fileserver-platform/src/main/resources/META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports @@ -0,0 +1 @@ +dev.caskeleton.composition.fileserver.FileserverAdminManagementContextConfiguration diff --git a/src/composition/fileserver-platform/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/src/composition/fileserver-platform/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000..a531004b --- /dev/null +++ b/src/composition/fileserver-platform/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +dev.caskeleton.composition.fileserver.FileserverPlatformAutoConfiguration diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverAssemblyFixture.java b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverAssemblyFixture.java similarity index 98% rename from src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverAssemblyFixture.java rename to src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverAssemblyFixture.java index 34aaf629..07dafb2b 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverAssemblyFixture.java +++ b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverAssemblyFixture.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import static org.mockito.Mockito.mock; diff --git a/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/FileserverCompositionArchitectureTest.java b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverCompositionArchitectureTest.java similarity index 64% rename from src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/FileserverCompositionArchitectureTest.java rename to src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverCompositionArchitectureTest.java index f24066a4..9c40d505 100644 --- a/src/app-bootstrap/src/architectureTest/java/dev/caskeleton/bootstrap/architecture/FileserverCompositionArchitectureTest.java +++ b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverCompositionArchitectureTest.java @@ -1,9 +1,10 @@ -package dev.caskeleton.bootstrap.architecture; +package dev.caskeleton.composition.fileserver; import static com.tngtech.archunit.lang.syntax.ArchRuleDefinition.classes; import com.tngtech.archunit.core.domain.JavaClass; import com.tngtech.archunit.core.domain.JavaMethod; +import com.tngtech.archunit.core.importer.ImportOption; import com.tngtech.archunit.junit.AnalyzeClasses; import com.tngtech.archunit.junit.ArchTest; import com.tngtech.archunit.lang.ArchCondition; @@ -12,22 +13,31 @@ import com.tngtech.archunit.lang.ConditionEvents; import com.tngtech.archunit.lang.SimpleConditionEvent; import org.springframework.context.annotation.Bean; -/** BOOT-007: Fileserver composition stays split by concern instead of regrowing god configs. */ +/** + * BOOT-007: Fileserver composition stays split by concern instead of regrowing god configs. + * + *

Moved here with the code it governs. While it lived in app-bootstrap it analysed {@code + * dev.caskeleton.bootstrap.autoconfigure.fileserver}, and once that package was empty the rule + * passed by having nothing to check. + */ @AnalyzeClasses( - packages = "dev.caskeleton.bootstrap.autoconfigure.fileserver", - importOptions = ProductionClassImportOption.class) + packages = "dev.caskeleton.composition.fileserver", + importOptions = ImportOption.DoNotIncludeTests.class) class FileserverCompositionArchitectureTest { @ArchTest static final ArchRule FILESERVER_CONFIGURATIONS_DECLARE_AT_MOST_EIGHT_BEANS = classes() .that() - .resideInAPackage("dev.caskeleton.bootstrap.autoconfigure.fileserver") + .resideInAPackage("dev.caskeleton.composition.fileserver") .should(declareAtMostEightBeanMethods()) .as( "BOOT-007: one Fileserver composition class declares at most eight @Bean methods; " + "larger or mixed port families split into package-private concern configs") - .allowEmptyShould(true); + // No allowEmptyShould: this module is the Fileserver composition, so an empty import + // means the analysed package moved again and the rule stopped looking at anything — + // which is how a split-by-concern rule quietly starts permitting a god config. + .allowEmptyShould(false); private static ArchCondition declareAtMostEightBeanMethods() { return new ArchCondition<>("declare at most eight @Bean methods") { diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverDocumentationCoverageTest.java b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverDocumentationCoverageTest.java similarity index 97% rename from src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverDocumentationCoverageTest.java rename to src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverDocumentationCoverageTest.java index 841c3c01..5d0cd40c 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverDocumentationCoverageTest.java +++ b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverDocumentationCoverageTest.java @@ -1,8 +1,9 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -232,7 +233,7 @@ class FileserverDocumentationCoverageTest { Path fileserverWeb = repositoryRoot() .resolve( - "src/adapter/inbound/web/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver"); + "src/adapter/inbound/web-fileserver/src/main/java/dev/caskeleton/adapter/inbound/web/fileserver"); try (Stream sources = Files.walk(fileserverWeb)) { for (Path source : sources.filter(path -> path.toString().endsWith(".java")).toList()) { String body = Files.readString(source); diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformAutoConfigurationTest.java b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverPlatformAutoConfigurationTest.java similarity index 93% rename from src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformAutoConfigurationTest.java rename to src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverPlatformAutoConfigurationTest.java index cd8cfadb..83bd37c0 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformAutoConfigurationTest.java +++ b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverPlatformAutoConfigurationTest.java @@ -1,4 +1,4 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import static org.assertj.core.api.Assertions.assertThat; @@ -7,6 +7,8 @@ import dev.caskeleton.adapter.inbound.web.fileserver.config.FileserverWebPropert import dev.caskeleton.adapter.inbound.web.fileserver.config.MvcTransferExecutorConfiguration; import dev.caskeleton.adapter.inbound.web.fileserver.http.HttpDownloadPolicy; import dev.caskeleton.adapter.inbound.web.fileserver.nginx.NginxDelegationProperties; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverCapabilityAutoConfiguration; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; import dev.caskeleton.application.fileserver.observability.FileserverMetricsPort; import dev.caskeleton.application.fileserver.observability.SafeFileFingerprint; import dev.caskeleton.application.fileserver.upload.UploadPolicy; @@ -24,7 +26,14 @@ class FileserverPlatformAutoConfigurationTest { private final ApplicationContextRunner runner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(FileserverPlatformAutoConfiguration.class)) + .withConfiguration( + // Both halves. The capability's own assembly is the leaf's root now, and + // the composition root carries the HTTP surface and startup policy; a + // deployment gets both from AutoConfiguration.imports, so a test that + // supplied only one would be asserting a shape no deployment produces. + AutoConfigurations.of( + FileserverCapabilityAutoConfiguration.class, + FileserverPlatformAutoConfiguration.class)) .withUserConfiguration(SupportingBeansConfiguration.class); @Test diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformEnvRoundTripTest.java b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverPlatformEnvRoundTripTest.java similarity index 84% rename from src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformEnvRoundTripTest.java rename to src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverPlatformEnvRoundTripTest.java index 9a81acd8..aa34c551 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverPlatformEnvRoundTripTest.java +++ b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverPlatformEnvRoundTripTest.java @@ -1,7 +1,8 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import static org.assertj.core.api.Assertions.assertThat; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverPlatformSettings; import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.Files; @@ -116,8 +117,25 @@ class FileserverPlatformEnvRoundTripTest { * locally and fail on every clean checkout — which is where CI runs. */ private static List readEnvFile() { - Path fromModule = Path.of(System.getProperty("user.dir")).resolve(".env.example"); - Path env = Files.exists(fromModule) ? fromModule : Path.of("..").resolve(".env.example"); + // Walked upward rather than counted. The previous form resolved `../.env.example`, which was a + // correct guess only while this test lived one directory below `src/`; the moment it moved with + // the code it tests, the fixed number of `..` was wrong and the failure read as a missing + // contract file rather than as a moved test. + Path env = null; + for (Path directory = Path.of(System.getProperty("user.dir")).toAbsolutePath(); + directory != null; + directory = directory.getParent()) { + Path candidate = directory.resolve(".env.example"); + if (Files.exists(candidate)) { + env = candidate; + break; + } + } + if (env == null) { + throw new UncheckedIOException( + "src/.env.example could not be read", + new IOException("no .env.example in any ancestor of " + System.getProperty("user.dir"))); + } try { return Files.readAllLines(env); } catch (IOException exception) { diff --git a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverRuntimeAssemblyTest.java b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverRuntimeAssemblyTest.java similarity index 92% rename from src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverRuntimeAssemblyTest.java rename to src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverRuntimeAssemblyTest.java index 4b55a335..aeb467b6 100644 --- a/src/app-bootstrap/src/test/java/dev/caskeleton/bootstrap/autoconfigure/fileserver/FileserverRuntimeAssemblyTest.java +++ b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverRuntimeAssemblyTest.java @@ -1,7 +1,8 @@ -package dev.caskeleton.bootstrap.autoconfigure.fileserver; +package dev.caskeleton.composition.fileserver; import static org.assertj.core.api.Assertions.assertThat; +import dev.caskeleton.adapter.outbound.fileserver.platform.autoconfigure.FileserverCapabilityAutoConfiguration; import dev.caskeleton.adapter.outbound.fileserver.platform.security.RoleBasedFileAccessPolicy; import dev.caskeleton.adapter.outbound.fileserver.platform.security.UnenforcedFileAccessPolicy; import dev.caskeleton.application.fileserver.admin.AdminAuditPort; @@ -55,7 +56,14 @@ class FileserverRuntimeAssemblyTest { private final ApplicationContextRunner runner = new ApplicationContextRunner() - .withConfiguration(AutoConfigurations.of(FileserverPlatformAutoConfiguration.class)) + .withConfiguration( + // Both halves. The capability's own assembly is the leaf's root now, and + // the composition root carries the HTTP surface and startup policy; a + // deployment gets both from AutoConfiguration.imports, so a test that + // supplied only one would be asserting a shape no deployment produces. + AutoConfigurations.of( + FileserverCapabilityAutoConfiguration.class, + FileserverPlatformAutoConfiguration.class)) .withUserConfiguration(AssemblySupport.class); @Test diff --git a/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverStructuredLoggingTest.java b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverStructuredLoggingTest.java new file mode 100644 index 00000000..e602d1a7 --- /dev/null +++ b/src/composition/fileserver-platform/src/test/java/dev/caskeleton/composition/fileserver/FileserverStructuredLoggingTest.java @@ -0,0 +1,98 @@ +package dev.caskeleton.composition.fileserver; + +import static org.assertj.core.api.Assertions.assertThat; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; +import ch.qos.logback.classic.LoggerContext; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.read.ListAppender; +import dev.caskeleton.application.fileserver.cleanup.CleanupBatchResult; +import dev.caskeleton.application.fileserver.cleanup.CleanupService; +import java.util.Arrays; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Test; +import org.slf4j.LoggerFactory; + +/** + * The cleanup worker's structured-logging contract. + * + *

Split out of app-bootstrap's {@code BootstrapStructuredRuntimeLoggingTest} when the worker + * moved here. That file asserts one contract — bounded, classified outcome fields with no unbounded + * key in them — across several capabilities, and the two halves stayed together only because the + * code did. What the contract says is unchanged; where it is checked now follows the worker. + */ +class FileserverStructuredLoggingTest { + + @Test + void fileserverCleanupSuccessCarriesBoundedOutcomeFields() { + CleanupService cleanup = (maxItems, maxBytes) -> new CleanupBatchResult(1, 2, 3, 4, 5L); + + try (CapturedLogger captured = capture(FileserverCleanupWorker.class)) { + new FileserverCleanupWorker(cleanup, 10, 1_024L).runBatch(); + + ILoggingEvent event = captured.singleEvent(); + assertThat(event.getLevel()).isEqualTo(Level.INFO); + assertThat(event.getFormattedMessage()).contains("deleted=1").contains("reclaimedBytes=5"); + assertThat(renderedArguments(event)) + .contains("capability=fileserver") + .contains("operation=cleanup") + .contains("cleanup.deleted=1") + .contains("cleanup.failed=4") + .contains("cleanup.reclaimed_bytes=5"); + } + } + + @Test + void fileserverCleanupFailureCarriesRetryDisposition() { + CleanupService cleanup = + (maxItems, maxBytes) -> { + throw new IllegalStateException("storage unavailable"); + }; + + try (CapturedLogger captured = capture(FileserverCleanupWorker.class)) { + new FileserverCleanupWorker(cleanup, 10, 1_024L).runBatch(); + + ILoggingEvent event = captured.singleEvent(); + assertThat(event.getLevel()).isEqualTo(Level.WARN); + assertThat(renderedArguments(event)) + .contains("capability=fileserver") + .contains("operation=cleanup") + .contains("warning.kind=scheduled-task-failed") + .contains("retry.disposition=next-run"); + assertThat(event.getThrowableProxy()).isNotNull(); + } + } + + private static CapturedLogger capture(Class owner) { + Logger logger = (Logger) LoggerFactory.getLogger(owner); + ListAppender appender = new ListAppender<>(); + appender.setContext((LoggerContext) LoggerFactory.getILoggerFactory()); + appender.start(); + logger.addAppender(appender); + return new CapturedLogger(logger, appender); + } + + private static String renderedArguments(ILoggingEvent event) { + Object[] arguments = event.getArgumentArray(); + if (arguments == null) { + return ""; + } + return Arrays.stream(arguments).map(String::valueOf).collect(Collectors.joining(" | ")); + } + + private record CapturedLogger(Logger logger, ListAppender appender) + implements AutoCloseable { + + ILoggingEvent singleEvent() { + assertThat(appender.list).hasSize(1); + return appender.list.get(0); + } + + @Override + public void close() { + logger.detachAppender(appender); + appender.stop(); + } + } +} diff --git a/src/config/architecture/modules.json b/src/config/architecture/modules.json index 01c5e293..bc7fd972 100644 --- a/src/config/architecture/modules.json +++ b/src/config/architecture/modules.json @@ -64,7 +64,15 @@ "domain-core", "application-core", "shared-contract", - "application-notification", + "application-notification" + ] + }, + { + "id": "adapter-outbound-persistence-fileserver", + "gradle_path": ":adapter:outbound:persistence-fileserver", + "source_path": "src/adapter/outbound/persistence-fileserver", + "allowed_dependencies": [ + "application-core", "application-fileserver" ] }, @@ -80,8 +88,7 @@ "source_path": "src/adapter/outbound/identifier", "allowed_dependencies": [ "domain-core", - "application-core", - "application-fileserver" + "application-core" ] }, { @@ -91,7 +98,8 @@ "allowed_dependencies": [ "application-core", "shared-contract", - "application-fileserver" + "application-fileserver", + "adapter-outbound-support" ] }, { @@ -181,8 +189,18 @@ "domain-core", "application-core", "shared-contract", - "application-notification", - "application-fileserver" + "application-notification" + ] + }, + { + "id": "adapter-inbound-web-fileserver", + "gradle_path": ":adapter:inbound:web-fileserver", + "source_path": "src/adapter/inbound/web-fileserver", + "allowed_dependencies": [ + "adapter-inbound-web", + "application-core", + "application-fileserver", + "shared-contract" ] }, { @@ -215,6 +233,22 @@ "shared-contract" ] }, + { + "id": "composition-fileserver-platform", + "gradle_path": ":composition:fileserver-platform", + "source_path": "src/composition/fileserver-platform", + "allowed_dependencies": [ + "application-core", + "application-fileserver", + "shared-contract", + "adapter-outbound-fileserver", + "adapter-outbound-identifier", + "adapter-outbound-support", + "adapter-outbound-persistence-fileserver", + "adapter-inbound-web-fileserver", + "adapter-inbound-web" + ] + }, { "id": "app-bootstrap", "gradle_path": ":app-bootstrap", diff --git a/src/config/jpa/readiness-cards.yaml b/src/config/jpa/readiness-cards.yaml index 8bb6e489..d1eec081 100644 --- a/src/config/jpa/readiness-cards.yaml +++ b/src/config/jpa/readiness-cards.yaml @@ -34,7 +34,6 @@ "prerequisites": ["jpa-observability-lifecycle"], "readiness-task": ":adapter:outbound:persistence-jpa:postgresqlSecurityBaselineIntegrationTest", "support-tasks": [ - ":adapter:outbound:persistence-jpa:verifySetConfigParameterBinding", ":adapter:inbound:web:jpaPersistenceRedactionContractTest" ], "required-evidence": [ diff --git a/src/gradle.properties b/src/gradle.properties index ffc84a89..c447eaa6 100644 --- a/src/gradle.properties +++ b/src/gradle.properties @@ -3,3 +3,24 @@ org.gradle.workers.max=4 org.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8 org.gradle.caching=true +# Parallel project execution. It was tried before and reverted, because +# `verifyCleanArchitectureDependencies` resolved every other project's `compileClasspath` from the +# root and Gradle refused: a configuration belongs to its project, and reading it from elsewhere +# asks for state held under another project's lock. The verification is now one task per module in +# the project that owns the configurations, so the flag is a flag again rather than a defect. +org.gradle.parallel=true +# +# Configuration cache is not enabled here, and the reason is narrower than it used to be. Measured, +# not assumed: `ci`, `integrationCheck` and `releaseCheck` all store and reuse a configuration cache +# entry with zero problems. The listener and `projectsEvaluated` callbacks that were named as the +# blockers are not among them — the actual blockers were four tasks holding a `Configuration` in +# their state, and those now hold a `Provider` instead. +# +# What is left is one task type: `ResolveConfigurationsTask` (`verifyDependencyLocks`, +# `resolveAndLockAll`), which is `notCompatibleWithConfigurationCache`. Resolving every +# configuration at execution time is not an implementation detail of that task, it is the task: +# STRICT lock validation happens during resolution, so moving it behind a provider would move lock +# verification into every build's configuration phase. Because the pull-request gate runs `:ci` and +# `:verifyDependencyLocks` in one invocation, turning the flag on repository-wide would discard the +# entry for that invocation anyway. Enabling it is therefore a change to how CI is split, not a +# property — and `.github/workflows/ci-quality-gates.yml` proves the storable half on every PR. diff --git a/src/grpc-advanced/grpc-advanced-compat/src/main/java/dev/caskeleton/grpc/advanced/reactor/ReactiveGrpcServerAdapter.java b/src/grpc-advanced/grpc-advanced-compat/src/main/java/dev/caskeleton/grpc/advanced/reactor/ReactiveGrpcServerAdapter.java index 189832bf..3c656bc4 100644 --- a/src/grpc-advanced/grpc-advanced-compat/src/main/java/dev/caskeleton/grpc/advanced/reactor/ReactiveGrpcServerAdapter.java +++ b/src/grpc-advanced/grpc-advanced-compat/src/main/java/dev/caskeleton/grpc/advanced/reactor/ReactiveGrpcServerAdapter.java @@ -1,7 +1,7 @@ package dev.caskeleton.grpc.advanced.reactor; -import dev.caskeleton.grpc.context.GrpcContextSnapshot; import dev.caskeleton.grpc.api.context.GrpcRequestContext; +import dev.caskeleton.grpc.context.GrpcContextSnapshot; import java.util.function.BiFunction; import reactor.core.publisher.Mono; import reactor.core.scheduler.Scheduler; diff --git a/src/grpc-advanced/grpc-advanced-compat/src/test/java/dev/caskeleton/grpc/advanced/compat/GrpcIntegrationBridgePolicyTest.java b/src/grpc-advanced/grpc-advanced-compat/src/test/java/dev/caskeleton/grpc/advanced/compat/GrpcIntegrationBridgePolicyTest.java index 2e1041c3..5474b67f 100644 --- a/src/grpc-advanced/grpc-advanced-compat/src/test/java/dev/caskeleton/grpc/advanced/compat/GrpcIntegrationBridgePolicyTest.java +++ b/src/grpc-advanced/grpc-advanced-compat/src/test/java/dev/caskeleton/grpc/advanced/compat/GrpcIntegrationBridgePolicyTest.java @@ -10,11 +10,11 @@ import dev.caskeleton.grpc.api.context.GrpcClientIdentity; import dev.caskeleton.grpc.api.context.GrpcMetadataBudget; import dev.caskeleton.grpc.api.context.GrpcMetadataKey; import dev.caskeleton.grpc.api.context.GrpcRequestContext; -import dev.caskeleton.grpc.core.GrpcMethodName; -import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.api.deadline.GrpcCancellationToken; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.core.RpcType; import java.time.Duration; import java.util.Map; import java.util.Set; diff --git a/src/grpc-advanced/grpc-advanced-compat/src/test/java/dev/caskeleton/grpc/advanced/compat/GrpcKotlinCompatibilityGateTest.java b/src/grpc-advanced/grpc-advanced-compat/src/test/java/dev/caskeleton/grpc/advanced/compat/GrpcKotlinCompatibilityGateTest.java index 47a5dfec..281aa542 100644 --- a/src/grpc-advanced/grpc-advanced-compat/src/test/java/dev/caskeleton/grpc/advanced/compat/GrpcKotlinCompatibilityGateTest.java +++ b/src/grpc-advanced/grpc-advanced-compat/src/test/java/dev/caskeleton/grpc/advanced/compat/GrpcKotlinCompatibilityGateTest.java @@ -6,9 +6,9 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import dev.caskeleton.grpc.advanced.kotlin.GrpcCoroutineContextBridge; import dev.caskeleton.grpc.advanced.kotlin.GrpcKotlinCompatibilityGate; import dev.caskeleton.grpc.advanced.kotlin.GrpcKotlinProfile; +import dev.caskeleton.grpc.api.deadline.GrpcCancellationToken; import dev.caskeleton.grpc.deadline.GrpcCancellationCoordinator; import dev.caskeleton.grpc.deadline.GrpcCancellationReason; -import dev.caskeleton.grpc.api.deadline.GrpcCancellationToken; import java.time.Instant; import java.util.concurrent.atomic.AtomicBoolean; import org.junit.jupiter.api.DisplayName; diff --git a/src/grpc-advanced/grpc-advanced-compat/src/test/java/dev/caskeleton/grpc/advanced/compat/GrpcReactorContextBridgeTest.java b/src/grpc-advanced/grpc-advanced-compat/src/test/java/dev/caskeleton/grpc/advanced/compat/GrpcReactorContextBridgeTest.java index 835811e7..fcc3059d 100644 --- a/src/grpc-advanced/grpc-advanced-compat/src/test/java/dev/caskeleton/grpc/advanced/compat/GrpcReactorContextBridgeTest.java +++ b/src/grpc-advanced/grpc-advanced-compat/src/test/java/dev/caskeleton/grpc/advanced/compat/GrpcReactorContextBridgeTest.java @@ -6,16 +6,16 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import dev.caskeleton.grpc.advanced.reactor.GrpcReactorCancellationBridge; import dev.caskeleton.grpc.advanced.reactor.GrpcReactorContextBridge; import dev.caskeleton.grpc.api.context.GrpcClientIdentity; -import dev.caskeleton.grpc.context.GrpcContextSnapshot; import dev.caskeleton.grpc.api.context.GrpcMetadataBudget; import dev.caskeleton.grpc.api.context.GrpcRequestContext; +import dev.caskeleton.grpc.api.deadline.GrpcCancellationToken; +import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; +import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; +import dev.caskeleton.grpc.context.GrpcContextSnapshot; import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.deadline.GrpcCancellationCoordinator; import dev.caskeleton.grpc.deadline.GrpcCancellationReason; -import dev.caskeleton.grpc.api.deadline.GrpcCancellationToken; -import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; -import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import java.time.Duration; import java.time.Instant; import java.util.Map; diff --git a/src/grpc-advanced/grpc-advanced-diagnostics/src/main/java/dev/caskeleton/grpc/advanced/diagnostics/GrpcDiagnosticsRedactor.java b/src/grpc-advanced/grpc-advanced-diagnostics/src/main/java/dev/caskeleton/grpc/advanced/diagnostics/GrpcDiagnosticsRedactor.java index 74935763..86a142ea 100644 --- a/src/grpc-advanced/grpc-advanced-diagnostics/src/main/java/dev/caskeleton/grpc/advanced/diagnostics/GrpcDiagnosticsRedactor.java +++ b/src/grpc-advanced/grpc-advanced-diagnostics/src/main/java/dev/caskeleton/grpc/advanced/diagnostics/GrpcDiagnosticsRedactor.java @@ -30,6 +30,18 @@ public final class GrpcDiagnosticsRedactor { private static final Pattern IPV4_WITH_PORT = Pattern.compile("\\b(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})(:\\d{1,5})?\\b"); + /** + * The forms {@link #maskAddress} produces, so masking one of them again returns it unchanged. + * + *

{@code GrpcChannelDiagnosticsSnapshot} decides whether an address is masked by masking it + * and comparing — the only test available to it, since a masked address carries no marker. That + * works only if masking is idempotent, and it was not: {@code 10.4.x.x} has no four numeric + * octets, so it fell through to the hash branch and came back as {@code masked:}. A + * snapshot built from correctly masked addresses was therefore rejected as unmasked. + */ + private static final Pattern ALREADY_MASKED = + Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.x\\.x|masked:[0-9a-f]{16}|unknown"); + private GrpcDiagnosticsRedactor() {} /** Whether a field name may appear in a snapshot at all. */ @@ -42,11 +54,17 @@ public final class GrpcDiagnosticsRedactor { * *

The last two octets go; the first two stay, because "which subnet" is a real diagnostic * question and "which host" is not one the diagnostics endpoint should answer. + * + *

Idempotent: masking an already-masked address returns it. Callers rely on that to ask "is + * this masked?" without a marker byte. */ public static String maskAddress(String address) { if (address == null || address.isBlank()) { return "unknown"; } + if (ALREADY_MASKED.matcher(address).matches()) { + return address; + } var matcher = IPV4_WITH_PORT.matcher(address); if (matcher.find()) { return matcher.replaceAll( diff --git a/src/grpc-advanced/grpc-advanced-diagnostics/src/test/java/dev/caskeleton/grpc/advanced/diagnostics/GrpcDiagnosticsRedactorIdempotenceTest.java b/src/grpc-advanced/grpc-advanced-diagnostics/src/test/java/dev/caskeleton/grpc/advanced/diagnostics/GrpcDiagnosticsRedactorIdempotenceTest.java new file mode 100644 index 00000000..b6e0deb9 --- /dev/null +++ b/src/grpc-advanced/grpc-advanced-diagnostics/src/test/java/dev/caskeleton/grpc/advanced/diagnostics/GrpcDiagnosticsRedactorIdempotenceTest.java @@ -0,0 +1,52 @@ +package dev.caskeleton.grpc.advanced.diagnostics; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +/** + * Masking an address twice gives the same answer as masking it once. + * + *

Not a style preference. {@code GrpcChannelDiagnosticsSnapshot} decides whether an address is + * masked by masking it and comparing, because a masked address carries no marker to look for — so + * the only way that question has an answer is if masking is idempotent. It was not: {@code + * 10.4.x.x} has no four numeric octets, fell through to the hash branch, and came back as {@code + * masked:}, which made a snapshot assembled from correctly masked addresses fail its own + * admission check. The property is asserted here, next to the function that has to hold it. + */ +class GrpcDiagnosticsRedactorIdempotenceTest { + + @Test + @DisplayName("masking a masked IPv4 address returns it unchanged") + void maskingAMaskedIpv4AddressIsANoOp() { + String masked = GrpcDiagnosticsRedactor.maskAddress("10.4.7.19:8443"); + + assertThat(masked).isEqualTo("10.4.x.x"); + assertThat(GrpcDiagnosticsRedactor.maskAddress(masked)).isEqualTo(masked); + } + + @Test + @DisplayName("masking a masked non-IPv4 address returns it unchanged") + void maskingAMaskedOpaqueAddressIsANoOp() { + String masked = GrpcDiagnosticsRedactor.maskAddress("unix:///var/run/grpc.sock"); + + assertThat(masked).startsWith("masked:"); + assertThat(GrpcDiagnosticsRedactor.maskAddress(masked)).isEqualTo(masked); + } + + @Test + @DisplayName("the placeholder for an absent address is its own mask") + void theUnknownPlaceholderIsStable() { + assertThat(GrpcDiagnosticsRedactor.maskAddress("")).isEqualTo("unknown"); + assertThat(GrpcDiagnosticsRedactor.maskAddress("unknown")).isEqualTo("unknown"); + } + + @Test + @DisplayName("an address that only looks masked is still masked") + void anAddressThatMerelyResemblesTheMaskIsStillMasked() { + // `x.x` is the mask's own suffix, so a value ending in it must not be waved through unless the + // whole value is a mask — otherwise "10.4.7.19 x.x" would be accepted as already redacted. + assertThat(GrpcDiagnosticsRedactor.maskAddress("10.4.7.19 x.x")).isNotEqualTo("10.4.7.19 x.x"); + } +} diff --git a/src/grpc-advanced/grpc-advanced-resilience/src/main/java/dev/caskeleton/grpc/advanced/resilience/GrpcHedgingEligibility.java b/src/grpc-advanced/grpc-advanced-resilience/src/main/java/dev/caskeleton/grpc/advanced/resilience/GrpcHedgingEligibility.java index 9131adc8..f9ecc17f 100644 --- a/src/grpc-advanced/grpc-advanced-resilience/src/main/java/dev/caskeleton/grpc/advanced/resilience/GrpcHedgingEligibility.java +++ b/src/grpc-advanced/grpc-advanced-resilience/src/main/java/dev/caskeleton/grpc/advanced/resilience/GrpcHedgingEligibility.java @@ -1,8 +1,8 @@ package dev.caskeleton.grpc.advanced.resilience; -import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; +import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.resilience.GrpcRetryOwner; import java.util.Optional; diff --git a/src/grpc-advanced/grpc-advanced-resilience/src/test/java/dev/caskeleton/grpc/advanced/resilience/GrpcHedgingEligibilityTest.java b/src/grpc-advanced/grpc-advanced-resilience/src/test/java/dev/caskeleton/grpc/advanced/resilience/GrpcHedgingEligibilityTest.java index f26115bb..c0350c4d 100644 --- a/src/grpc-advanced/grpc-advanced-resilience/src/test/java/dev/caskeleton/grpc/advanced/resilience/GrpcHedgingEligibilityTest.java +++ b/src/grpc-advanced/grpc-advanced-resilience/src/test/java/dev/caskeleton/grpc/advanced/resilience/GrpcHedgingEligibilityTest.java @@ -3,12 +3,12 @@ package dev.caskeleton.grpc.advanced.resilience; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import dev.caskeleton.grpc.core.GrpcMethodName; -import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; import dev.caskeleton.grpc.api.policy.WaitForReadyPolicy; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.resilience.GrpcRetryOwner; import java.time.Duration; import org.junit.jupiter.api.DisplayName; diff --git a/src/grpc/grpc-client/src/main/java/dev/caskeleton/grpc/client/GrpcClientCallContext.java b/src/grpc/grpc-client/src/main/java/dev/caskeleton/grpc/client/GrpcClientCallContext.java index 0c21026f..78e37d8a 100644 --- a/src/grpc/grpc-client/src/main/java/dev/caskeleton/grpc/client/GrpcClientCallContext.java +++ b/src/grpc/grpc-client/src/main/java/dev/caskeleton/grpc/client/GrpcClientCallContext.java @@ -1,8 +1,8 @@ package dev.caskeleton.grpc.client; import dev.caskeleton.grpc.api.context.GrpcMetadataKey; -import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; +import dev.caskeleton.grpc.core.GrpcMethodName; import java.time.Instant; import java.util.Map; import java.util.Optional; diff --git a/src/grpc/grpc-client/src/main/java/dev/caskeleton/grpc/client/GrpcStubPolicyApplier.java b/src/grpc/grpc-client/src/main/java/dev/caskeleton/grpc/client/GrpcStubPolicyApplier.java index 4625d3dd..467d8fa3 100644 --- a/src/grpc/grpc-client/src/main/java/dev/caskeleton/grpc/client/GrpcStubPolicyApplier.java +++ b/src/grpc/grpc-client/src/main/java/dev/caskeleton/grpc/client/GrpcStubPolicyApplier.java @@ -1,10 +1,10 @@ package dev.caskeleton.grpc.client; -import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; -import dev.caskeleton.grpc.deadline.GrpcDeadlineCalculator; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.deadline.GrpcDeadlineCalculator; import dev.caskeleton.grpc.resilience.GrpcWaitForReadyDecision; import dev.caskeleton.grpc.resilience.GrpcWaitForReadyProfile; import dev.caskeleton.grpc.resilience.GrpcWaitForReadyValidator; diff --git a/src/grpc/grpc-client/src/test/java/dev/caskeleton/grpc/client/GrpcClientMetadataPolicyTest.java b/src/grpc/grpc-client/src/test/java/dev/caskeleton/grpc/client/GrpcClientMetadataPolicyTest.java index 1cb2cf12..1d663b9a 100644 --- a/src/grpc/grpc-client/src/test/java/dev/caskeleton/grpc/client/GrpcClientMetadataPolicyTest.java +++ b/src/grpc/grpc-client/src/test/java/dev/caskeleton/grpc/client/GrpcClientMetadataPolicyTest.java @@ -5,10 +5,10 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import dev.caskeleton.grpc.api.context.GrpcMetadataBudget; import dev.caskeleton.grpc.api.context.GrpcMetadataKey; -import dev.caskeleton.grpc.core.GrpcChannelProfileName; -import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; +import dev.caskeleton.grpc.core.GrpcChannelProfileName; +import dev.caskeleton.grpc.core.GrpcMethodName; import java.time.Duration; import java.time.Instant; import java.util.LinkedHashMap; diff --git a/src/grpc/grpc-client/src/test/java/dev/caskeleton/grpc/client/GrpcTypedStubFactoryTest.java b/src/grpc/grpc-client/src/test/java/dev/caskeleton/grpc/client/GrpcTypedStubFactoryTest.java index 1ab4a99c..8203a612 100644 --- a/src/grpc/grpc-client/src/test/java/dev/caskeleton/grpc/client/GrpcTypedStubFactoryTest.java +++ b/src/grpc/grpc-client/src/test/java/dev/caskeleton/grpc/client/GrpcTypedStubFactoryTest.java @@ -3,11 +3,11 @@ package dev.caskeleton.grpc.client; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import dev.caskeleton.grpc.core.GrpcChannelProfileName; -import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; +import dev.caskeleton.grpc.core.GrpcChannelProfileName; +import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.resilience.GrpcWaitForReadyProfile; import java.time.Duration; import java.time.Instant; diff --git a/src/grpc/grpc-core-api/src/main/java/dev/caskeleton/grpc/api/context/GrpcRequestContext.java b/src/grpc/grpc-core-api/src/main/java/dev/caskeleton/grpc/api/context/GrpcRequestContext.java index d42a3a5f..4be79065 100644 --- a/src/grpc/grpc-core-api/src/main/java/dev/caskeleton/grpc/api/context/GrpcRequestContext.java +++ b/src/grpc/grpc-core-api/src/main/java/dev/caskeleton/grpc/api/context/GrpcRequestContext.java @@ -1,9 +1,9 @@ package dev.caskeleton.grpc.api.context; -import dev.caskeleton.grpc.core.GrpcMethodName; -import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.api.deadline.GrpcCancellationToken; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.core.RpcType; import java.util.LinkedHashMap; import java.util.Map; import java.util.Optional; diff --git a/src/grpc/grpc-core-api/src/main/java/dev/caskeleton/grpc/api/policy/GrpcMethodPolicy.java b/src/grpc/grpc-core-api/src/main/java/dev/caskeleton/grpc/api/policy/GrpcMethodPolicy.java index 3002e059..019a69d5 100644 --- a/src/grpc/grpc-core-api/src/main/java/dev/caskeleton/grpc/api/policy/GrpcMethodPolicy.java +++ b/src/grpc/grpc-core-api/src/main/java/dev/caskeleton/grpc/api/policy/GrpcMethodPolicy.java @@ -1,8 +1,8 @@ package dev.caskeleton.grpc.api.policy; +import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.core.RpcType; -import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; /** * Everything the platform decides per method, in one immutable value. diff --git a/src/grpc/grpc-core-api/src/test/java/dev/caskeleton/grpc/api/context/GrpcMetadataBudgetTest.java b/src/grpc/grpc-core-api/src/test/java/dev/caskeleton/grpc/api/context/GrpcMetadataBudgetTest.java index dba71e3f..4a4851df 100644 --- a/src/grpc/grpc-core-api/src/test/java/dev/caskeleton/grpc/api/context/GrpcMetadataBudgetTest.java +++ b/src/grpc/grpc-core-api/src/test/java/dev/caskeleton/grpc/api/context/GrpcMetadataBudgetTest.java @@ -3,11 +3,11 @@ package dev.caskeleton.grpc.api.context; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import dev.caskeleton.grpc.core.GrpcMethodName; -import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.api.deadline.GrpcCancellationToken; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.core.RpcType; import java.time.Duration; import java.util.LinkedHashMap; import java.util.Map; diff --git a/src/grpc/grpc-core-api/src/test/java/dev/caskeleton/grpc/api/policy/GrpcMethodPolicyCatalogTest.java b/src/grpc/grpc-core-api/src/test/java/dev/caskeleton/grpc/api/policy/GrpcMethodPolicyCatalogTest.java index 213048f1..fc526431 100644 --- a/src/grpc/grpc-core-api/src/test/java/dev/caskeleton/grpc/api/policy/GrpcMethodPolicyCatalogTest.java +++ b/src/grpc/grpc-core-api/src/test/java/dev/caskeleton/grpc/api/policy/GrpcMethodPolicyCatalogTest.java @@ -3,9 +3,9 @@ package dev.caskeleton.grpc.api.policy; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.core.RpcType; -import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import java.time.Duration; import java.util.Set; import org.junit.jupiter.api.DisplayName; diff --git a/src/grpc/grpc-observability/src/main/java/dev/caskeleton/grpc/observability/GrpcRpcObservation.java b/src/grpc/grpc-observability/src/main/java/dev/caskeleton/grpc/observability/GrpcRpcObservation.java index 0aad8330..d305c2e3 100644 --- a/src/grpc/grpc-observability/src/main/java/dev/caskeleton/grpc/observability/GrpcRpcObservation.java +++ b/src/grpc/grpc-observability/src/main/java/dev/caskeleton/grpc/observability/GrpcRpcObservation.java @@ -1,9 +1,9 @@ package dev.caskeleton.grpc.observability; +import dev.caskeleton.grpc.api.error.GrpcCompletionOutcome; import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.core.GrpcStatusCode; import dev.caskeleton.grpc.core.RpcType; -import dev.caskeleton.grpc.api.error.GrpcCompletionOutcome; import java.time.Duration; import java.util.LinkedHashMap; import java.util.Map; diff --git a/src/grpc/grpc-observability/src/test/java/dev/caskeleton/grpc/observability/GrpcMetricCardinalityPolicyTest.java b/src/grpc/grpc-observability/src/test/java/dev/caskeleton/grpc/observability/GrpcMetricCardinalityPolicyTest.java index 9b58357f..f8231bd7 100644 --- a/src/grpc/grpc-observability/src/test/java/dev/caskeleton/grpc/observability/GrpcMetricCardinalityPolicyTest.java +++ b/src/grpc/grpc-observability/src/test/java/dev/caskeleton/grpc/observability/GrpcMetricCardinalityPolicyTest.java @@ -3,10 +3,10 @@ package dev.caskeleton.grpc.observability; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import dev.caskeleton.grpc.api.error.GrpcCompletionOutcome; import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.core.GrpcStatusCode; import dev.caskeleton.grpc.core.RpcType; -import dev.caskeleton.grpc.api.error.GrpcCompletionOutcome; import io.micrometer.core.instrument.simple.SimpleMeterRegistry; import java.time.Duration; import java.util.LinkedHashMap; diff --git a/src/grpc/grpc-operation-ledger-jpa/src/main/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerEntity.java b/src/grpc/grpc-operation-ledger-jpa/src/main/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerEntity.java index 0b50ca56..54e26abb 100644 --- a/src/grpc/grpc-operation-ledger-jpa/src/main/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerEntity.java +++ b/src/grpc/grpc-operation-ledger-jpa/src/main/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerEntity.java @@ -3,7 +3,6 @@ package dev.caskeleton.grpc.ledger; import dev.caskeleton.grpc.api.ledger.GrpcOperationIdentity; import dev.caskeleton.grpc.api.ledger.GrpcOperationLedgerRecord; import dev.caskeleton.grpc.api.ledger.GrpcOperationLedgerState; - import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.EnumType; diff --git a/src/grpc/grpc-operation-ledger-jpa/src/main/java/dev/caskeleton/grpc/ledger/JpaGrpcOperationLedger.java b/src/grpc/grpc-operation-ledger-jpa/src/main/java/dev/caskeleton/grpc/ledger/JpaGrpcOperationLedger.java index aada9538..7c038050 100644 --- a/src/grpc/grpc-operation-ledger-jpa/src/main/java/dev/caskeleton/grpc/ledger/JpaGrpcOperationLedger.java +++ b/src/grpc/grpc-operation-ledger-jpa/src/main/java/dev/caskeleton/grpc/ledger/JpaGrpcOperationLedger.java @@ -3,7 +3,6 @@ package dev.caskeleton.grpc.ledger; import dev.caskeleton.grpc.api.ledger.GrpcOperationIdentity; import dev.caskeleton.grpc.api.ledger.GrpcOperationLedger; import dev.caskeleton.grpc.api.ledger.GrpcOperationLedgerRecord; - import java.time.Instant; import java.util.Optional; diff --git a/src/grpc/grpc-operation-ledger-jpa/src/test/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerRepositoryTest.java b/src/grpc/grpc-operation-ledger-jpa/src/test/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerRepositoryTest.java index ae22807c..fba811e8 100644 --- a/src/grpc/grpc-operation-ledger-jpa/src/test/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerRepositoryTest.java +++ b/src/grpc/grpc-operation-ledger-jpa/src/test/java/dev/caskeleton/grpc/ledger/GrpcOperationLedgerRepositoryTest.java @@ -1,13 +1,12 @@ package dev.caskeleton.grpc.ledger; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + import dev.caskeleton.grpc.api.ledger.GrpcOperationIdentity; import dev.caskeleton.grpc.api.ledger.GrpcOperationLedger; import dev.caskeleton.grpc.api.ledger.GrpcOperationLedgerRecord; import dev.caskeleton.grpc.api.ledger.GrpcOperationLedgerState; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - import dev.caskeleton.grpc.core.GrpcMethodName; import java.io.IOException; import java.io.UncheckedIOException; diff --git a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/context/GrpcContextSnapshot.java b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/context/GrpcContextSnapshot.java index 3aa01328..49996762 100644 --- a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/context/GrpcContextSnapshot.java +++ b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/context/GrpcContextSnapshot.java @@ -2,10 +2,9 @@ package dev.caskeleton.grpc.context; import dev.caskeleton.grpc.api.context.GrpcClientIdentity; import dev.caskeleton.grpc.api.context.GrpcRequestContext; - -import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.api.deadline.GrpcCancellationToken; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; +import dev.caskeleton.grpc.core.GrpcMethodName; import java.time.Instant; import java.util.Optional; diff --git a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/deadline/GrpcCancellationCoordinator.java b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/deadline/GrpcCancellationCoordinator.java index 26fe0415..2a676aeb 100644 --- a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/deadline/GrpcCancellationCoordinator.java +++ b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/deadline/GrpcCancellationCoordinator.java @@ -1,7 +1,6 @@ package dev.caskeleton.grpc.deadline; import dev.caskeleton.grpc.api.deadline.GrpcCancellationToken; - import java.time.Instant; import java.util.ArrayList; import java.util.LinkedHashMap; diff --git a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/deadline/GrpcDeadlineCalculator.java b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/deadline/GrpcDeadlineCalculator.java index 6790c710..1fcbad68 100644 --- a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/deadline/GrpcDeadlineCalculator.java +++ b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/deadline/GrpcDeadlineCalculator.java @@ -2,9 +2,8 @@ package dev.caskeleton.grpc.deadline; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; - -import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; +import dev.caskeleton.grpc.core.RpcType; import java.time.Duration; /** diff --git a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/deadline/GrpcDeadlinePolicyValidator.java b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/deadline/GrpcDeadlinePolicyValidator.java index 46ef8ef4..89370767 100644 --- a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/deadline/GrpcDeadlinePolicyValidator.java +++ b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/deadline/GrpcDeadlinePolicyValidator.java @@ -1,9 +1,9 @@ package dev.caskeleton.grpc.deadline; -import dev.caskeleton.grpc.core.GrpcMethodName; -import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.core.RpcType; import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/error/GrpcErrorMapper.java b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/error/GrpcErrorMapper.java index cad91263..8d1dac5a 100644 --- a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/error/GrpcErrorMapper.java +++ b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/error/GrpcErrorMapper.java @@ -3,7 +3,6 @@ package dev.caskeleton.grpc.error; import dev.caskeleton.grpc.api.error.GrpcFailureCategory; import dev.caskeleton.grpc.api.error.GrpcFailureContext; import dev.caskeleton.grpc.api.error.GrpcPlatformException; - import dev.caskeleton.grpc.core.GrpcStatusCode; import dev.caskeleton.grpc.validation.GrpcValidationViolation; import io.grpc.Metadata; diff --git a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/error/GrpcStatusMapping.java b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/error/GrpcStatusMapping.java index afa001e5..cc8b3c31 100644 --- a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/error/GrpcStatusMapping.java +++ b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/error/GrpcStatusMapping.java @@ -1,7 +1,6 @@ package dev.caskeleton.grpc.error; import dev.caskeleton.grpc.api.error.GrpcFailureCategory; - import dev.caskeleton.grpc.core.GrpcStatusCode; import io.grpc.Status; diff --git a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/idempotency/GrpcIdempotencyInterceptor.java b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/idempotency/GrpcIdempotencyInterceptor.java index 8f1fd519..7307ed4f 100644 --- a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/idempotency/GrpcIdempotencyInterceptor.java +++ b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/idempotency/GrpcIdempotencyInterceptor.java @@ -1,12 +1,12 @@ package dev.caskeleton.grpc.idempotency; -import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.api.ledger.GrpcOperationIdentity; import dev.caskeleton.grpc.api.ledger.GrpcOperationLedger; import dev.caskeleton.grpc.api.ledger.GrpcOperationLedgerRecord; import dev.caskeleton.grpc.api.ledger.GrpcOperationLedgerState; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; +import dev.caskeleton.grpc.core.GrpcMethodName; import java.time.Duration; import java.time.Instant; import java.util.Optional; diff --git a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/idempotency/GrpcOperationStatusQuery.java b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/idempotency/GrpcOperationStatusQuery.java index 290c14f9..6c654267 100644 --- a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/idempotency/GrpcOperationStatusQuery.java +++ b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/idempotency/GrpcOperationStatusQuery.java @@ -1,10 +1,10 @@ package dev.caskeleton.grpc.idempotency; -import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import dev.caskeleton.grpc.api.ledger.GrpcOperationIdentity; import dev.caskeleton.grpc.api.ledger.GrpcOperationLedger; import dev.caskeleton.grpc.api.ledger.GrpcOperationLedgerRecord; +import dev.caskeleton.grpc.core.GrpcMethodName; import java.time.Duration; import java.util.Optional; diff --git a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/resilience/GrpcRetryCoordinator.java b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/resilience/GrpcRetryCoordinator.java index 43578a95..b967e90a 100644 --- a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/resilience/GrpcRetryCoordinator.java +++ b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/resilience/GrpcRetryCoordinator.java @@ -1,9 +1,9 @@ package dev.caskeleton.grpc.resilience; -import dev.caskeleton.grpc.core.GrpcStatusCode; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; -import dev.caskeleton.grpc.evidence.GrpcExecutionEvidence; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; +import dev.caskeleton.grpc.core.GrpcStatusCode; +import dev.caskeleton.grpc.evidence.GrpcExecutionEvidence; import java.time.Duration; import java.util.random.RandomGenerator; diff --git a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/resilience/GrpcRetryEligibility.java b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/resilience/GrpcRetryEligibility.java index 2f9a0c06..b41cc9e3 100644 --- a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/resilience/GrpcRetryEligibility.java +++ b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/resilience/GrpcRetryEligibility.java @@ -1,9 +1,9 @@ package dev.caskeleton.grpc.resilience; -import dev.caskeleton.grpc.core.GrpcStatusCode; -import dev.caskeleton.grpc.evidence.GrpcExecutionEvidence; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; +import dev.caskeleton.grpc.core.GrpcStatusCode; +import dev.caskeleton.grpc.evidence.GrpcExecutionEvidence; /** * Whether an attempt may be repeated at all, judged from the method, the evidence and the status diff --git a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/resilience/GrpcRetryOwnershipValidator.java b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/resilience/GrpcRetryOwnershipValidator.java index b19faea0..863c49d6 100644 --- a/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/resilience/GrpcRetryOwnershipValidator.java +++ b/src/grpc/grpc-policy/src/main/java/dev/caskeleton/grpc/resilience/GrpcRetryOwnershipValidator.java @@ -1,8 +1,8 @@ package dev.caskeleton.grpc.resilience; -import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; +import dev.caskeleton.grpc.core.GrpcMethodName; import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; diff --git a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/context/GrpcContextBinderTest.java b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/context/GrpcContextBinderTest.java index 2a6db44f..a97f73c8 100644 --- a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/context/GrpcContextBinderTest.java +++ b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/context/GrpcContextBinderTest.java @@ -1,17 +1,16 @@ package dev.caskeleton.grpc.context; -import dev.caskeleton.grpc.api.context.GrpcClientIdentity; -import dev.caskeleton.grpc.api.context.GrpcMetadataBudget; -import dev.caskeleton.grpc.api.context.GrpcRequestContext; - import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import dev.caskeleton.grpc.core.GrpcMethodName; -import dev.caskeleton.grpc.core.RpcType; +import dev.caskeleton.grpc.api.context.GrpcClientIdentity; +import dev.caskeleton.grpc.api.context.GrpcMetadataBudget; +import dev.caskeleton.grpc.api.context.GrpcRequestContext; import dev.caskeleton.grpc.api.deadline.GrpcCancellationToken; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.core.RpcType; import java.time.Duration; import java.time.Instant; import java.util.Map; diff --git a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/deadline/GrpcCancellationCoordinatorTest.java b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/deadline/GrpcCancellationCoordinatorTest.java index 602e8485..c3c27cfc 100644 --- a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/deadline/GrpcCancellationCoordinatorTest.java +++ b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/deadline/GrpcCancellationCoordinatorTest.java @@ -1,10 +1,9 @@ package dev.caskeleton.grpc.deadline; -import dev.caskeleton.grpc.api.deadline.GrpcCancellationToken; - import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import dev.caskeleton.grpc.api.deadline.GrpcCancellationToken; import java.time.Instant; import java.util.ArrayList; import java.util.List; diff --git a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/deadline/GrpcDeadlineCalculatorTest.java b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/deadline/GrpcDeadlineCalculatorTest.java index 5260666b..b158c987 100644 --- a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/deadline/GrpcDeadlineCalculatorTest.java +++ b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/deadline/GrpcDeadlineCalculatorTest.java @@ -1,14 +1,13 @@ package dev.caskeleton.grpc.deadline; -import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; -import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; - import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; +import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; +import dev.caskeleton.grpc.core.GrpcMethodName; import java.time.Duration; import java.util.Map; import java.util.Set; diff --git a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/error/GrpcErrorMapperTest.java b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/error/GrpcErrorMapperTest.java index 134032d2..9fc36034 100644 --- a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/error/GrpcErrorMapperTest.java +++ b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/error/GrpcErrorMapperTest.java @@ -1,12 +1,11 @@ package dev.caskeleton.grpc.error; +import static org.assertj.core.api.Assertions.assertThat; + import dev.caskeleton.grpc.api.error.GrpcCompletionOutcome; import dev.caskeleton.grpc.api.error.GrpcFailureCategory; import dev.caskeleton.grpc.api.error.GrpcFailureContext; import dev.caskeleton.grpc.api.error.GrpcPlatformException; - -import static org.assertj.core.api.Assertions.assertThat; - import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.core.GrpcStatusCode; import dev.caskeleton.grpc.core.RpcType; diff --git a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/idempotency/GrpcIdempotencyInterceptorTest.java b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/idempotency/GrpcIdempotencyInterceptorTest.java index 6bc95db4..51b8dea4 100644 --- a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/idempotency/GrpcIdempotencyInterceptorTest.java +++ b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/idempotency/GrpcIdempotencyInterceptorTest.java @@ -3,13 +3,13 @@ package dev.caskeleton.grpc.idempotency; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import dev.caskeleton.grpc.core.GrpcMethodName; -import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; import dev.caskeleton.grpc.api.policy.WaitForReadyPolicy; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.core.RpcType; import java.time.Duration; import java.time.Instant; import org.junit.jupiter.api.DisplayName; diff --git a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/resilience/GrpcRetryEligibilityTest.java b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/resilience/GrpcRetryEligibilityTest.java index 419f7347..b3c1b95f 100644 --- a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/resilience/GrpcRetryEligibilityTest.java +++ b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/resilience/GrpcRetryEligibilityTest.java @@ -2,18 +2,18 @@ package dev.caskeleton.grpc.resilience; import static org.assertj.core.api.Assertions.assertThat; +import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; +import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; +import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; +import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; +import dev.caskeleton.grpc.api.policy.WaitForReadyPolicy; import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.core.GrpcStatusCode; import dev.caskeleton.grpc.core.RpcType; -import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; -import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import dev.caskeleton.grpc.evidence.GrpcBusinessEvidence; import dev.caskeleton.grpc.evidence.GrpcExecutionEvidence; import dev.caskeleton.grpc.evidence.GrpcStreamEvidence; import dev.caskeleton.grpc.evidence.GrpcTransportEvidence; -import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; -import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; -import dev.caskeleton.grpc.api.policy.WaitForReadyPolicy; import java.time.Duration; import java.util.random.RandomGenerator; import org.junit.jupiter.api.DisplayName; diff --git a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/resilience/GrpcRetryOwnershipValidatorTest.java b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/resilience/GrpcRetryOwnershipValidatorTest.java index 9c05de4c..4eb597dd 100644 --- a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/resilience/GrpcRetryOwnershipValidatorTest.java +++ b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/resilience/GrpcRetryOwnershipValidatorTest.java @@ -3,14 +3,14 @@ package dev.caskeleton.grpc.resilience; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import dev.caskeleton.grpc.core.GrpcMethodName; -import dev.caskeleton.grpc.core.GrpcStatusCode; -import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; import dev.caskeleton.grpc.api.policy.WaitForReadyPolicy; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.core.GrpcStatusCode; +import dev.caskeleton.grpc.core.RpcType; import java.time.Duration; import java.util.Map; import java.util.Set; diff --git a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/resilience/GrpcWaitForReadyValidatorTest.java b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/resilience/GrpcWaitForReadyValidatorTest.java index e76baf57..a5bec3b0 100644 --- a/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/resilience/GrpcWaitForReadyValidatorTest.java +++ b/src/grpc/grpc-policy/src/test/java/dev/caskeleton/grpc/resilience/GrpcWaitForReadyValidatorTest.java @@ -3,13 +3,13 @@ package dev.caskeleton.grpc.resilience; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import dev.caskeleton.grpc.core.GrpcMethodName; -import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; import dev.caskeleton.grpc.api.policy.WaitForReadyPolicy; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.core.RpcType; import java.time.Duration; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; diff --git a/src/grpc/grpc-server/src/main/java/dev/caskeleton/grpc/server/GrpcServiceAdapter.java b/src/grpc/grpc-server/src/main/java/dev/caskeleton/grpc/server/GrpcServiceAdapter.java index a851af33..036a62df 100644 --- a/src/grpc/grpc-server/src/main/java/dev/caskeleton/grpc/server/GrpcServiceAdapter.java +++ b/src/grpc/grpc-server/src/main/java/dev/caskeleton/grpc/server/GrpcServiceAdapter.java @@ -1,8 +1,8 @@ package dev.caskeleton.grpc.server; import dev.caskeleton.grpc.api.context.GrpcRequestContext; -import dev.caskeleton.grpc.error.GrpcErrorMapper; import dev.caskeleton.grpc.api.error.GrpcPlatformException; +import dev.caskeleton.grpc.error.GrpcErrorMapper; import java.util.function.Function; /** diff --git a/src/grpc/grpc-server/src/test/java/dev/caskeleton/grpc/server/GrpcServiceAdapterTest.java b/src/grpc/grpc-server/src/test/java/dev/caskeleton/grpc/server/GrpcServiceAdapterTest.java index c162d6ff..997b4a29 100644 --- a/src/grpc/grpc-server/src/test/java/dev/caskeleton/grpc/server/GrpcServiceAdapterTest.java +++ b/src/grpc/grpc-server/src/test/java/dev/caskeleton/grpc/server/GrpcServiceAdapterTest.java @@ -6,17 +6,17 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import dev.caskeleton.grpc.api.context.GrpcClientIdentity; import dev.caskeleton.grpc.api.context.GrpcMetadataBudget; import dev.caskeleton.grpc.api.context.GrpcRequestContext; -import dev.caskeleton.grpc.core.GrpcMethodName; -import dev.caskeleton.grpc.core.GrpcStatusCode; -import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.api.deadline.GrpcCancellationToken; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineBudget; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import dev.caskeleton.grpc.api.error.GrpcCompletionOutcome; -import dev.caskeleton.grpc.error.GrpcErrorMapper; import dev.caskeleton.grpc.api.error.GrpcFailureCategory; import dev.caskeleton.grpc.api.error.GrpcFailureContext; import dev.caskeleton.grpc.api.error.GrpcPlatformException; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.core.GrpcStatusCode; +import dev.caskeleton.grpc.core.RpcType; +import dev.caskeleton.grpc.error.GrpcErrorMapper; import dev.caskeleton.grpc.evidence.GrpcExecutionEvidence; import io.grpc.Status; import java.time.Duration; diff --git a/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformAutoConfiguration.java b/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformAutoConfiguration.java index f550d4cf..2901f6c3 100644 --- a/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformAutoConfiguration.java +++ b/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformAutoConfiguration.java @@ -5,11 +5,11 @@ import dev.caskeleton.grpc.admin.GrpcDrainPolicy; import dev.caskeleton.grpc.admin.GrpcHealthPolicy; import dev.caskeleton.grpc.admin.GrpcReflectionPolicy; import dev.caskeleton.grpc.admin.GrpcServiceHealthRegistry; +import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; import dev.caskeleton.grpc.client.GrpcNamedChannelProfile; import dev.caskeleton.grpc.context.GrpcContextBinder; import dev.caskeleton.grpc.context.GrpcContextPropagationPolicy; import dev.caskeleton.grpc.error.GrpcErrorMapper; -import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; import dev.caskeleton.grpc.server.GrpcAdmissionController; import dev.caskeleton.grpc.server.GrpcExecutorProfile; import dev.caskeleton.grpc.server.GrpcServerProfile; diff --git a/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformStartupValidator.java b/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformStartupValidator.java index fd3a62ec..c72c09a4 100644 --- a/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformStartupValidator.java +++ b/src/grpc/grpc-spring-boot-starter/src/main/java/dev/caskeleton/grpc/boot/GrpcPlatformStartupValidator.java @@ -1,14 +1,14 @@ package dev.caskeleton.grpc.boot; import dev.caskeleton.grpc.admin.GrpcReflectionMode; +import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; +import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; +import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; import dev.caskeleton.grpc.client.GrpcNamedChannelProfile; import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.core.GrpcStableBuildInvariant; import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.discovery.GrpcDiscoveryPolicyValidator; -import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; -import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; -import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; import dev.caskeleton.grpc.resilience.GrpcRetryOwner; import java.util.ArrayList; import java.util.LinkedHashSet; diff --git a/src/grpc/grpc-spring-boot-starter/src/test/java/dev/caskeleton/grpc/boot/GrpcPlatformStartupValidatorTest.java b/src/grpc/grpc-spring-boot-starter/src/test/java/dev/caskeleton/grpc/boot/GrpcPlatformStartupValidatorTest.java index 5d9ea89c..dac26dac 100644 --- a/src/grpc/grpc-spring-boot-starter/src/test/java/dev/caskeleton/grpc/boot/GrpcPlatformStartupValidatorTest.java +++ b/src/grpc/grpc-spring-boot-starter/src/test/java/dev/caskeleton/grpc/boot/GrpcPlatformStartupValidatorTest.java @@ -4,14 +4,14 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import dev.caskeleton.grpc.admin.GrpcReflectionMode; -import dev.caskeleton.grpc.client.GrpcNamedChannelProfile; -import dev.caskeleton.grpc.core.GrpcMethodName; -import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; import dev.caskeleton.grpc.api.policy.WaitForReadyPolicy; +import dev.caskeleton.grpc.client.GrpcNamedChannelProfile; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.core.RpcType; import dev.caskeleton.grpc.resilience.GrpcRetryOwner; import dev.caskeleton.grpc.security.GrpcTlsProfile; import dev.caskeleton.grpc.server.GrpcServerTransport; diff --git a/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/GrpcUnaryReliabilityContract.java b/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/GrpcUnaryReliabilityContract.java index e039a2be..16ad07fd 100644 --- a/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/GrpcUnaryReliabilityContract.java +++ b/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/GrpcUnaryReliabilityContract.java @@ -1,9 +1,9 @@ package dev.caskeleton.grpc.testkit; +import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.deadline.GrpcDeadlinePolicyValidator; import dev.caskeleton.grpc.deadline.GrpcDependencyBudget; -import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/GrpcUnaryScenario.java b/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/GrpcUnaryScenario.java index ecb95f05..271cf95e 100644 --- a/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/GrpcUnaryScenario.java +++ b/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/GrpcUnaryScenario.java @@ -1,9 +1,9 @@ package dev.caskeleton.grpc.testkit; -import dev.caskeleton.grpc.core.GrpcMethodName; -import dev.caskeleton.grpc.core.GrpcStatusCode; import dev.caskeleton.grpc.api.error.GrpcCompletionOutcome; import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.core.GrpcStatusCode; /** * One unary reliability case: a method shape, a failure, and what must happen next. diff --git a/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/fault/GrpcFaultScenario.java b/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/fault/GrpcFaultScenario.java index 42c2138d..7d9ea511 100644 --- a/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/fault/GrpcFaultScenario.java +++ b/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/fault/GrpcFaultScenario.java @@ -1,8 +1,8 @@ package dev.caskeleton.grpc.testkit.fault; -import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.api.error.GrpcCompletionOutcome; import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; +import dev.caskeleton.grpc.core.GrpcMethodName; /** * One fault to inject, and what the client is expected to conclude from it. diff --git a/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/fault/GrpcTransportEvidenceClassifier.java b/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/fault/GrpcTransportEvidenceClassifier.java index 98868980..5a5ed202 100644 --- a/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/fault/GrpcTransportEvidenceClassifier.java +++ b/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/fault/GrpcTransportEvidenceClassifier.java @@ -1,9 +1,9 @@ package dev.caskeleton.grpc.testkit.fault; +import dev.caskeleton.grpc.api.error.GrpcCompletionOutcome; import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.core.GrpcStatusCode; import dev.caskeleton.grpc.core.RpcType; -import dev.caskeleton.grpc.api.error.GrpcCompletionOutcome; import dev.caskeleton.grpc.evidence.GrpcBusinessEvidence; import dev.caskeleton.grpc.evidence.GrpcExecutionEvidence; import dev.caskeleton.grpc.evidence.GrpcStreamEvidence; diff --git a/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/netty/GrpcTlsTestMaterial.java b/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/netty/GrpcTlsTestMaterial.java index 355b6682..41d368c5 100644 --- a/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/netty/GrpcTlsTestMaterial.java +++ b/src/grpc/grpc-testkit/src/main/java/dev/caskeleton/grpc/testkit/netty/GrpcTlsTestMaterial.java @@ -89,8 +89,7 @@ public final class GrpcTlsTestMaterial implements AutoCloseable { } try { Files.setPosixFilePermissions( - passwordPath, - java.nio.file.attribute.PosixFilePermissions.fromString("rw-------")); + passwordPath, java.nio.file.attribute.PosixFilePermissions.fromString("rw-------")); } catch (UnsupportedOperationException ignored) { // Non-POSIX test hosts still avoid argv disclosure; the whole temp directory is private. } diff --git a/src/grpc/grpc-testkit/src/test/java/dev/caskeleton/grpc/testkit/GrpcPackageOwnershipTest.java b/src/grpc/grpc-testkit/src/test/java/dev/caskeleton/grpc/testkit/GrpcPackageOwnershipTest.java index 4347d1d8..22a48355 100644 --- a/src/grpc/grpc-testkit/src/test/java/dev/caskeleton/grpc/testkit/GrpcPackageOwnershipTest.java +++ b/src/grpc/grpc-testkit/src/test/java/dev/caskeleton/grpc/testkit/GrpcPackageOwnershipTest.java @@ -17,8 +17,7 @@ class GrpcPackageOwnershipTest { @Test void corePolicyAndLedgerJpaDoNotSplitAJavaPackageAcrossLeaves() throws Exception { Path repo = repositoryRoot(); - List leaves = - List.of("grpc-core-api", "grpc-policy", "grpc-operation-ledger-jpa"); + List leaves = List.of("grpc-core-api", "grpc-policy", "grpc-operation-ledger-jpa"); Map> owners = new LinkedHashMap<>(); for (String leaf : leaves) { Path source = repo.resolve("src/grpc").resolve(leaf).resolve("src/main/java"); diff --git a/src/grpc/grpc-testkit/src/test/java/dev/caskeleton/grpc/testkit/GrpcTransportEvidenceClassifierTest.java b/src/grpc/grpc-testkit/src/test/java/dev/caskeleton/grpc/testkit/GrpcTransportEvidenceClassifierTest.java index 921bb2a1..3b7c2240 100644 --- a/src/grpc/grpc-testkit/src/test/java/dev/caskeleton/grpc/testkit/GrpcTransportEvidenceClassifierTest.java +++ b/src/grpc/grpc-testkit/src/test/java/dev/caskeleton/grpc/testkit/GrpcTransportEvidenceClassifierTest.java @@ -3,16 +3,16 @@ package dev.caskeleton.grpc.testkit; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import dev.caskeleton.grpc.api.error.GrpcCompletionOutcome; +import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; import dev.caskeleton.grpc.core.GrpcMethodName; import dev.caskeleton.grpc.core.GrpcStatusCode; import dev.caskeleton.grpc.core.RpcType; -import dev.caskeleton.grpc.api.error.GrpcCompletionOutcome; import dev.caskeleton.grpc.error.GrpcStatusMapping; import dev.caskeleton.grpc.evidence.GrpcBusinessEvidence; import dev.caskeleton.grpc.evidence.GrpcExecutionEvidence; import dev.caskeleton.grpc.evidence.GrpcStreamEvidence; import dev.caskeleton.grpc.evidence.GrpcTransportEvidence; -import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; import dev.caskeleton.grpc.testkit.fault.GrpcFaultPoint; import dev.caskeleton.grpc.testkit.fault.GrpcFaultResult; import dev.caskeleton.grpc.testkit.fault.GrpcFaultScenario; diff --git a/src/grpc/grpc-testkit/src/test/java/dev/caskeleton/grpc/testkit/GrpcUnaryReliabilityContractTest.java b/src/grpc/grpc-testkit/src/test/java/dev/caskeleton/grpc/testkit/GrpcUnaryReliabilityContractTest.java index 3312f987..164ff6f0 100644 --- a/src/grpc/grpc-testkit/src/test/java/dev/caskeleton/grpc/testkit/GrpcUnaryReliabilityContractTest.java +++ b/src/grpc/grpc-testkit/src/test/java/dev/caskeleton/grpc/testkit/GrpcUnaryReliabilityContractTest.java @@ -3,14 +3,14 @@ package dev.caskeleton.grpc.testkit; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import dev.caskeleton.grpc.core.GrpcMethodName; -import dev.caskeleton.grpc.core.GrpcStatusCode; import dev.caskeleton.grpc.api.deadline.GrpcDeadlineProfile; -import dev.caskeleton.grpc.deadline.GrpcDependencyBudget; import dev.caskeleton.grpc.api.error.GrpcCompletionOutcome; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicy; import dev.caskeleton.grpc.api.policy.GrpcMethodPolicyCatalog; import dev.caskeleton.grpc.api.policy.RpcIdempotencyProfile; +import dev.caskeleton.grpc.core.GrpcMethodName; +import dev.caskeleton.grpc.core.GrpcStatusCode; +import dev.caskeleton.grpc.deadline.GrpcDependencyBudget; import java.time.Duration; import java.util.List; import java.util.Map; diff --git a/src/messaging/messaging-admin-runtime/src/main/java/dev/caskeleton/messaging/admin/runtime/DestructiveMessagingAdmin.java b/src/messaging/messaging-admin-runtime/src/main/java/dev/caskeleton/messaging/admin/runtime/DestructiveMessagingAdmin.java index 8bd50dc2..a853d31d 100644 --- a/src/messaging/messaging-admin-runtime/src/main/java/dev/caskeleton/messaging/admin/runtime/DestructiveMessagingAdmin.java +++ b/src/messaging/messaging-admin-runtime/src/main/java/dev/caskeleton/messaging/admin/runtime/DestructiveMessagingAdmin.java @@ -1,7 +1,7 @@ package dev.caskeleton.messaging.admin.runtime; -import dev.caskeleton.messaging.admin.VerifiedApproval; import dev.caskeleton.messaging.admin.DestructiveOperation; +import dev.caskeleton.messaging.admin.VerifiedApproval; import dev.caskeleton.messaging.api.destination.DestinationName; import java.time.Duration; import java.time.Instant; diff --git a/src/messaging/messaging-kafka-share-experimental/gradle.lockfile b/src/messaging/messaging-kafka-share-experimental/gradle.lockfile index cd62c0ed..eaf97d56 100644 --- a/src/messaging/messaging-kafka-share-experimental/gradle.lockfile +++ b/src/messaging/messaging-kafka-share-experimental/gradle.lockfile @@ -31,7 +31,6 @@ com.puppycrawl.tools:checkstyle:13.5.0=checkstyle commons-beanutils:commons-beanutils:1.11.0=checkstyle commons-collections:commons-collections:3.2.2=checkstyle commons-io:commons-io:2.21.0=spotbugs -commons-logging:commons-logging:1.3.6=runtimeClasspath,testRuntimeClasspath info.picocli:picocli:4.7.7=checkstyle io.github.eisop:dataflow-errorprone:3.41.0-eisop1=annotationProcessor,testAnnotationProcessor io.github.java-diff-utils:java-diff-utils:4.12=annotationProcessor,testAnnotationProcessor @@ -89,14 +88,6 @@ org.reflections:reflections:0.10.2=checkstyle org.slf4j:slf4j-api:2.0.18=runtimeClasspath,spotbugs,spotbugsSlf4j,testRuntimeClasspath org.slf4j:slf4j-simple:2.0.17=spotbugsSlf4j org.slf4j:slf4j-simple:2.0.18=checkstyle -org.springframework.kafka:spring-kafka:4.0.7=runtimeClasspath,testRuntimeClasspath -org.springframework:spring-aop:7.0.9=runtimeClasspath,testRuntimeClasspath -org.springframework:spring-beans:7.0.9=runtimeClasspath,testRuntimeClasspath -org.springframework:spring-context:7.0.9=runtimeClasspath,testRuntimeClasspath -org.springframework:spring-core:7.0.9=runtimeClasspath,testRuntimeClasspath -org.springframework:spring-expression:7.0.9=runtimeClasspath,testRuntimeClasspath -org.springframework:spring-messaging:7.0.9=runtimeClasspath,testRuntimeClasspath -org.springframework:spring-tx:7.0.9=runtimeClasspath,testRuntimeClasspath org.xerial.snappy:snappy-java:1.1.10.7=runtimeClasspath,testRuntimeClasspath org.xmlresolver:xmlresolver:5.3.3=checkstyle,spotbugs empty= diff --git a/src/messaging/messaging-kafka/build.gradle b/src/messaging/messaging-kafka/build.gradle index dfd05337..789445b7 100644 --- a/src/messaging/messaging-kafka/build.gradle +++ b/src/messaging/messaging-kafka/build.gradle @@ -12,7 +12,9 @@ auxiliarySourceSets { } dependencies { - implementation 'org.springframework.kafka:spring-kafka' + // No spring-kafka. It was declared here and imported by nothing: this adapter drives the plain + // `org.apache.kafka` producer API directly, and a declared library that no source names is a + // resolution, a lock entry and a transitive surface bought for nothing. api project(':messaging:messaging-core-api') api project(':messaging:messaging-schema-api') api project(':messaging:messaging-policy') diff --git a/src/messaging/messaging-kafka/gradle.lockfile b/src/messaging/messaging-kafka/gradle.lockfile index b38d8676..b0dd01f0 100644 --- a/src/messaging/messaging-kafka/gradle.lockfile +++ b/src/messaging/messaging-kafka/gradle.lockfile @@ -37,7 +37,6 @@ commons-codec:commons-codec:1.19.0=integrationTestCompileClasspath,integrationTe commons-collections:commons-collections:3.2.2=checkstyle commons-io:commons-io:2.20.0=integrationTestCompileClasspath,integrationTestRuntimeClasspath commons-io:commons-io:2.21.0=spotbugs -commons-logging:commons-logging:1.3.6=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath eu.rekawek.toxiproxy:toxiproxy-java:2.1.7=integrationTestCompileClasspath,integrationTestRuntimeClasspath info.picocli:picocli:4.7.7=checkstyle io.github.eisop:dataflow-errorprone:3.41.0-eisop1=annotationProcessor,integrationTestAnnotationProcessor,jmhAnnotationProcessor,testAnnotationProcessor,testFixturesAnnotationProcessor @@ -104,14 +103,6 @@ org.rnorth.duct-tape:duct-tape:1.0.8=integrationTestCompileClasspath,integration org.slf4j:slf4j-api:2.0.18=integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhRuntimeClasspath,runtimeClasspath,spotbugs,spotbugsSlf4j,testFixturesRuntimeClasspath,testRuntimeClasspath org.slf4j:slf4j-simple:2.0.17=spotbugsSlf4j org.slf4j:slf4j-simple:2.0.18=checkstyle -org.springframework.kafka:spring-kafka:4.0.7=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath -org.springframework:spring-aop:7.0.9=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath -org.springframework:spring-beans:7.0.9=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath -org.springframework:spring-context:7.0.9=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath -org.springframework:spring-core:7.0.9=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath -org.springframework:spring-expression:7.0.9=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath -org.springframework:spring-messaging:7.0.9=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath -org.springframework:spring-tx:7.0.9=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,jmhCompileClasspath,jmhRuntimeClasspath,runtimeClasspath,testCompileClasspath,testFixturesRuntimeClasspath,testRuntimeClasspath org.testcontainers:testcontainers-junit-jupiter:2.0.5=integrationTestCompileClasspath,integrationTestRuntimeClasspath org.testcontainers:testcontainers-kafka:2.0.5=integrationTestCompileClasspath,integrationTestRuntimeClasspath org.testcontainers:testcontainers-toxiproxy:2.0.5=integrationTestCompileClasspath,integrationTestRuntimeClasspath diff --git a/src/messaging/messaging-kafka/src/test/java/dev/caskeleton/messaging/kafka/KafkaConsumerRegistrarTest.java b/src/messaging/messaging-kafka/src/test/java/dev/caskeleton/messaging/kafka/KafkaConsumerRegistrarTest.java index 8270f050..941abf34 100644 --- a/src/messaging/messaging-kafka/src/test/java/dev/caskeleton/messaging/kafka/KafkaConsumerRegistrarTest.java +++ b/src/messaging/messaging-kafka/src/test/java/dev/caskeleton/messaging/kafka/KafkaConsumerRegistrarTest.java @@ -524,7 +524,6 @@ class KafkaConsumerRegistrarTest { super.commitSync(offsets); } } - } /** Queues handler work so the in-flight ceiling is observable. */ diff --git a/src/messaging/messaging-outbox-jdbc-postgresql/src/integrationTest/java/dev/caskeleton/messaging/outbox/OutboxPostgresIT.java b/src/messaging/messaging-outbox-jdbc-postgresql/src/integrationTest/java/dev/caskeleton/messaging/outbox/OutboxPostgresIT.java index cb2d95d9..992ad2f3 100644 --- a/src/messaging/messaging-outbox-jdbc-postgresql/src/integrationTest/java/dev/caskeleton/messaging/outbox/OutboxPostgresIT.java +++ b/src/messaging/messaging-outbox-jdbc-postgresql/src/integrationTest/java/dev/caskeleton/messaging/outbox/OutboxPostgresIT.java @@ -8,6 +8,7 @@ import dev.caskeleton.messaging.api.MessageType; import dev.caskeleton.messaging.api.SchemaVersion; import dev.caskeleton.messaging.api.destination.DestinationName; import dev.caskeleton.messaging.reliability.OutboxCanonicalMetadata; +import dev.caskeleton.messaging.reliability.OutboxLease; import dev.caskeleton.messaging.reliability.OutboxRecord; import dev.caskeleton.messaging.reliability.OutboxStatus; import dev.caskeleton.messaging.testkit.DockerAvailability; @@ -130,9 +131,14 @@ class OutboxPostgresIT { void anAmbiguousRowStaysClaimableUnderItsOriginalIdentity() { OutboxRecord record = record(); appendInTransaction(record); - repository.leaseBatch(10, Duration.ofSeconds(30), NOW); + // Claimed rather than leased: a terminal write is checked against the lease token, so + // `markAmbiguous` takes the lease that owns the row. The identity-keyed overload this test used + // to call is gone, and with it the possibility of one relay writing an outcome onto a row + // another relay currently owns. + OutboxLease lease = + repository.claimBatch("ambiguous-relay", 10, Duration.ofSeconds(30), NOW).getFirst(); - repository.markAmbiguous(record.messageId(), "CONFIRM_TIMEOUT", NOW); + repository.markAmbiguous(lease, "CONFIRM_TIMEOUT", NOW); assertThat(repository.find(record.messageId()).orElseThrow().status()) .isEqualTo(OutboxStatus.AMBIGUOUS); diff --git a/src/messaging/messaging-rabbit/src/test/java/dev/caskeleton/messaging/rabbit/RabbitTopologyAndBatchTest.java b/src/messaging/messaging-rabbit/src/test/java/dev/caskeleton/messaging/rabbit/RabbitTopologyAndBatchTest.java index 678615cd..040513ea 100644 --- a/src/messaging/messaging-rabbit/src/test/java/dev/caskeleton/messaging/rabbit/RabbitTopologyAndBatchTest.java +++ b/src/messaging/messaging-rabbit/src/test/java/dev/caskeleton/messaging/rabbit/RabbitTopologyAndBatchTest.java @@ -131,9 +131,11 @@ class RabbitTopologyAndBatchTest { false, Duration.ofMillis(3)); - assertThat(result.failure()).hasValueSatisfying( - failure -> assertThat(failure.category()).isEqualTo( - dev.caskeleton.messaging.api.error.FailureCategory.AUTHENTICATION)); + assertThat(result.failure()) + .hasValueSatisfying( + failure -> + assertThat(failure.category()) + .isEqualTo(dev.caskeleton.messaging.api.error.FailureCategory.AUTHENTICATION)); } @Test @@ -142,17 +144,17 @@ class RabbitTopologyAndBatchTest { new com.rabbitmq.client.ShutdownSignalException( false, false, - new com.rabbitmq.client.impl.AMQImpl.Channel.Close( - 403, "ACCESS_REFUSED", 60, 40), + new com.rabbitmq.client.impl.AMQImpl.Channel.Close(403, "ACCESS_REFUSED", 60, 40), null); PublishResult result = - new RabbitPublishFailureClassifier() - .classify(accessRefused, false, Duration.ofMillis(3)); + new RabbitPublishFailureClassifier().classify(accessRefused, false, Duration.ofMillis(3)); - assertThat(result.failure()).hasValueSatisfying( - failure -> assertThat(failure.category()).isEqualTo( - dev.caskeleton.messaging.api.error.FailureCategory.AUTHORIZATION)); + assertThat(result.failure()) + .hasValueSatisfying( + failure -> + assertThat(failure.category()) + .isEqualTo(dev.caskeleton.messaging.api.error.FailureCategory.AUTHORIZATION)); } @Test diff --git a/src/messaging/messaging-runtime-core/src/test/java/dev/caskeleton/messaging/runtime/DefaultMessagePublisherTest.java b/src/messaging/messaging-runtime-core/src/test/java/dev/caskeleton/messaging/runtime/DefaultMessagePublisherTest.java index 5efc0c9e..510c4514 100644 --- a/src/messaging/messaging-runtime-core/src/test/java/dev/caskeleton/messaging/runtime/DefaultMessagePublisherTest.java +++ b/src/messaging/messaging-runtime-core/src/test/java/dev/caskeleton/messaging/runtime/DefaultMessagePublisherTest.java @@ -115,7 +115,8 @@ class DefaultMessagePublisherTest { assertThat(result.completion()).isEqualTo(PublishCompletion.CONFIRMED); assertThat(codecs.encodes()).isZero(); assertThat(transport.lastRequest().envelope().payload().bytes()).containsExactly(wireBytes); - assertThat(transport.lastRequest().envelope().payload().contentType()).isEqualTo(ContentType.JSON); + assertThat(transport.lastRequest().envelope().payload().contentType()) + .isEqualTo(ContentType.JSON); assertThat(admission.inFlight()).isZero(); } diff --git a/src/messaging/messaging-spring-boot-starter-kafka/gradle.lockfile b/src/messaging/messaging-spring-boot-starter-kafka/gradle.lockfile index 6e4716fe..53df71c2 100644 --- a/src/messaging/messaging-spring-boot-starter-kafka/gradle.lockfile +++ b/src/messaging/messaging-spring-boot-starter-kafka/gradle.lockfile @@ -98,14 +98,12 @@ org.springframework.boot:spring-boot-actuator:4.0.8=runtimeClasspath,testRuntime org.springframework.boot:spring-boot-autoconfigure:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.springframework.boot:spring-boot-configuration-processor:4.0.8=annotationProcessor org.springframework.boot:spring-boot:4.0.8=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.springframework.kafka:spring-kafka:4.0.7=runtimeClasspath,testRuntimeClasspath org.springframework:spring-aop:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.springframework:spring-beans:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.springframework:spring-context:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.springframework:spring-core:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.springframework:spring-expression:7.0.9=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.springframework:spring-jdbc:7.0.9=runtimeClasspath,testRuntimeClasspath -org.springframework:spring-messaging:7.0.9=runtimeClasspath,testRuntimeClasspath org.springframework:spring-tx:7.0.9=runtimeClasspath,testRuntimeClasspath org.xerial.snappy:snappy-java:1.1.10.7=runtimeClasspath,testRuntimeClasspath org.xmlresolver:xmlresolver:5.3.3=checkstyle,spotbugs diff --git a/src/messaging/messaging-spring-boot-starter/gradle.lockfile b/src/messaging/messaging-spring-boot-starter/gradle.lockfile index af7c26ed..7f5981c3 100644 --- a/src/messaging/messaging-spring-boot-starter/gradle.lockfile +++ b/src/messaging/messaging-spring-boot-starter/gradle.lockfile @@ -123,7 +123,6 @@ org.springframework.boot:spring-boot-autoconfigure:4.0.8=compileClasspath,integr org.springframework.boot:spring-boot-configuration-processor:4.0.8=annotationProcessor org.springframework.boot:spring-boot-test:4.0.8=integrationTestCompileClasspath,integrationTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.springframework.boot:spring-boot:4.0.8=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.springframework.kafka:spring-kafka:4.0.7=integrationTestRuntimeClasspath,testRuntimeClasspath org.springframework:spring-aop:7.0.9=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.springframework:spring-beans:7.0.9=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.springframework:spring-context:7.0.9=compileClasspath,integrationTestCompileClasspath,integrationTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/src/messaging/messaging-spring-boot-starter/src/main/java/dev/caskeleton/messaging/autoconfigure/MessagingProviderSelection.java b/src/messaging/messaging-spring-boot-starter/src/main/java/dev/caskeleton/messaging/autoconfigure/MessagingProviderSelection.java index 789e1a5e..227965c9 100644 --- a/src/messaging/messaging-spring-boot-starter/src/main/java/dev/caskeleton/messaging/autoconfigure/MessagingProviderSelection.java +++ b/src/messaging/messaging-spring-boot-starter/src/main/java/dev/caskeleton/messaging/autoconfigure/MessagingProviderSelection.java @@ -48,6 +48,12 @@ public class MessagingProviderSelection { "kafka", "dev.caskeleton.messaging.autoconfigure.KafkaMessagingAutoConfiguration", "rabbit", "dev.caskeleton.messaging.autoconfigure.RabbitMessagingAutoConfiguration"); + /** Broker id to the starter a deployment adds to its build to obtain that transport. */ + static final Map PROVIDER_STARTERS = + Map.of( + "kafka", "messaging-spring-boot-starter-kafka", + "rabbit", "messaging-spring-boot-starter-rabbit"); + /** * Broker ids that ship without a {@code MessagingTransport}, and why. * @@ -118,6 +124,23 @@ public class MessagingProviderSelection { + clientClass + " on the classpath; the deployment selected a transport it did not ship"); } + // The client library and the broker starter are two different build decisions, and only the + // second one carries the configuration that assembles the transport. A deployment can hold the + // Kafka client transitively and still not ship the Kafka starter — this core starter is + // broker-neutral on purpose — and until this check existed that combination reached Spring's + // import machinery, which reported a missing .class file rather than a missing capability. + String providerConfiguration = PROVIDER_CONFIGURATIONS.get(broker); + if (!ClassUtils.isPresent( + providerConfiguration, MessagingProviderSelection.class.getClassLoader())) { + throw new IllegalStateException( + MessagingSettings.PREFIX + + ".broker=" + + broker + + " needs the " + + PROVIDER_STARTERS.get(broker) + + " module on the classpath; this core starter is broker-neutral and the deployment" + + " did not compose the transport it selected"); + } String unfinished = BROKERS_WITHOUT_A_TRANSPORT.get(broker); if (unfinished != null) { throw new IllegalStateException( diff --git a/src/messaging/messaging-spring-boot-starter/src/test/java/dev/caskeleton/messaging/autoconfigure/MessagingPlatformAutoConfigurationRegistrationTest.java b/src/messaging/messaging-spring-boot-starter/src/test/java/dev/caskeleton/messaging/autoconfigure/MessagingPlatformAutoConfigurationRegistrationTest.java new file mode 100644 index 00000000..a7227e6d --- /dev/null +++ b/src/messaging/messaging-spring-boot-starter/src/test/java/dev/caskeleton/messaging/autoconfigure/MessagingPlatformAutoConfigurationRegistrationTest.java @@ -0,0 +1,104 @@ +package dev.caskeleton.messaging.autoconfigure; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; +import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.core.annotation.AnnotatedElementUtils; + +/** + * This leaf's auto-configurations are registered, not merely annotated. + * + *

Spring Boot needs two independent things before an auto-configuration runs: the annotation on + * the class, and a line naming it in {@code META-INF/spring/...AutoConfiguration.imports}. Tests + * that build a context with {@code AutoConfigurations.of(...)} supply the second one themselves, so + * they stay green for a capability that is present in no running application — which is exactly how + * several capabilities in this repository came to be assembled by nothing. + * + *

So this reads the registration file the jar actually ships and asserts both directions: every + * class this leaf means to register is named in it, and every name in it resolves to a class that + * carries {@code @AutoConfiguration}. A rename, a move or a deleted line fails here rather than in + * a deployment that starts and quietly does less than it says. + */ +class MessagingPlatformAutoConfigurationRegistrationTest { + + private static final String IMPORTS_RESOURCE = + "META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports"; + + /** The auto-configurations this leaf publishes. */ + private static final List PUBLISHED_ROOTS = + List.of("dev.caskeleton.messaging.autoconfigure.MessagingPlatformRootAutoConfiguration"); + + @Test + @DisplayName("the shipped registration file names every root this leaf publishes") + void theShippedRegistrationFileNamesEveryRoot() { + assertThat(registeredNames()) + .as("the registration lines this leaf's own jar ships") + .containsAll(PUBLISHED_ROOTS); + } + + @Test + @DisplayName("every registered name resolves to a real Boot auto-configuration") + void everyRegisteredNameResolvesToAnAutoConfiguration() { + for (String name : registeredNames()) { + Class registered; + try { + registered = + Class.forName( + name, + false, + MessagingPlatformAutoConfigurationRegistrationTest.class.getClassLoader()); + } catch (ClassNotFoundException missing) { + throw new AssertionError( + IMPORTS_RESOURCE + " registers " + name + ", which does not exist", missing); + } + assertThat(AnnotatedElementUtils.hasAnnotation(registered, AutoConfiguration.class)) + .as("%s is registered but is not annotated @AutoConfiguration", name) + .isTrue(); + } + } + + /** + * The registration lines this leaf's own resource declares. + * + *

Read from this leaf's source tree rather than from the classpath. {@code + * ClassLoader#getResources} returns every registration file on the test runtime classpath — + * Spring Boot's, springdoc's, and every dependency leaf's — so asserting over that set tests + * other people's modules and fails on their conditional classes. The file below is the one this + * leaf packages, which is the thing this contract is about. + */ + private static List registeredNames() { + Path resource = leafRoot().resolve("src/main/resources/" + IMPORTS_RESOURCE); + assertThat(Files.isRegularFile(resource)).as("%s", resource).isTrue(); + List names; + try { + names = + Files.readAllLines(resource, StandardCharsets.UTF_8).stream() + .map(String::strip) + .filter(line -> !line.isEmpty() && !line.startsWith("#")) + .toList(); + } catch (IOException failure) { + throw new UncheckedIOException("cannot read " + resource, failure); + } + assertThat(names).as("%s registers nothing", resource).isNotEmpty(); + return names; + } + + /** The nearest directory above the test's working directory that ships a registration file. */ + private static Path leafRoot() { + for (Path path = Path.of("").toAbsolutePath(); path != null; path = path.getParent()) { + if (Files.isRegularFile(path.resolve("src/main/resources/" + IMPORTS_RESOURCE))) { + return path; + } + } + throw new IllegalStateException( + "no leaf shipping " + IMPORTS_RESOURCE + " found above " + Path.of("").toAbsolutePath()); + } +} diff --git a/src/optional-platforms/build.gradle b/src/optional-platforms/build.gradle index 7b10c142..001bb2dc 100644 --- a/src/optional-platforms/build.gradle +++ b/src/optional-platforms/build.gradle @@ -1,5 +1,10 @@ plugins { id 'ca.architecture' + // Without it every gRPC leaf's jar is versioned 0.0.1-SNAPSHOT, because JavaConventionsPlugin + // falls back to that when the root has no ReleaseProvenanceExtension — so one commit produced + // two artifact sets under two different version schemes, and only one of them could be traced + // back to a revision. + id 'ca.release-provenance' } ext.sourceRevision = providers.gradleProperty('gitRevision') @@ -32,3 +37,17 @@ tasks.register('ci') { dependsOn tasks.named('qualityCheck') dependsOn tasks.named('verifyCleanArchitectureDependencies') } + +// A strict integration lane that no workflow invokes is not coverage; it is a file that looks like +// coverage. `grpc-operation-ledger-jpa` declares a Testcontainers PostgreSQL lane that certifies the +// atomic `INSERT ... ON CONFLICT DO NOTHING` claim the whole durable-idempotency contract rests on, +// and until this aggregate existed `ci` reached `checkAll`, `qualityCheck` and the dependency +// verifier only — none of which runs a lane whose category is INTEGRATION. +// +// Kept out of `ci`: every lane here starts a container, and `ci` is the per-PR gate for this build. +// The caller is integration-main.yml, the stage that owns container-backed lanes. +tasks.register('integrationCheck') { + group = 'verification' + description = 'Runs every optional-platform leaf integration test lane. Needs a container runtime.' + dependsOn subprojects.findAll { it.childProjects.isEmpty() }.collect { "${it.path}:integrationTestLaneCheck" } +} diff --git a/src/sample-portfolio/build.gradle b/src/sample-portfolio/build.gradle index e022752f..0c4b9869 100644 --- a/src/sample-portfolio/build.gradle +++ b/src/sample-portfolio/build.gradle @@ -4,6 +4,7 @@ plugins { id 'org.springframework.boot' id 'ca.auxiliary-source-set' id 'java-test-fixtures' + id 'ca.strict-qualification' } // Fixture/sample module. Production modules must not depend on this module. @@ -159,6 +160,12 @@ strictTestLanes { tasks.named('check') { dependsOn tasks.named('openapiCheckSnapshot') + // The root `verifyDependencyLocks` aggregate excludes this project, because the sample is + // outside production architecture and runtime-membership policy. A lockfile is a different + // question: this leaf's lock state changed by hundreds of lines and nothing verified it. The + // sample's own `check` is a PR gate job, so verifying it here keeps the exclusion from the + // production aggregate without leaving the lock state unchecked. + dependsOn tasks.named('verifyDependencyLocks') } def posterImageMigrationQualification = extensions.getByName('strictQualification').register( diff --git a/src/sample-portfolio/src/main/resources/application.yml b/src/sample-portfolio/src/main/resources/application.yml index 51b50852..eb6559e5 100644 --- a/src/sample-portfolio/src/main/resources/application.yml +++ b/src/sample-portfolio/src/main/resources/application.yml @@ -168,6 +168,13 @@ ca-skeleton: time-to-live: ${APP_CACHE_REDIS_L1_TTL:30s} generation-recheck-interval: ${APP_CACHE_REDIS_L1_GENERATION_RECHECK_INTERVAL:5s} invalidation-queue-capacity: ${APP_CACHE_REDIS_L1_INVALIDATION_QUEUE_CAPACITY:1024} + # SampleIdempotencyConfig assembles an IdempotencyExecutor unconditionally, and the only + # IdempotencyStorePort this composition can produce is the relational one, which is + # @ConditionalOnProperty on this key. Leaving it unset built an executor over a port nobody + # supplied and the context failed on a missing bean. The sample ships persistence-jpa and runs + # the production migration timeline, which owns idempotency_record. + idempotency: + provider: ${APP_IDEMPOTENCY_PROVIDER:jdbc} bootstrap: app-name: ${APP_NAME:sample-portfolio} runtime: diff --git a/src/sample-portfolio/src/systemTest/resources/application-test.yml b/src/sample-portfolio/src/systemTest/resources/application-test.yml index 9efae481..d78587a9 100644 --- a/src/sample-portfolio/src/systemTest/resources/application-test.yml +++ b/src/sample-portfolio/src/systemTest/resources/application-test.yml @@ -101,6 +101,9 @@ logging: org.hibernate.SQL: WARN ca-skeleton: + capabilities: + idempotency: + provider: jdbc bootstrap: app-name: sample-portfolio-test runtime: diff --git a/src/shared-contract/build.gradle b/src/shared-contract/build.gradle index 2a32ddab..d20d390a 100644 --- a/src/shared-contract/build.gradle +++ b/src/shared-contract/build.gradle @@ -1,5 +1,6 @@ plugins { id 'ca.java-library' + id 'ca.strict-qualification' } // Skeleton-wide operational contracts only. No business/domain concepts.