From 226386e38b049447b64559863d289898ae53b6b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Franco?= Date: Sun, 22 Nov 2026 05:58:23 +0100 Subject: [PATCH 1/2] fix: saveTarget() without configure keeps the connection set on an adopted target (YH-1); 2.0 doc sweep (YH-2) --- Makefile | 12 +- README.md | 3 +- coverage-text.txt | 226 ++++++++++++++++++ docs/CHANGELOG.md | 34 ++- docs/CONFIGURATION.md | 9 +- docs/FRANKENPHP-WORKER-AUDIT.md | 2 +- docs/UPGRADING.md | 30 +-- docs/USAGE.md | 10 +- .../Compiler/FileDeliveryPortsPass.php | 11 +- src/Sync/StorageMove.php | 32 ++- .../PrivateEntityManagerKernelTest.php | 68 ++++++ 11 files changed, 383 insertions(+), 54 deletions(-) create mode 100644 coverage-text.txt diff --git a/Makefile b/Makefile index 4ae4062..cf0d26a 100644 --- a/Makefile +++ b/Makefile @@ -170,8 +170,8 @@ check-twig-extra: validate-translations: ensure-up $(COMPOSE) exec -T $(SERVICE_PHP) php .scripts/validate-translations.php -# REQ-TEST-005: the Integration suite on SQLite, then the lifecycle tests (tests/Integration/Lifecycle: purge, references, moves) on the MySQL 8.4 -# service of the root compose (`db` profile, data in tmpfs), like the "Lifecycle on …" CI jobs. +# REQ-TEST-005: the Integration suite on SQLite, then the database files (lifecycle, concurrency, private / dedicated manager) on +# the MySQL 8.4 service of the root compose (`db` profile, data in tmpfs), like the "Lifecycle on …" CI jobs. STORAGE_KIT_TEST_DATABASE_URL ?= mysql://root:ci-throwaway@db:3306/storagekit?serverVersion=8.4&charset=utf8mb4 db-up: @@ -179,10 +179,10 @@ db-up: test-with-db: ensure-up db-up $(COMPOSE) exec -T $(SERVICE_PHP) vendor/bin/phpunit --testsuite Integration - $(COMPOSE) exec -T -e STORAGE_KIT_TEST_DATABASE_URL='$(STORAGE_KIT_TEST_DATABASE_URL)' $(SERVICE_PHP) vendor/bin/phpunit --no-coverage tests/Integration/Lifecycle - # 1.8: the same in host mode (the suites default to doctrine.private_entity_manager: true). - $(COMPOSE) exec -T -e STORAGE_KIT_TEST_HOST_EM=1 $(SERVICE_PHP) vendor/bin/phpunit --testsuite Integration - $(COMPOSE) exec -T -e STORAGE_KIT_TEST_HOST_EM=1 -e STORAGE_KIT_TEST_DATABASE_URL='$(STORAGE_KIT_TEST_DATABASE_URL)' $(SERVICE_PHP) vendor/bin/phpunit --no-coverage tests/Integration/Lifecycle + # The database files of the CI "Lifecycle on …" jobs (2.0: the private manager only; the 1.8 host-mode runs are gone). + @for path in tests/Integration/Lifecycle tests/Integration/Functional/ArchitectureBarTest.php tests/Integration/Concurrency tests/Integration/Functional/ConcurrentWritesTest.php tests/Integration/Persistence/PrivateEntityManagerKernelTest.php tests/Integration/Persistence/DedicatedEntityManagerKernelTest.php; do \ + $(COMPOSE) exec -T -e STORAGE_KIT_TEST_DATABASE_URL='$(STORAGE_KIT_TEST_DATABASE_URL)' $(SERVICE_PHP) vendor/bin/phpunit --no-coverage $$path || exit 1; \ + done test-coverage-with-db: ensure-up db-up $(COMPOSE) exec -T -e STORAGE_KIT_TEST_DATABASE_URL='$(STORAGE_KIT_TEST_DATABASE_URL)' $(SERVICE_PHP) vendor/bin/phpunit tests/Integration/Lifecycle --coverage-text diff --git a/README.md b/README.md index e43568e..25d9042 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,8 @@ final class IssueContext implements FileContextInterface // autoconfigured - PHP **8.2+** (`>=8.2 <8.6`, `ext-gd`; Symfony 8.x requires PHP 8.4+) - Symfony **7.4**, **8.0** or **8.1** (FrameworkBundle with CSRF, Form, Validator, RateLimiter, HttpClient, Lock, TwigBundle; SecurityBundle for the admin pages) -- Doctrine ORM **3.3+**; `nowo-tech/doctrine-encrypt-bundle` **^2.10** (registered); `nowo-tech/instance-settings-bundle` +- Doctrine ORM **3.3+**; `nowo-tech/doctrine-encrypt-bundle` **^2.10** (registered); `nowo-tech/transaction-doctrine` + **^1.9.1** (the bundle's private entity manager); `nowo-tech/instance-settings-bundle` **^1.3.1** for the default settings-backed instance bucket (a `suggest` since 2.0: require it yourself); `nowo-tech/ui-kit-bundle` **^2.23**; `nowo-tech/form-kit-bundle` **^2.17**; `nowo-tech/outbound-url-guard-bundle` **^1.3**; `async-aws/s3` **^2.8 || ^3.0**; `league/flysystem` **^3.29**; diff --git a/coverage-text.txt b/coverage-text.txt new file mode 100644 index 0000000..146a33b --- /dev/null +++ b/coverage-text.txt @@ -0,0 +1,226 @@ + + +Code Coverage Report: + 2026-11-22 04:52:54 + + Summary: + Classes: 100.00% (108/108) + Methods: 100.00% (673/673) + Lines: 100.00% (4606/4606) + +Nowo\StorageKitBundle\Audit\AuditRecorder + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 4/ 4) +Nowo\StorageKitBundle\Audit\StorageAuditEvent + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) +Nowo\StorageKitBundle\Command\AdoptInstanceBucketCommand + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 42/ 42) +Nowo\StorageKitBundle\Command\BackfillUploaderKeysCommand + Methods: 100.00% ( 7/ 7) Lines: 100.00% (129/129) +Nowo\StorageKitBundle\Command\ForgetRetiredProfilesCommand + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 21/ 21) +Nowo\StorageKitBundle\Command\PurgeFilesCommand + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 17/ 17) +Nowo\StorageKitBundle\Command\StorageSyncCommand + Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 42/ 42) +Nowo\StorageKitBundle\Concurrency\StorageConflicts + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 11/ 11) +Nowo\StorageKitBundle\Context\FileContextTarget + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 3/ 3) +Nowo\StorageKitBundle\Context\FileContexts + Methods: 100.00% ( 7/ 7) Lines: 100.00% ( 29/ 29) +Nowo\StorageKitBundle\Controller\FileDownloadController + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 8/ 8) +Nowo\StorageKitBundle\Controller\FileUploadController + Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 46/ 46) +Nowo\StorageKitBundle\Controller\StorageMoveController + Methods: 100.00% (19/19) Lines: 100.00% (137/137) +Nowo\StorageKitBundle\Controller\StorageSettingsController + Methods: 100.00% (17/17) Lines: 100.00% (119/119) +Nowo\StorageKitBundle\DependencyInjection\Compiler\CsrfProtectionPass + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 10/ 10) +Nowo\StorageKitBundle\DependencyInjection\Compiler\DebugOnlySwitchesPass + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 6/ 6) +Nowo\StorageKitBundle\DependencyInjection\Compiler\FileDeliveryPortsPass + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 19/ 19) +Nowo\StorageKitBundle\DependencyInjection\Compiler\InstanceSettingsPass + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 4/ 4) +Nowo\StorageKitBundle\DependencyInjection\Compiler\MessengerIntegrationPass + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 2/ 2) +Nowo\StorageKitBundle\DependencyInjection\Compiler\StorageEntityManagerPass + Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 51/ 51) +Nowo\StorageKitBundle\DependencyInjection\Compiler\StorageKitCommitTrackingPass + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 28/ 28) +Nowo\StorageKitBundle\DependencyInjection\Compiler\StoragePrivateEntityManagerPass + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 26/ 26) +Nowo\StorageKitBundle\DependencyInjection\Compiler\TwigPathsPass + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 16/ 16) +Nowo\StorageKitBundle\DependencyInjection\Configuration + Methods: 100.00% ( 9/ 9) Lines: 100.00% (439/439) +Nowo\StorageKitBundle\DependencyInjection\NowoStorageKitExtension + Methods: 100.00% (19/19) Lines: 100.00% (509/509) +Nowo\StorageKitBundle\Doctrine\ExcludedEntityNamespaceDriver + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 3/ 3) +Nowo\StorageKitBundle\Doctrine\OwnEntityManagerSubscriber + Methods: 100.00% (19/19) Lines: 100.00% ( 36/ 36) +Nowo\StorageKitBundle\Doctrine\OwnerLock + Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 34/ 34) +Nowo\StorageKitBundle\Doctrine\StorageEntityManager + Methods: 100.00% (21/21) Lines: 100.00% (189/189) +Nowo\StorageKitBundle\Doctrine\TablePrefixListener + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 15/ 15) +Nowo\StorageKitBundle\Doctrine\UploaderCollationListener + Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 52/ 52) +Nowo\StorageKitBundle\Download\DeliverableFile + Methods: 100.00% ( 8/ 8) Lines: 100.00% ( 12/ 12) +Nowo\StorageKitBundle\Download\DeliverableFileData + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 4/ 4) +Nowo\StorageKitBundle\Download\FileDelivery + Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 37/ 37) +Nowo\StorageKitBundle\Download\FileDeliveryResponder + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 13/ 13) +Nowo\StorageKitBundle\Download\FileUrls + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 3/ 3) +Nowo\StorageKitBundle\Download\StoredImage + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) +Nowo\StorageKitBundle\Download\StoredImageResolver + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 17/ 17) +Nowo\StorageKitBundle\Entity\StorageProfile + Methods: 100.00% (36/36) Lines: 100.00% ( 86/ 86) +Nowo\StorageKitBundle\Entity\StorageSync + Methods: 100.00% (27/27) Lines: 100.00% ( 47/ 47) +Nowo\StorageKitBundle\Entity\StoredFile + Methods: 100.00% (30/30) Lines: 100.00% ( 38/ 38) +Nowo\StorageKitBundle\Entity\StoredFileReference + Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 6/ 6) +Nowo\StorageKitBundle\EventListener\InstanceSettingsListener + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 14/ 14) +Nowo\StorageKitBundle\EventListener\RequestBoundaryListener + Methods: 100.00% (16/16) Lines: 100.00% ( 21/ 21) +Nowo\StorageKitBundle\EventListener\StorageKitAccessListener + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 13/ 13) +Nowo\StorageKitBundle\EventListener\StorageKitConflictListener + Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 29/ 29) +Nowo\StorageKitBundle\EventListener\UnitOfWorkFrames + Methods: 100.00% (30/30) Lines: 100.00% (129/129) +Nowo\StorageKitBundle\Form\AwsAccessKeyCsv + Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 30/ 30) +Nowo\StorageKitBundle\Form\AwsAccessKeyCsvException + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) +Nowo\StorageKitBundle\Form\AwsCsvImport + Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 49/ 49) +Nowo\StorageKitBundle\Form\Extension\StorageSettingsSectionTypeExtension + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 4/ 4) +Nowo\StorageKitBundle\Form\ProfileConstraints + Methods: 100.00% ( 8/ 8) Lines: 100.00% ( 27/ 27) +Nowo\StorageKitBundle\Form\StorageProfileType + Methods: 100.00% ( 4/ 4) Lines: 100.00% (123/123) +Nowo\StorageKitBundle\Http\StorageCspSources + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 9/ 9) +Nowo\StorageKitBundle\Identifier\ExactIdentifier + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 9/ 9) +Nowo\StorageKitBundle\Integration\HttpHardening\StorageCspSourceProvider + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 3/ 3) +Nowo\StorageKitBundle\Lifecycle\FilePurger + Methods: 100.00% ( 9/ 9) Lines: 100.00% (137/137) +Nowo\StorageKitBundle\Lifecycle\FileRemover + Methods: 100.00% ( 8/ 8) Lines: 100.00% ( 63/ 63) +Nowo\StorageKitBundle\Lifecycle\RemovedFile + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) +Nowo\StorageKitBundle\MessageHandler\RunStorageSyncHandler + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 6/ 6) +Nowo\StorageKitBundle\Message\RunStorageSyncMessage + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) +Nowo\StorageKitBundle\NowoStorageKitBundle + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 14/ 14) +Nowo\StorageKitBundle\PersonalData\StoredFilesPersonalData + Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 49/ 49) +Nowo\StorageKitBundle\PersonalData\UploaderIdentity + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 4/ 4) +Nowo\StorageKitBundle\PersonalData\UserIdUploaderKeyResolver + Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 29/ 29) +Nowo\StorageKitBundle\Profile\ConfigProfiles + Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 23/ 23) +Nowo\StorageKitBundle\Profile\StorageProfiles + Methods: 100.00% (16/16) Lines: 100.00% ( 62/ 62) +Nowo\StorageKitBundle\Reference\ExistingIds + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 10/ 10) +Nowo\StorageKitBundle\Reference\FileReferenceListener + Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 29/ 29) +Nowo\StorageKitBundle\Reference\FileReferences + Methods: 100.00% ( 6/ 6) Lines: 100.00% (100/100) +Nowo\StorageKitBundle\Reference\FileUris + Methods: 100.00% ( 7/ 7) Lines: 100.00% ( 17/ 17) +Nowo\StorageKitBundle\Repository\StorageProfileRepository + Methods: 100.00% (15/15) Lines: 100.00% ( 77/ 77) +Nowo\StorageKitBundle\Repository\StorageSyncRepository + Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 8/ 8) +Nowo\StorageKitBundle\Repository\StoredFileRepository + Methods: 100.00% ( 9/ 9) Lines: 100.00% ( 74/ 74) +Nowo\StorageKitBundle\Routing\StorageKitRouteLoader + Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 28/ 28) +Nowo\StorageKitBundle\Scope\DenyAllScopeAccessChecker + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) +Nowo\StorageKitBundle\Scope\StorageScope + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 5/ 5) +Nowo\StorageKitBundle\Scope\TargetScopeResolver + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) +Nowo\StorageKitBundle\Security\AccessGuard + Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 15/ 15) +Nowo\StorageKitBundle\Security\AllowAllStorageAccessChecker + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) +Nowo\StorageKitBundle\Security\EndpointGuard + Methods: 100.00% ( 9/ 9) Lines: 100.00% ( 53/ 53) +Nowo\StorageKitBundle\Security\RoleAccessChecker + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 7/ 7) +Nowo\StorageKitBundle\Settings\InstanceStorageSettings + Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 49/ 49) +Nowo\StorageKitBundle\Settings\StorageSettingsSection + Methods: 100.00% ( 8/ 8) Lines: 100.00% ( 49/ 49) +Nowo\StorageKitBundle\Storage\AsyncAwsUrlPresigner + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 8/ 8) +Nowo\StorageKitBundle\Storage\ErrorScrubber + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 13/ 13) +Nowo\StorageKitBundle\Storage\FileStorage + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 3/ 3) +Nowo\StorageKitBundle\Storage\PrivateVisibilityConverter + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 3/ 3) +Nowo\StorageKitBundle\Storage\S3Settings + Methods: 100.00% (15/15) Lines: 100.00% ( 93/ 93) +Nowo\StorageKitBundle\Storage\S3StorageConnectionFactory + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 17/ 17) +Nowo\StorageKitBundle\Storage\StorageConnection + Methods: 100.00% ( 9/ 9) Lines: 100.00% ( 30/ 30) +Nowo\StorageKitBundle\Storage\StorageProbe + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 30/ 30) +Nowo\StorageKitBundle\Storage\StorageProbeResult + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 3/ 3) +Nowo\StorageKitBundle\Storage\StorageProvider + Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 7/ 7) +Nowo\StorageKitBundle\Sync\StorageMove + Methods: 100.00% (13/13) Lines: 100.00% (127/127) +Nowo\StorageKitBundle\Sync\StorageSyncer + Methods: 100.00% (14/14) Lines: 100.00% (139/139) +Nowo\StorageKitBundle\Twig\StorageKitTwigExtension + Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 9/ 9) +Nowo\StorageKitBundle\Ui\AdminPages + Methods: 100.00% (11/11) Lines: 100.00% (113/113) +Nowo\StorageKitBundle\Ui\Bytes + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 6/ 6) +Nowo\StorageKitBundle\Ui\ProfileTester + Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 22/ 22) +Nowo\StorageKitBundle\Ui\StorageKitPages + Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 5/ 5) +Nowo\StorageKitBundle\Upload\ImageProcessor + Methods: 100.00% (12/12) Lines: 100.00% (107/107) +Nowo\StorageKitBundle\Upload\ImageUploader + Methods: 100.00% ( 9/ 9) Lines: 100.00% ( 68/ 68) +Nowo\StorageKitBundle\Upload\ProcessedImage + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 5/ 5) +Nowo\StorageKitBundle\Upload\SquareImageProcessor + Methods: 100.00% ( 9/ 9) Lines: 100.00% ( 55/ 55) +Nowo\StorageKitBundle\Upload\StoredFileView + Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 21/ 21) +Nowo\StorageKitBundle\Upload\UploadEndpoint + Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 35/ 35) +Nowo\StorageKitBundle\Upload\UploadRefused + Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 8a74644..d07a149 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -6,24 +6,25 @@ All notable changes to this project are documented here. The format follows ## Table of contents - [[Unreleased]](#unreleased) + - [Fixed](#fixed) - [[2.0.0] - 2026-11-21](#200---2026-11-21) - [Removed](#removed) - [Changed](#changed) - [Security](#security) - [[1.8.1] - 2026-11-20](#181---2026-11-20) - - [Fixed](#fixed) + - [Fixed](#fixed-1) - [[1.8.0] - 2026-11-20](#180---2026-11-20) - [Added](#added) - [Deprecated](#deprecated) - [Changed](#changed-1) - [[1.7.1] - 2026-11-19](#171---2026-11-19) - - [Fixed](#fixed-1) + - [Fixed](#fixed-2) - [[1.7.0] - 2026-11-19](#170---2026-11-19) - [Added](#added-1) - - [Fixed](#fixed-2) + - [Fixed](#fixed-3) - [Changed](#changed-2) - [[1.6.1] - 2026-11-15](#161---2026-11-15) - - [Fixed](#fixed-3) + - [Fixed](#fixed-4) - [Tests](#tests) - [[1.6.0] - 2026-11-15](#160---2026-11-15) - [Added](#added-2) @@ -36,10 +37,10 @@ All notable changes to this project are documented here. The format follows - [Tests](#tests-2) - [[1.5.2] - 2026-11-13](#152---2026-11-13) - [Security](#security-2) - - [Fixed](#fixed-4) + - [Fixed](#fixed-5) - [Tests](#tests-3) - [[1.5.1] - 2026-11-12](#151---2026-11-12) - - [Fixed](#fixed-5) + - [Fixed](#fixed-6) - [Tests](#tests-4) - [[1.5.0] - 2026-11-12](#150---2026-11-12) - [Added](#added-4) @@ -48,10 +49,10 @@ All notable changes to this project are documented here. The format follows - [[1.4.0] - 2026-11-11](#140---2026-11-11) - [Added](#added-5) - [Security](#security-3) - - [Fixed](#fixed-6) + - [Fixed](#fixed-7) - [Changed](#changed-6) - [[1.3.0] - 2026-11-11](#130---2026-11-11) - - [Fixed](#fixed-7) + - [Fixed](#fixed-8) - [Added](#added-6) - [Changed](#changed-7) - [Deprecated](#deprecated-2) @@ -62,13 +63,28 @@ All notable changes to this project are documented here. The format follows - [[1.1.0] - 2026-11-03](#110---2026-11-03) - [Added](#added-8) - [Changed](#changed-9) - - [Fixed](#fixed-8) + - [Fixed](#fixed-9) - [[1.0.0] - 2026-11-03](#100---2026-11-03) - [Added](#added-9) - [Security](#security-5) ## [Unreleased] +### Fixed + +- `Sync\StorageMove::saveTarget()` without its fourth argument (`$configure`) saved nothing for a saved target the + bundle loads again through its own manager (2.0): a target your manager loaded, or one the bundle loaded before a + unit-of-work boundary dropped the private manager (FrankenPHP worker mode included). The connection you set on it + was replaced by the stored row, yet the call returned `true` and audited `move_target_saved`. The connection set on + the target you pass (provider, enabled, endpoints, region, bucket, prefix, access key, path style and a new secret) + is now applied to the bundle's instance inside the same write unit under the owner lock; without a new secret the + stored one is kept. The Move page always passes `$configure` and was not affected (audit YH-1). +- Docs after 2.0 (audit YH-2): USAGE and CONFIGURATION no longer describe the removed `ImageUploader::upload()` or the + 1.x flushes of your default manager by the admin pages and commands; README lists `nowo-tech/transaction-doctrine`; + the `FileDeliveryPortsPass` docblock no longer calls the `FileDelivery` id deprecated or mentions `respond()`; + UPGRADING links and duplicated 1.8.0 / 1.8.1 headings fixed; `make test-with-db` runs the CI database files instead + of the removed host-mode runs. + ## [2.0.0] - 2026-11-21 2.0.0: the major that removes what 1.x deprecated (REQ-BC-001) and closes REQ-ARCH-001 rules 6 and 8. An application diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index 4f5c4af..38fb40f 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -257,7 +257,7 @@ Buckets per scope (organisation, tenant, workspace…). | Key | Default | Validation / effect | | --- | --- | --- | | `table_prefix` | `''` | `[A-Za-z0-9_]*`. Prefixes the tables and index names: `app_` gives `app_storage_kit_file`. | -| `entity_manager` | `null` | `\w+` or `null` (1.5). Null: the bundle writes through a private manager on the connection, mapping and event manager of your default manager (2.0; your manager itself is never used). A name: the bundle entities are mapped on that manager **only** (removed from the others, `auto_mapping` and a default metadata driver — DoctrineBundle 3.4 `auto_discover_entities`, fixed in Unreleased — included), every bundle read and write uses it, the bundle recovers it when closed and clears it at the end of every request, Messenger message and console command; the build fails when the manager is not declared under `doctrine.orm.entity_managers` or does not map the entities. The DDD option, on the same connection as your default manager (see below). | +| `entity_manager` | `null` | `\w+` or `null` (1.5). Null: the bundle writes through a private manager on the connection, mapping and event manager of your default manager (2.0; your manager itself is never used). A name: the bundle entities are mapped on that manager **only** (removed from the others, `auto_mapping` and a default metadata driver — DoctrineBundle 3.4 `auto_discover_entities`, fixed in 1.5.2 — included), every bundle read and write uses it, the bundle recovers it when closed and clears it at the end of every request, Messenger message and console command; the build fails when the manager is not declared under `doctrine.orm.entity_managers` or does not map the entities. The DDD option, on the same connection as your default manager (see below). | | `private_entity_manager` | `null` | Deprecated since 2.0 (REQ-ARCH-001 rule 6; removed in 3.0). The bundle always reads and writes through a private entity manager created on the connection, mapping and event manager of your default manager: same tables, nothing else to declare, no bundle flush ever writes your pending changes; dropped at every request / message / command boundary and replaced when closed. Unset: that private manager (or, with a dedicated `entity_manager`, that manager directly). `true`: a no-op with a build-time deprecation; with a dedicated `entity_manager`, the private manager on it (as in 1.8). `false`: the build fails ([UPGRADING "To 2.0.0"](UPGRADING.md#to-200)); with a dedicated `entity_manager` it is ignored with a deprecation. | Tables: `storage_kit_profile`, `storage_kit_file`, `storage_kit_file_reference`, `storage_kit_sync` (see @@ -265,9 +265,10 @@ Tables: `storage_kit_profile`, `storage_kit_file`, `storage_kit_file_reference`, ### Standard Symfony host -Keep `entity_manager: null`: the entities are attribute-mapped on your default manager. Uploads, references, the GDPR -erasure and the settings listener never flush it (DBAL statements); the admin pages and console commands do flush it -(profile save and test, moves, purge). +Keep `entity_manager: null`: the entities are attribute-mapped on your default manager's mapping and written through +the bundle's private manager on its connection (2.0). Uploads, references, the GDPR erasure and the settings listener +never flush a manager (DBAL statements); the admin pages and console commands (profile save and test, moves, purge) +flush only the private manager, never yours (1.x flushed your default manager there). ### DDD / hexagonal host (and new installs) diff --git a/docs/FRANKENPHP-WORKER-AUDIT.md b/docs/FRANKENPHP-WORKER-AUDIT.md index 46192e2..8b5c398 100644 --- a/docs/FRANKENPHP-WORKER-AUDIT.md +++ b/docs/FRANKENPHP-WORKER-AUDIT.md @@ -11,7 +11,7 @@ | Re-audit | 1.5.0 (2026-11-12): **kernel reset false supported.** Dedicated entity manager (`doctrine.entity_manager`) recovered when closed and cleared at the start and at the end of every unit — main request, Messenger message, outermost console command — so even a unit whose end never ran leaves nothing behind (`OwnEntityManagerSubscriber`, console depth counter for nested commands); memos also cleared at the end of the outermost console command; download VO secrets in a `WeakMap` keyed by the per-request VO. Worker test `tests/Integration/Ddd/DddPortsKernelTest.php::testAKeptAliveWorkerAnswersEachUserWithTheirOwnFilesAndFlatMemory`: one kernel, `http_kernel` handle / terminate, no services resetter, **N = 1,200** downloads (600 iterations × 2 files) alternating **alice / bob** (each answer only what that user may read, bytes checked), a Messenger `WorkerMessageHandledEvent` and a `console.terminate` every 100 iterations, bundle manager empty (`UnitOfWork::size() === 0`) after every request, memory growth **< 2 MB** after a 100-iteration warm-up | | Re-audit | 1.5.1 (2026-11-12, audit NM / NL2-v): the console depth counter of `OwnEntityManagerSubscriber` and `RequestBoundaryListener` could stay above zero after a throwing or propagation-stopping console listener, after which the dedicated manager was never cleared at request boundaries again. Units of work are now tracked at `PHP_INT_MAX` by `UnitOfWorkFrames` (one frame per console run keyed by command and input, saving and restoring the message / request state; failing runs without terminate dropped at the next unit; main requests counted). Test: `tests/Integration/Persistence/ConsoleBoundaryCounterKernelTest.php` | | Re-audit | 1.8.0 (2026-11-20): `doctrine.private_entity_manager: true` (transaction-doctrine `PrivateEntityManager`) is dropped at the start and end of every outermost request / message / command and at `kernel.reset`, and replaced when closed; the host-flush probe's reported classes are reset at the same boundaries (`StorageHostFlushReporter`). Worker test `tests/Integration/Persistence/PrivateEntityManagerKernelTest.php::testAKeptAliveKernelDropsThePrivateManagerAtEveryRequestBoundary`: one kernel, `handle` / `terminate`, no services resetter, 150 requests, no private manager after any `kernel.terminate`, memory growth < 2 MB after a 50-request warm-up | -| Re-audit | 2.0.0 (Unreleased, REQ-ARCH-001 rule 6): the private manager is the only mode (unless a dedicated `doctrine.entity_manager` is named); the host mode and `StorageHostFlushReporter` are removed, so no service keeps host-flush state. The same worker test runs with the default configuration (no `private_entity_manager` key) | +| Re-audit | 2.0.0 (2026-11-21, REQ-ARCH-001 rule 6): the private manager is the only mode (unless a dedicated `doctrine.entity_manager` is named); the host mode and `StorageHostFlushReporter` are removed, so no service keeps host-flush state. The same worker test runs with the default configuration (no `private_entity_manager` key) | ## Table of contents diff --git a/docs/UPGRADING.md b/docs/UPGRADING.md index 93673ab..ac9edda 100644 --- a/docs/UPGRADING.md +++ b/docs/UPGRADING.md @@ -12,10 +12,8 @@ - [Private manager only](#private-manager-only) - [1.x support](#1x-support) - [To 1.8.1](#to-181) -- [To 1.8.1](#to-181-1) - [Missing foreign keys on MySQL / MariaDB (1.5.2 to 1.8.0)](#missing-foreign-keys-on-mysql--mariadb-152-to-180) - [To 1.8.0](#to-180) -- [To 1.8.0](#to-180-1) - [The private entity manager notice](#the-private-entity-manager-notice) - [Reading the host-flush probe](#reading-the-host-flush-probe) - [Opting in: what changes](#opting-in-what-changes) @@ -43,7 +41,7 @@ ## Done in 2.0 -The breaking changes 1.x announced (REQ-BC-001), applied in 2.0 ([Unreleased](#unreleased)): +The breaking changes 1.x announced (REQ-BC-001), applied in 2.0 ([To 2.0.0](#to-200)): 1. **`nowo-tech/instance-settings-bundle` moved from `require` to `suggest`** (announced in 1.3.0; REQ-ARCH-001 rule 8). @@ -55,6 +53,12 @@ The breaking changes 1.x announced (REQ-BC-001), applied in 2.0 ([Unreleased](#u ## Unreleased +From **2.0.0**: `composer update nowo-tech/storage-kit-bundle`. No configuration or code change. + +If your code calls `StorageMove::saveTarget($target, $actor, $fields)` without the fourth argument on a target your +own manager loaded (or one kept across requests in a worker), 2.0.0 saved the stored row unchanged and still returned +`true`: save that target again after the update. The Move page was not affected. + ## To 2.0.0 From **1.8.1**: @@ -225,14 +229,6 @@ From **1.8.0**: composer update nowo-tech/storage-kit-bundle ``` -## To 1.8.1 - -From **1.8.0**: - -```bash -composer update nowo-tech/storage-kit-bundle -``` - ### Missing foreign keys on MySQL / MariaDB (1.5.2 to 1.8.0) Only MySQL / MariaDB databases whose bundle tables were created or migrated with doctrine/orm 3.7.0 to 3.8.0 and @@ -274,15 +270,7 @@ ALTER TABLE storage_kit_file_reference ADD CONSTRAINT FK_AAE94DBE93CB796C FOREIG ## To 1.8.0 -From **1.7.1**: - -```bash -composer update nowo-tech/storage-kit-bundle -``` - -## To 1.8.0 - -From **1.7.x**: +From **1.7.x** (1.8.0 requires `nowo-tech/transaction-doctrine` ^1.9.1, so update it with the bundle): ```bash composer update nowo-tech/storage-kit-bundle nowo-tech/transaction-doctrine @@ -512,7 +500,7 @@ From 1.4.0 to 1.6.1 two first uploads at the same time (or the first selection o section racing an upload) could create two active instance rows that read the `storage` section; config profiles could get two rows the same way. 1.7 creates these rows once, under a lock, but does not repair existing duplicates. On MySQL / MariaDB 1.7.0 could still create one when the first use ran inside a transaction you opened (fixed in -1.7.1, [Unreleased](#unreleased)). Check once after upgrading (`` is `doctrine.table_prefix`, empty by default): +1.7.1, [To 1.7.1](#to-171)). Check once after upgrading (`` is `doctrine.table_prefix`, empty by default): ```sql -- More than one row: the instance has duplicate active rows diff --git a/docs/USAGE.md b/docs/USAGE.md index 6326fb7..d54b4e2 100644 --- a/docs/USAGE.md +++ b/docs/USAGE.md @@ -58,7 +58,8 @@ Nothing to configure beyond the [installation](INSTALLATION.md): require and register `NowoInstanceSettingsBundle` (`nowo-tech/instance-settings-bundle` ^1.3.1, a `suggest` since 2.0) and the instance bucket is the -`storage` settings section; the bundle entities are attribute-mapped on your default entity manager; your texts are +`storage` settings section; the bundle entities are attribute-mapped on your default manager's mapping and written +through the bundle's private manager on its connection (2.0); your texts are Doctrine entities whose `FileReferenceSourceInterface` makes the references automatic; downloads, rendering and GDPR hooks are services you inject (`StoredImageResolver`, `StoredFilesPersonalData::exportUser()` / `eraseUser()`). @@ -219,8 +220,8 @@ Use `forget('comment', [$id])` when a text is deleted. Inject `Upload\ImageUploaderInterface` and call `uploadImage($user, $contextType, $contextId, $bytes, $name)`: it returns a `StoredFileView` DTO (`uuid`, `scope`, context, name, type, sizes, variants, `uploadedBy`, `createdAt`); reference the file by its `uuid`. The row is written with a DBAL insert built from the entity metadata: **no entity -manager is flushed**, so an upload never commits what your own unit of work left pending (standard applications get -the same guarantee through the deprecated `upload()`, which still returns the `StoredFile` entity). +manager is flushed**, so an upload never commits what your own unit of work left pending (2.0 removed the 1.3 +`upload()` that returned the `StoredFile` entity; load the row by `uuid` if you need it). - *Outside a transaction* the row is committed at once and the `file_uploaded` audit event follows. - *Inside your transaction* (the host controls the unit of work) the row joins it in a savepoint (a failed insert rolls @@ -453,7 +454,8 @@ WebP are re-encoded (EXIF / GPS / XMP dropped, JPEGs turned upright); GIF and an | 503 | `storage` | the bucket failed (objects already written are removed) | `message` is the translated `upload.error.`. Answers are `private, no-store`, `nosniff`. A refused upload -stores nothing. The PHP API behind it is `Upload\ImageUploader::upload($user, $type, $id, $bytes, $name)`. +stores nothing. The PHP API behind it is `Upload\ImageUploaderInterface::uploadImage($user, $type, $id, $bytes, $name)` +(a `StoredFileView`; [Uploading from your code](#uploading-from-your-code-13)). A new file is an orphan until a text that points at it is saved ([References](#references-and-the-purge)). diff --git a/src/DependencyInjection/Compiler/FileDeliveryPortsPass.php b/src/DependencyInjection/Compiler/FileDeliveryPortsPass.php index a5c268c..1ca17ea 100644 --- a/src/DependencyInjection/Compiler/FileDeliveryPortsPass.php +++ b/src/DependencyInjection/Compiler/FileDeliveryPortsPass.php @@ -6,6 +6,7 @@ use LogicException; use Nowo\StorageKitBundle\Download\FileDeliveryInterface; +use Nowo\StorageKitBundle\Download\FileDeliveryResponder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -18,14 +19,14 @@ * Checks the service behind the download port {@see FileDeliveryInterface} (1.5, REQ-ARCH-001 rule 3), once the * container knows its final class (after decoration, so a host decorator decides). Runs before the removing passes. * - * - By default the port is the bundle's own delivery (`nowo_storage_kit.file_delivery`), the service the deprecated - * `FileDelivery` id also points at. + * - By default the port is the bundle's own delivery (`nowo_storage_kit.file_delivery`), the service the `FileDelivery` + * class id also points at. * - The host's port wins: an alias of `FileDeliveryInterface` to its own service, or a decorator of * `FileDeliveryInterface`, is what the download controller calls. It must implement the port, or the container build * fails — a file is never served by a service that cannot serve it. - * - A decorator of the deprecated `FileDelivery` id (a 1.4 decorator offering `respond()`) keeps decorating that id for - * the host code that calls it; the port and the download controller are not affected (in 1.4 the controller required - * the final `FileDelivery` class, so no decorator could run there). + * - A decorator of the `FileDelivery` class id decorates that id only, for the host code that calls it; the port and + * the download controller are not affected. (2.0 removed `FileDelivery::respond()`, deprecated since 1.5: a decorator + * calls `deliver()` and builds the response with {@see FileDeliveryResponder}.) * * A service whose class cannot be known before the container is compiled (factory, synthetic, unknown class) is left * to the controller's typed constructor. diff --git a/src/Sync/StorageMove.php b/src/Sync/StorageMove.php index 881543c..92b3f1b 100644 --- a/src/Sync/StorageMove.php +++ b/src/Sync/StorageMove.php @@ -96,15 +96,24 @@ public function sync(?StorageProfile $active, ?StorageProfile $target): ?Storage * inside the unit; false (nothing written) when the owner's target changed since the page was read (another target * saved, or this one discarded or switched to). * + * Without `$configure` the connection already set on `$target` is saved. 2.0.1: when `$target` is a saved target + * the bundle loads again through its own manager (one your manager handed it, or one loaded before a unit-of-work + * boundary dropped the private manager), that connection is applied to the bundle's instance inside the unit; 2.0.0 + * saved the stored row unchanged and still reported it as saved. + * * @param list $fields names of the changed fields - * @param (callable(StorageProfile): void)|null $configure applies the submitted fields (null: already applied - * to an unsaved target) + * @param (callable(StorageProfile): void)|null $configure applies the submitted fields (null: the connection set + * on `$target` is saved as it is) */ public function saveTarget(StorageProfile $target, ?object $actor, array $fields, ?callable $configure = null): bool { // 2.0 (lesson W1-2): a saved target loaded through the application's manager is loaded again by the bundle's. + $given = $target; $target = $this->entityManager->adopt($target); - $scope = $target->getScope(); + if ($configure === null && $target !== $given) { + $configure = $this->copyConnection($given); + } + $scope = $target->getScope(); // @igor-ignore - The closure runs synchronously inside the unit of work; it is not stored on the service. $saved = $this->entityManager->transactional(function () use ($target, $scope, $configure): bool { if (!$this->profiles->isCurrent($target, $scope, StorageProfile::STATE_TARGET)) { @@ -125,6 +134,23 @@ public function saveTarget(StorageProfile $target, ?object $actor, array $fields return $saved; } + /** + * 2.0.1 (YH-1): applies the connection set on `$given` (provider, enabled, endpoints, region, bucket, prefix, + * access key, path style and, when it differs, the secret) to the bundle's own instance of the same row. + * + * @return callable(StorageProfile): void + */ + private function copyConnection(StorageProfile $given): callable + { + return static function (StorageProfile $own) use ($given): void { + $own->configure($given->getProvider(), $given->isEnabled(), $given->getEndpoint(), $given->getPublicEndpoint(), $given->getRegion(), $given->getBucket(), $given->getPrefix(), $given->getAccessKey(), null, $given->isPathStyle()); + $secret = $given->getSecret(); + if ($secret !== null && $secret !== '' && $secret !== $own->getSecret()) { + $own->setSecret($secret); + } + }; + } + /** * Queues the sync (new or resumed) and dispatches it when a bus is available, after the commit (1.7: one write * unit under the owner lock). Null (nothing queued) when the pair is no longer the owner's active and target diff --git a/tests/Integration/Persistence/PrivateEntityManagerKernelTest.php b/tests/Integration/Persistence/PrivateEntityManagerKernelTest.php index 6513857..dcfdd68 100644 --- a/tests/Integration/Persistence/PrivateEntityManagerKernelTest.php +++ b/tests/Integration/Persistence/PrivateEntityManagerKernelTest.php @@ -7,11 +7,13 @@ use Doctrine\DBAL\Connection; use Doctrine\Persistence\ManagerRegistry; use LogicException; +use Nowo\StorageKitBundle\Audit\StorageAuditEvent; use Nowo\StorageKitBundle\DependencyInjection\Compiler\StoragePrivateEntityManagerPass; use Nowo\StorageKitBundle\Doctrine\StorageEntityManager; use Nowo\StorageKitBundle\Entity\StorageProfile; use Nowo\StorageKitBundle\Entity\StorageSync; use Nowo\StorageKitBundle\Entity\StoredFile; +use Nowo\StorageKitBundle\Storage\StorageProvider; use Nowo\StorageKitBundle\Sync\StorageMove; use Nowo\StorageKitBundle\Sync\StorageSyncer; use Nowo\StorageKitBundle\Tests\Fixtures\Entity\Note; @@ -221,6 +223,59 @@ public function testABundleEntityLoadedByYourManagerIsLoadedAgainByTheBundle(): self::assertTrue($host->contains($hostActive)); } + /** + * 2.0.1 (YH-1): `saveTarget()` without `$configure` saves the connection set on the target it is given, also when + * the bundle loads that target again (yours, or one of its own loaded before the private manager was dropped). + */ + public function testSavingATargetWithoutConfigureKeepsTheConnectionSetOnIt(): void + { + $kernel = $this->bootRelations(); + $target = $this->profile($kernel, 'acme', 'old-bucket', StorageProfile::STATE_TARGET); + $id = (int) $target->getId(); + $this->clearManagers($kernel); + $host = $this->entityManager($kernel); + $connection = $host->getConnection(); + $move = $this->service($kernel, StorageMove::class); + + // Your instance, a new bucket and a new secret set on it: both saved; your manager is not flushed. + $hostTarget = $host->find(StorageProfile::class, $id); + self::assertInstanceOf(StorageProfile::class, $hostTarget); + $hostTarget->configure(StorageProvider::AWS_S3, false, null, 'https://cdn.example.test', 'eu-west-1', 'new-bucket', 'files/', 'new-key', 'new-secret-not-real', false); + self::assertTrue($move->saveTarget($hostTarget, null, ['provider', 'bucket', 'secret'])); + $row = $connection->fetchAssociative('SELECT provider, enabled, endpoint, public_endpoint, region, bucket, prefix, access_key, secret, path_style FROM storage_kit_profile WHERE id = ?', [$id]); + self::assertIsArray($row); + self::assertSame([StorageProvider::AWS_S3, null, 'https://cdn.example.test', 'eu-west-1', 'new-bucket', 'files', 'new-key'], [$row['provider'], $row['endpoint'], $row['public_endpoint'], $row['region'], $row['bucket'], $row['prefix'], $row['access_key']]); + self::assertSame([false, false], [(bool) $row['enabled'], (bool) $row['path_style']]); + self::assertNotSame('new-secret-not-real', $row['secret'], 'the secret is stored encrypted'); + self::assertSame('new-secret-not-real', $this->reloaded($kernel, $id)->getSecret()); + self::assertTrue($host->contains($hostTarget), 'yours stays in your manager'); + self::assertSame(1, (int) $connection->fetchOne('SELECT COUNT(*) FROM storage_kit_profile'), 'no duplicate row'); + self::assertContains(StorageAuditEvent::MOVE_TARGET_SAVED, $this->audit($kernel)->actions()); + + // No new secret: the stored one is kept (never written again, never encrypted twice). + $this->clearManagers($kernel); + $hostTarget = $host->find(StorageProfile::class, $id); + self::assertInstanceOf(StorageProfile::class, $hostTarget); + $hostTarget->configure(StorageProvider::AWS_S3, false, null, null, 'eu-west-1', 'third-bucket', '', 'new-key', null, false); + self::assertTrue($move->saveTarget($hostTarget, null, ['bucket', 'public_endpoint'])); + $saved = $this->reloaded($kernel, $id); + self::assertSame(['third-bucket', null, 'new-secret-not-real'], [$saved->getBucket(), $saved->getPublicEndpoint(), $saved->getSecret()]); + + // An uninitialised proxy of yours, nothing changed: the row stays as it is. + $this->clearManagers($kernel); + self::assertTrue($move->saveTarget($host->getReference(StorageProfile::class, $id) ?? self::fail('reference'), null, [])); + $saved = $this->reloaded($kernel, $id); + self::assertSame(['third-bucket', 'new-key', 'new-secret-not-real'], [$saved->getBucket(), $saved->getAccessKey(), $saved->getSecret()]); + + // Worker mode: the bundle's own instance, loaded before a unit-of-work boundary dropped the private manager. + $own = $saved; + $this->clearManagers($kernel); + $own->configure(StorageProvider::AWS_S3, false, null, null, 'eu-west-1', 'fourth-bucket', '', 'new-key', null, false); + self::assertTrue($move->saveTarget($own, null, ['bucket'])); + self::assertSame('fourth-bucket', $connection->fetchOne('SELECT bucket FROM storage_kit_profile WHERE id = ?', [$id])); + self::assertSame('new-secret-not-real', $this->reloaded($kernel, $id)->getSecret()); + } + public function testARowThatIsGoneFailsClearly(): void { $kernel = $this->bootRelations(); @@ -298,6 +353,19 @@ public function testAKeptAliveKernelDropsThePrivateManagerAtEveryRequestBoundary self::assertLessThan(2 * 1024 * 1024, memory_get_usage() - $baseline, 'no per-request growth'); } + /** + * The row of `$id` as the bundle's manager loads it now (its identity map cleared first). + */ + private function reloaded(StorageKitTestKernel $kernel, int $id): StorageProfile + { + $manager = $this->bundleManager($kernel); + $manager->clear(); + $profile = $manager->find(StorageProfile::class, $id); + self::assertInstanceOf(StorageProfile::class, $profile); + + return $profile; + } + /** * A kernel whose application entities include one related to a bundle entity (`Product::$image`). */ From 4e7fd3adba634045d7f415ab9ac5714faa17120c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Franco?= Date: Sun, 22 Nov 2026 05:58:29 +0100 Subject: [PATCH 2/2] chore: drop the coverage text report committed by mistake --- coverage-text.txt | 226 ---------------------------------------------- 1 file changed, 226 deletions(-) delete mode 100644 coverage-text.txt diff --git a/coverage-text.txt b/coverage-text.txt deleted file mode 100644 index 146a33b..0000000 --- a/coverage-text.txt +++ /dev/null @@ -1,226 +0,0 @@ - - -Code Coverage Report: - 2026-11-22 04:52:54 - - Summary: - Classes: 100.00% (108/108) - Methods: 100.00% (673/673) - Lines: 100.00% (4606/4606) - -Nowo\StorageKitBundle\Audit\AuditRecorder - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 4/ 4) -Nowo\StorageKitBundle\Audit\StorageAuditEvent - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) -Nowo\StorageKitBundle\Command\AdoptInstanceBucketCommand - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 42/ 42) -Nowo\StorageKitBundle\Command\BackfillUploaderKeysCommand - Methods: 100.00% ( 7/ 7) Lines: 100.00% (129/129) -Nowo\StorageKitBundle\Command\ForgetRetiredProfilesCommand - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 21/ 21) -Nowo\StorageKitBundle\Command\PurgeFilesCommand - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 17/ 17) -Nowo\StorageKitBundle\Command\StorageSyncCommand - Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 42/ 42) -Nowo\StorageKitBundle\Concurrency\StorageConflicts - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 11/ 11) -Nowo\StorageKitBundle\Context\FileContextTarget - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 3/ 3) -Nowo\StorageKitBundle\Context\FileContexts - Methods: 100.00% ( 7/ 7) Lines: 100.00% ( 29/ 29) -Nowo\StorageKitBundle\Controller\FileDownloadController - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 8/ 8) -Nowo\StorageKitBundle\Controller\FileUploadController - Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 46/ 46) -Nowo\StorageKitBundle\Controller\StorageMoveController - Methods: 100.00% (19/19) Lines: 100.00% (137/137) -Nowo\StorageKitBundle\Controller\StorageSettingsController - Methods: 100.00% (17/17) Lines: 100.00% (119/119) -Nowo\StorageKitBundle\DependencyInjection\Compiler\CsrfProtectionPass - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 10/ 10) -Nowo\StorageKitBundle\DependencyInjection\Compiler\DebugOnlySwitchesPass - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 6/ 6) -Nowo\StorageKitBundle\DependencyInjection\Compiler\FileDeliveryPortsPass - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 19/ 19) -Nowo\StorageKitBundle\DependencyInjection\Compiler\InstanceSettingsPass - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 4/ 4) -Nowo\StorageKitBundle\DependencyInjection\Compiler\MessengerIntegrationPass - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 2/ 2) -Nowo\StorageKitBundle\DependencyInjection\Compiler\StorageEntityManagerPass - Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 51/ 51) -Nowo\StorageKitBundle\DependencyInjection\Compiler\StorageKitCommitTrackingPass - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 28/ 28) -Nowo\StorageKitBundle\DependencyInjection\Compiler\StoragePrivateEntityManagerPass - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 26/ 26) -Nowo\StorageKitBundle\DependencyInjection\Compiler\TwigPathsPass - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 16/ 16) -Nowo\StorageKitBundle\DependencyInjection\Configuration - Methods: 100.00% ( 9/ 9) Lines: 100.00% (439/439) -Nowo\StorageKitBundle\DependencyInjection\NowoStorageKitExtension - Methods: 100.00% (19/19) Lines: 100.00% (509/509) -Nowo\StorageKitBundle\Doctrine\ExcludedEntityNamespaceDriver - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 3/ 3) -Nowo\StorageKitBundle\Doctrine\OwnEntityManagerSubscriber - Methods: 100.00% (19/19) Lines: 100.00% ( 36/ 36) -Nowo\StorageKitBundle\Doctrine\OwnerLock - Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 34/ 34) -Nowo\StorageKitBundle\Doctrine\StorageEntityManager - Methods: 100.00% (21/21) Lines: 100.00% (189/189) -Nowo\StorageKitBundle\Doctrine\TablePrefixListener - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 15/ 15) -Nowo\StorageKitBundle\Doctrine\UploaderCollationListener - Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 52/ 52) -Nowo\StorageKitBundle\Download\DeliverableFile - Methods: 100.00% ( 8/ 8) Lines: 100.00% ( 12/ 12) -Nowo\StorageKitBundle\Download\DeliverableFileData - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 4/ 4) -Nowo\StorageKitBundle\Download\FileDelivery - Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 37/ 37) -Nowo\StorageKitBundle\Download\FileDeliveryResponder - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 13/ 13) -Nowo\StorageKitBundle\Download\FileUrls - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 3/ 3) -Nowo\StorageKitBundle\Download\StoredImage - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) -Nowo\StorageKitBundle\Download\StoredImageResolver - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 17/ 17) -Nowo\StorageKitBundle\Entity\StorageProfile - Methods: 100.00% (36/36) Lines: 100.00% ( 86/ 86) -Nowo\StorageKitBundle\Entity\StorageSync - Methods: 100.00% (27/27) Lines: 100.00% ( 47/ 47) -Nowo\StorageKitBundle\Entity\StoredFile - Methods: 100.00% (30/30) Lines: 100.00% ( 38/ 38) -Nowo\StorageKitBundle\Entity\StoredFileReference - Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 6/ 6) -Nowo\StorageKitBundle\EventListener\InstanceSettingsListener - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 14/ 14) -Nowo\StorageKitBundle\EventListener\RequestBoundaryListener - Methods: 100.00% (16/16) Lines: 100.00% ( 21/ 21) -Nowo\StorageKitBundle\EventListener\StorageKitAccessListener - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 13/ 13) -Nowo\StorageKitBundle\EventListener\StorageKitConflictListener - Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 29/ 29) -Nowo\StorageKitBundle\EventListener\UnitOfWorkFrames - Methods: 100.00% (30/30) Lines: 100.00% (129/129) -Nowo\StorageKitBundle\Form\AwsAccessKeyCsv - Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 30/ 30) -Nowo\StorageKitBundle\Form\AwsAccessKeyCsvException - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) -Nowo\StorageKitBundle\Form\AwsCsvImport - Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 49/ 49) -Nowo\StorageKitBundle\Form\Extension\StorageSettingsSectionTypeExtension - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 4/ 4) -Nowo\StorageKitBundle\Form\ProfileConstraints - Methods: 100.00% ( 8/ 8) Lines: 100.00% ( 27/ 27) -Nowo\StorageKitBundle\Form\StorageProfileType - Methods: 100.00% ( 4/ 4) Lines: 100.00% (123/123) -Nowo\StorageKitBundle\Http\StorageCspSources - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 9/ 9) -Nowo\StorageKitBundle\Identifier\ExactIdentifier - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 9/ 9) -Nowo\StorageKitBundle\Integration\HttpHardening\StorageCspSourceProvider - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 3/ 3) -Nowo\StorageKitBundle\Lifecycle\FilePurger - Methods: 100.00% ( 9/ 9) Lines: 100.00% (137/137) -Nowo\StorageKitBundle\Lifecycle\FileRemover - Methods: 100.00% ( 8/ 8) Lines: 100.00% ( 63/ 63) -Nowo\StorageKitBundle\Lifecycle\RemovedFile - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) -Nowo\StorageKitBundle\MessageHandler\RunStorageSyncHandler - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 6/ 6) -Nowo\StorageKitBundle\Message\RunStorageSyncMessage - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) -Nowo\StorageKitBundle\NowoStorageKitBundle - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 14/ 14) -Nowo\StorageKitBundle\PersonalData\StoredFilesPersonalData - Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 49/ 49) -Nowo\StorageKitBundle\PersonalData\UploaderIdentity - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 4/ 4) -Nowo\StorageKitBundle\PersonalData\UserIdUploaderKeyResolver - Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 29/ 29) -Nowo\StorageKitBundle\Profile\ConfigProfiles - Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 23/ 23) -Nowo\StorageKitBundle\Profile\StorageProfiles - Methods: 100.00% (16/16) Lines: 100.00% ( 62/ 62) -Nowo\StorageKitBundle\Reference\ExistingIds - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 10/ 10) -Nowo\StorageKitBundle\Reference\FileReferenceListener - Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 29/ 29) -Nowo\StorageKitBundle\Reference\FileReferences - Methods: 100.00% ( 6/ 6) Lines: 100.00% (100/100) -Nowo\StorageKitBundle\Reference\FileUris - Methods: 100.00% ( 7/ 7) Lines: 100.00% ( 17/ 17) -Nowo\StorageKitBundle\Repository\StorageProfileRepository - Methods: 100.00% (15/15) Lines: 100.00% ( 77/ 77) -Nowo\StorageKitBundle\Repository\StorageSyncRepository - Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 8/ 8) -Nowo\StorageKitBundle\Repository\StoredFileRepository - Methods: 100.00% ( 9/ 9) Lines: 100.00% ( 74/ 74) -Nowo\StorageKitBundle\Routing\StorageKitRouteLoader - Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 28/ 28) -Nowo\StorageKitBundle\Scope\DenyAllScopeAccessChecker - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) -Nowo\StorageKitBundle\Scope\StorageScope - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 5/ 5) -Nowo\StorageKitBundle\Scope\TargetScopeResolver - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) -Nowo\StorageKitBundle\Security\AccessGuard - Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 15/ 15) -Nowo\StorageKitBundle\Security\AllowAllStorageAccessChecker - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1) -Nowo\StorageKitBundle\Security\EndpointGuard - Methods: 100.00% ( 9/ 9) Lines: 100.00% ( 53/ 53) -Nowo\StorageKitBundle\Security\RoleAccessChecker - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 7/ 7) -Nowo\StorageKitBundle\Settings\InstanceStorageSettings - Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 49/ 49) -Nowo\StorageKitBundle\Settings\StorageSettingsSection - Methods: 100.00% ( 8/ 8) Lines: 100.00% ( 49/ 49) -Nowo\StorageKitBundle\Storage\AsyncAwsUrlPresigner - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 8/ 8) -Nowo\StorageKitBundle\Storage\ErrorScrubber - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 13/ 13) -Nowo\StorageKitBundle\Storage\FileStorage - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 3/ 3) -Nowo\StorageKitBundle\Storage\PrivateVisibilityConverter - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 3/ 3) -Nowo\StorageKitBundle\Storage\S3Settings - Methods: 100.00% (15/15) Lines: 100.00% ( 93/ 93) -Nowo\StorageKitBundle\Storage\S3StorageConnectionFactory - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 17/ 17) -Nowo\StorageKitBundle\Storage\StorageConnection - Methods: 100.00% ( 9/ 9) Lines: 100.00% ( 30/ 30) -Nowo\StorageKitBundle\Storage\StorageProbe - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 30/ 30) -Nowo\StorageKitBundle\Storage\StorageProbeResult - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 3/ 3) -Nowo\StorageKitBundle\Storage\StorageProvider - Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 7/ 7) -Nowo\StorageKitBundle\Sync\StorageMove - Methods: 100.00% (13/13) Lines: 100.00% (127/127) -Nowo\StorageKitBundle\Sync\StorageSyncer - Methods: 100.00% (14/14) Lines: 100.00% (139/139) -Nowo\StorageKitBundle\Twig\StorageKitTwigExtension - Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 9/ 9) -Nowo\StorageKitBundle\Ui\AdminPages - Methods: 100.00% (11/11) Lines: 100.00% (113/113) -Nowo\StorageKitBundle\Ui\Bytes - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 6/ 6) -Nowo\StorageKitBundle\Ui\ProfileTester - Methods: 100.00% ( 3/ 3) Lines: 100.00% ( 22/ 22) -Nowo\StorageKitBundle\Ui\StorageKitPages - Methods: 100.00% ( 4/ 4) Lines: 100.00% ( 5/ 5) -Nowo\StorageKitBundle\Upload\ImageProcessor - Methods: 100.00% (12/12) Lines: 100.00% (107/107) -Nowo\StorageKitBundle\Upload\ImageUploader - Methods: 100.00% ( 9/ 9) Lines: 100.00% ( 68/ 68) -Nowo\StorageKitBundle\Upload\ProcessedImage - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 5/ 5) -Nowo\StorageKitBundle\Upload\SquareImageProcessor - Methods: 100.00% ( 9/ 9) Lines: 100.00% ( 55/ 55) -Nowo\StorageKitBundle\Upload\StoredFileView - Methods: 100.00% ( 2/ 2) Lines: 100.00% ( 21/ 21) -Nowo\StorageKitBundle\Upload\UploadEndpoint - Methods: 100.00% ( 5/ 5) Lines: 100.00% ( 35/ 35) -Nowo\StorageKitBundle\Upload\UploadRefused - Methods: 100.00% ( 1/ 1) Lines: 100.00% ( 1/ 1)