From 13344cd042d3c531a15cd2e234f04226864cc99f Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 20 Nov 2026 20:56:48 +0400 Subject: [PATCH 1/3] test(transactions): run a real write in the ignore mode outside a transaction Saving and deleting the same entity in one group ran no command, so the test passed in strict mode too. Assisted-By: Claude Opus 5.5 --- tests/Acceptance/Common/ActiveRecordTest.php | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/Acceptance/Common/ActiveRecordTest.php b/tests/Acceptance/Common/ActiveRecordTest.php index ed411cf..58278bc 100644 --- a/tests/Acceptance/Common/ActiveRecordTest.php +++ b/tests/Acceptance/Common/ActiveRecordTest.php @@ -232,19 +232,19 @@ public function groupActionsInStrictModeOutsideTransactionThrows(): never #[Isolate(Isolation::None)] public function groupActionsInIgnoreModeOutsideTransactionSucceeds(): void { - // When outside a transaction, TransactionMode::Ignore (with strict: false) should work fine. - // The runner will ignore the lack of a transaction. - // If mutated to strict: true, this would throw RunnerException because there's no active transaction. - $result = ActiveRecord::groupActions(static function () use (&$created, &$deleted): string { - // Create and immediately delete an entity to generate commands without leaving side effects + # Two separate groups: saving and deleting in one group cancel out and run no command at all. + $user = ActiveRecord::groupActions(static function (): User { $user = new User('TestUser'); - $created = $user->save(); // Must succeed without transaction - $deleted = $user->delete(); // Must also succeed - return 'success'; + $user->save(); + return $user; }, TransactionMode::Ignore); - Assert::same($result, 'success'); - Assert::true($created); - Assert::true($deleted); + try { + Assert::notNull(User::query()->where('name', 'TestUser')->fetchOne()); + } finally { + ActiveRecord::groupActions(static fn(): bool => $user->delete(), TransactionMode::Ignore); + } + + Assert::null(User::query()->where('name', 'TestUser')->fetchOne()); } public function deletesMultipleEntitiesInGroupActions(): void From 0f54024dfd8d7259ab46900e330ec25bfefe544b Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 20 Nov 2026 20:56:49 +0400 Subject: [PATCH 2/3] test: cover caching of the transaction service in the Facade Assisted-By: Claude Opus 5.5 --- tests/Unit/FacadeTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/Unit/FacadeTest.php b/tests/Unit/FacadeTest.php index 3eb9043..4ada636 100644 --- a/tests/Unit/FacadeTest.php +++ b/tests/Unit/FacadeTest.php @@ -12,6 +12,8 @@ use Cycle\Testing\ORM\Memory; use Cycle\Tests\Unit\Stub\Container\ConfigurableContainer; use Cycle\Tests\Unit\Stub\Container\ServiceNotFoundException; +use Cycle\Transaction\Internal\TransactionImpl; +use Cycle\Transaction\Transaction; use Testo\Assert; use Testo\Codecov\Covers; use Testo\Expect; @@ -130,6 +132,20 @@ public function cachesDatabaseManagerAfterFirstCall(): void Assert::count($container->requested, 1); } + public function cachesTransactionAfterFirstCall(): void + { + $transaction = new TransactionImpl($this->buildOrm(), DatabaseMemory::manager()); + $container = ConfigurableContainer::returning(Transaction::class, $transaction); + Facade::setContainer($container); + + $first = Facade::getTransaction(); + $second = Facade::getTransaction(); + + Assert::same($first, $transaction); + Assert::same($second, $transaction); + Assert::same($container->requested, [Transaction::class]); + } + private function buildOrm(): ORMInterface { return Memory::orm(); From 0584e9beed1e24622f5eb1e5838024bad051693f Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 20 Nov 2026 20:56:50 +0400 Subject: [PATCH 3/3] ci: raise the mutation score gate Assisted-By: Claude Opus 5.5 --- infection.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/infection.json b/infection.json index 287af6a..230574a 100644 --- a/infection.json +++ b/infection.json @@ -9,8 +9,8 @@ ] }, "timeout": 10, - "minMsi": 90, - "minCoveredMsi": 90, + "minMsi": 98, + "minCoveredMsi": 98, "testFramework": "testo", "tmpDir": "runtime", "logs": {