Skip to content

Keep engine callbacks and physical enqueueing on the storage boundary - #965

Merged
rmcdaniel merged 1 commit into
mainfrom
fix/893-connection-owned-callbacks
Oct 31, 2026
Merged

rmcdaniel merged 1 commit into
mainfrom
fix/893-connection-owned-callbacks

Conversation

@rmcdaniel

@rmcdaniel rmcdaniel commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Qualification of #893 found that selecting the correct connection is insufficient when two connections have open transactions. Laravel registers callbacks on the most recently opened transaction across connections. Lifecycle events and enqueue callbacks can therefore fire on the wrong commit, survive storage rollback, or disappear with an unrelated application rollback. The queue job's own afterCommit flag can also defer physical enqueueing again after workflow storage has committed.

Register engine callbacks inside a nested frame on their owning connection, using Laravel's existing transaction manager to retain outer-commit and savepoint-rollback handling. After the engine's storage boundary permits publication, enqueue task and service-call jobs without a second global deferral. Preserve tracing through deferred service-call publication. Keep existing direct job construction behavior.

Validation so far:

  • Merged bf1f214f: ten new controls fail with 46 assertions and no errors. Eight cover both connection modes and both commit/rollback orders; two inspect real database queue rows.
  • Fixed PostgreSQL 17: all 22 storage cases pass, 156 assertions.
  • Fixed MySQL 8: all 22 storage cases pass, 156 assertions.
  • Hosted corpus policy passes with the appended interleaved-storage fixture. This callback-only diff matches no automatic replay guard, so the hosted output reports zero counterfactual cases. Explicit execution of the registered official consumer now verifies one fixture: original without it passes, original with it fails, and fixed with it passes.

Delivered in Core 2.15.9, protected merge 84000d4e, exact reviewed tree 690992d6aaa7fa435aff7c6e9552b21a84091cd5. All 30 main checks and all 17 published verification jobs pass. The complete local quality cycle passes: unit 5,279 / 74,821 (45 skips, 15 notices), coverage gate 77.60%, PostgreSQL feature 2,551 / 25,150 (18 skips), full style and static analysis.

Fresh stock Composer acceptance matches all 1,007 runtime files and eight class origins, passes 22 / 156 on each of PostgreSQL and MySQL, and passes four independent-app-rollback probes. Explicit registered-consumer proof verifies one before/after fixture; the hosted policy alone matched no replay guard.

Docs #416 is deployed and the guide is verified live in all eight locales.

Refs #893; follows #964.

@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel
rmcdaniel marked this pull request as ready for review October 31, 2026 02:17
@rmcdaniel
rmcdaniel merged commit 84000d4 into main Oct 31, 2026
23 checks passed
@rmcdaniel

Copy link
Copy Markdown
Member Author

The explicit registered-consumer counterfactual now passes for separate-storage-interleaved-callbacks.json:

  • Original bf1f214f binding with the current consumer and no new fixture: pass.
  • Original binding with the new fixture: fail.
  • Fixed 1b302601 binding with the new fixture: pass.

This invokes the existing policy validator's registered consumer and counterfactual implementation, selecting the replay evidence explicitly. It verifies one fixture. The hosted policy run passed but reported zero automatic counterfactual cases because the callback-only diff matched no replay guard; the earlier description of that hosted result was too broad and has been corrected.

Protected merge 84000d4e2c606ca050e6ef86073ccf5b390101de has exactly the reviewed source tree 690992d6aaa7fa435aff7c6e9552b21a84091cd5. Full qualification is continuing on this source, and 2.15.9 is still unpublished.

@rmcdaniel
rmcdaniel deleted the fix/893-connection-owned-callbacks branch October 31, 2026 03:20
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