Skip to content

fix: saveTarget() null configure + 2.0 doc sweep (2.0.1, audit YH-1/YH-2) - #40

Merged
HecFranco merged 2 commits into
mainfrom
fix/storagekit-201
Nov 22, 2026
Merged

HecFranco merged 2 commits into
mainfrom
fix/storagekit-201

Conversation

@HecFranco

Copy link
Copy Markdown
Contributor

StorageKit 2.0.1: the two follow-ups of the pre-tag audit YH of 2.0.0. Patch, no BC break. Squash merge recommended (the second commit only removes a coverage report committed by mistake).

YH-1: saveTarget() with a null $configure

Sync\StorageMove::saveTarget($target, $actor, $fields) without the fourth argument saved nothing for a saved target that the bundle loads again through its own manager (2.0 StorageEntityManager::adopt()):

  • a target your manager loaded ($em->find() or getReference()), or
  • one the bundle loaded before a unit-of-work boundary dropped the private manager (FrankenPHP worker mode, kernel reset off).

adopt() swapped in a fresh copy of the stored row, so the connection the caller set on the target was discarded. The call still returned true and audited move_target_saved.

Fix: when $configure is null and adopt() returned another instance, the connection set on the target you passed is applied to the bundle's instance inside the same write unit, under the owner lock. That covers provider, enabled, endpoints, region, bucket, prefix, access key, path style, and the secret only when a new one was set. Without a new secret the stored one is kept, so it is never encrypted twice.

Not affected: the Move page (it always passes $configure), a new unsaved target, and a target already managed by the bundle.

Test: PrivateEntityManagerKernelTest::testSavingATargetWithoutConfigureKeepsTheConnectionSetOnIt covers four cases: a host instance with a new secret, a host instance with no new secret, an uninitialised host proxy, and a worker-mode bundle instance. It fails on 2.0.0 (the row is unchanged) and passes with the fix on SQLite, MySQL 8.4 and PostgreSQL 16.

YH-2: stale docs

  • USAGE: removed ImageUploader::upload() (upload section and the endpoint's PHP API); entities "on your default entity manager".
  • CONFIGURATION: "the admin pages and console commands do flush it" (1.x) now says they flush only the private manager; "fixed in Unreleased" now says 1.5.2.
  • README: lists nowo-tech/transaction-doctrine ^1.9.1.
  • FileDeliveryPortsPass docblock: the FileDelivery id is not deprecated, and respond() is gone.
  • UPGRADING: the [Unreleased] links pointed at 2.0.0 / 1.7.1 content; duplicated "To 1.8.1" / "To 1.8.0" headings merged; 2.0.1 note added.
  • FRANKENPHP-WORKER-AUDIT: "2.0.0 (Unreleased…)" replaced with the release date.
  • Makefile test-with-db: ran the removed 1.8 host-mode suites (STORAGE_KIT_TEST_HOST_EM). It now runs the CI database files.

Gates (local, Docker)

  • Full suite: 683 tests OK (11 skipped, DB-only on SQLite); coverage 100% statements and elements (4606/4606, 5279/5279).
  • PHPStan, php-cs-fixer, Igor (125/125 stateless), rector dry-run, validate-phpdoc: clean.
  • DB files of the CI "Lifecycle on …" jobs on MySQL 8.4 and PostgreSQL 16: all OK.

REQ-RUNTIME-003: same unit and owner lock as before; the closure is local to the call (worker-safe, no service state).

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

@coderabbitai review

@HecFranco
HecFranco merged commit b407058 into main Nov 22, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant