Skip to content

test: kill escaped mutants - #55

Merged
roxblnfk merged 5 commits into
1.xfrom
test/kill-mutants
Nov 20, 2026
Merged

roxblnfk merged 5 commits into
1.xfrom
test/kill-mutants

Conversation

@roxblnfk

Copy link
Copy Markdown
Member

What was changed

  • Schema tests for CreatedAt, SoftDelete, UpdatedAt and OptimisticLock: listener arguments in the compiled schema, column nullability, fields added without a column name, the lock rule picked from the column type (and the error for an unsupported type), and a compile stopped after GenerateModifiers to check what compute() does on its own.
  • Listener tests: format of the random-string and microtime lock values, a manual lock without a version on update, the UpdatedAt value on create.
  • ListenerProvider (attribute and getEventsList() listeners together, QueueCommand on delete, invalid definitions, malformed event lists), Dispatcher propagation stop, withRole() immutability, RegistryModifier column-name and default-typecast-handler checks.
  • Mutation gate raised from 75% to 97% (composer infect:ci).

Why?

Raise the mutation score: Linux MSI 78% → 99% (escaped 49 → 2).

Review notes

  • Ignored in infection.json as equivalent: Spaceship in Listener\OptimisticLock::lock() (the result is only compared with !== 0) and CastInt in Listener\OptimisticLock::getLockingValue() (the increment rule only gets integers from an integer, typecast column).
  • Left escaped: the assert() in ListenerProvider::resolveListeners() (an invalid definition fails either way, only the error type changes, and only with assertions on), and $event->state->setStatus(Node::SCHEDULED_DELETE) in Listener\SoftDelete. That line is dead with the current ORM: with or without it, a soft-deleted entity stays in the heap as MANAGED, although the comment says it should be removed.
  • Possible bug, not fixed here: when several OptimisticLock listeners are registered for one role, the first wraps the update command into WrappedStoreCommand, which is not a ScopeCarrierInterface, so the following locks skip the update. The attribute is not repeatable, but a hand-written schema can list several; the new manual-version test uses a schema with that lock alone.

Checklist

  • Tested
    • Unit and SQLite suites pass locally
    • Infection on Linux (PHP 8.4, Xdebug): 259/261 killed

…schema behaviors

Render repeats what compute does, so the full compile hid compute mutants; a compile stopped after GenerateModifiers shows them. Listener arguments, column nullability, the version rule taken from the column type and fields added without a column name were not asserted at all.

Assisted-By: Claude Opus 5.5 <[email protected]>
The new manual-version test uses a schema with that lock alone: once one OptimisticLock listener wraps the update command, the following ones see a command without a scope and skip it.

Assisted-By: Claude Opus 5.5 <[email protected]>
Two OptimisticLock listener mutants are ignored as equivalent: the version comparison only checks for inequality, so swapping the spaceship operands changes nothing, and the increment rule always receives an integer from the typecast column.

Assisted-By: Claude Opus 5.5 <[email protected]>
@roxblnfk
roxblnfk requested a review from a team November 20, 2026 17:08
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