Skip to content

Retry embedded application heartbeats after SQLite contention - #925

Merged
rmcdaniel merged 2 commits into
mainfrom
fix/878-embedded-progress-contention
Oct 24, 2026
Merged

rmcdaniel merged 2 commits into
mainfrom
fix/878-embedded-progress-contention

Conversation

@rmcdaniel

@rmcdaniel rmcdaniel commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

A genuine embedded application heartbeat can collide with lease maintenance, throw SQLite5 database is locked, and fail an activity that is making progress. This failed one existing control among4,816 cases in the full main coverage run40092272923. Database/upgrade jobs passed; the coverage ratchet and main Sonar were not reached.

Current head b5ad807, tree 5be44fa6c8919c61a1d5c48ce8f0c86f785034fa, based on #924 merge b7573a66. Use the existing bounded SqliteTransaction for heartbeat mutations. It retries only a failed, rolled-back root SQLite transaction, re-reading task/attempt/run/deadline authority each time. The application callback stays outside this transaction; nested/uncertain-commit protections remain.

A real second PDO connection commits a metadata write after the first heartbeat read, forcing a WAL snapshot conflict. The original runtime fails the retained test (1 case/4 assertions). Corrected source passes1/8, with one callback, four accepted progress events, one completion and no failure. The full lease/deadline/worker-loss class passes 10 tests/82 assertions on1a595b25 with an init process; that runtime is unchanged in this head. The final two-line parameterized fixture update passes the affected case again1/8. Full src/tests PHPStan passes, and final changed-file ECS passes without fixes. The initial full-class run without an init process failed its helper-exit assertion10/77; that original is retained, without changing any deadline or assertion. Fresh hosted qualification is running.

Refs #878 and #923. Draft until terminal source qualification. Core2.13.1 remains untagged/unpublished; this joins that unreleased patch. Published-package and affected downstream acceptance remain required. No retry/lease/heartbeat deadline, failure assertion, corpus guard or coverage gate is weakened.

@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel

Copy link
Copy Markdown
Member Author

Owner source review complete at b5ad807, tree 5be44fa6c8919c61a1d5c48ce8f0c86f785034fa. All 16 applicable PR checks pass / 6 intended skips on the exact head, including quality, unit contracts, MySQL, tracing, regression corpus and the aggregate. Direct PR Sonar analysis 693edc43-a75b-4af8-ac95-481a2b956d3b is OK with0 unresolved issues,0 hotspots and0 new duplication.

The existing SqliteTransaction guard retries only a proven rolled-back root SQLite mutation, before its callback returns, with bounded attempts/time and unchanged PDO; nested or uncertain-commit failures retain their exception. Heartbeat authority/deadline checks rerun inside that mutation, and application activity execution stays outside it. There is no replay/codec change or corpus-policy edit. The new test forces the real WAL snapshot conflict with a second committed PDO write and preserves one callback/four progress events/one completion. Original1/4 fails, current1/8 passes. Runtime-identical full lease/deadline/worker-loss controls10/82 and full PHPStan pass; final parameterized fixture/no-fix ECS and all2,176 source-export blobs match this head.

Normal source merge follows the repository's delegated owner review path. The original full-main run40092272923 remains failed evidence. Independent full main/coverage/Sonar, immutable2.13.1 publication and normal installed cancellation/heartbeat plus affected downstream acceptance remain required; no delivered fix is claimed yet.

@rmcdaniel
rmcdaniel marked this pull request as ready for review October 24, 2026 13:02
@rmcdaniel
rmcdaniel merged commit e08b933 into main Oct 24, 2026
22 checks passed
@rmcdaniel
rmcdaniel deleted the fix/878-embedded-progress-contention branch October 24, 2026 13:02
@rmcdaniel

Copy link
Copy Markdown
Member Author

Core 2.13.1 is normally published from b2a3369110b8cbdf060802ff91e475110e66e333, tree 1384c8f6fc8d45a02ab9afae8322131914fce5a2. The immutable GitHub tag/release, Composer product-train, and Packagist source/dist references agree. Release.

The exact source passed full main verification40101884828, including all database shards, complete coverage, five Laravel upgrades, quality, corpus and Sonar. Normal published verification40132873412 passed all17 jobs, including the package contract and16 Laravel/PHP upgrade cells.

A fresh normal Composer consumer on PHP8.3.36 / Laravel13.38.0 / Testbench11.3.0 / PHPUnit12.5.40 passed 11 tests /132 assertions, with no skips or warnings. It exercised cooperative cancellation after retry under both cancellation policies, completed-task preservation, the current attempt/task snapshot and successful+duplicate stop acknowledgement, plus all ten embedded lease-maintenance, genuine-progress, deadline and worker-loss controls. Stock Composer autoload resolved Activity, WorkflowExecutor and ActivityCancellationWait from the installed package; no product-source override was used. All 2,176 package files matched the tagged source before and after the tests. Composer reported zero security advisories.

This delivers the library repair and preserves the earlier failed main run as failed evidence. PHP Server adoption is continuing in durable-workflow/server#733, followed by the exact published-image acceptance. This issue remains open through the affected Server image; no native parity or rejected-outcome emitter acceptance is claimed.

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