Define PDO coordinated operation contracts - #22
Merged
Merged
Conversation
…s/phpnomad-coordination-architecture/mysql-driver-failures into codex/pdo-coordinated-operations
alexstandiford
changed the base branch from
codex/pdo-query-failure-contract
to
main
September 20, 2026 13:41
alexstandiford
force-pushed
the
codex/pdo-coordinated-operations
branch
from
September 20, 2026 22:57
2b62534 to
3b9f351
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Add optional coordinated operations to the MySQL PDO backend. Siren can reach this capability through the storage-neutral datastore contract and PHPNomad handler bridge. Siren Core receives no SQL or database object.
This PR targets
main. Its shared database contracts resolve from the mergedrelease/2.2branch at17fb84703d260a66de874704ae37cf924b9d8c2b.Coordination contract
PdoCoordinatedDatabaseStrategyowns one attempt on its injected connection. It validates the session and every participant, guards the existing coordination record, invokes the callback once, and classifies commit, conflict, cleanup, or uncertain outcomes without replay.Participant descriptors provide names only. Admission does not invoke descriptor identity callbacks. Each participant name is captured once. Primary-key identity comes from live storage metadata, and the coordination key is read before the transaction and rechecked after the record guard inside the transaction. A metadata change between those reads is refused before the callback.
The supported profile requires MySQL 8, stable InnoDB base tables, supported session settings, complete primary keys, and direct trigger visibility. MySQL 5.7 is not supported for coordination. It is explicitly classified and refused before the transaction and callback because the required role and session metadata is unavailable there.
Supplied queries and internal coordination statements check transaction ownership. An inactive driver failure is retryable only when the adapter observed that exact failure during the current owned attempt. Error numbers alone do not prove rollback.
Failure reporting
The adapter constructs the final classified operation failure before reporting it. If the logger throws an
ExceptionorError,CoordinatedOperationReportingFailedExceptionretains both the exact operation failure and the exact reporting failure. Reporting is attempted once. It is not retried, and successful coordination does not touch the failure logger.The contract covers validation refusal, confirmed callback rollback, confirmed conflict, commit uncertainty, cleanup failure, transaction ownership loss, and logger failures before and after a recorded entry. Tests assert callback count, persisted outcome, transaction state, reporting count, and retained exception identity.
Architecture and audit context:
Verification
composer validate --strict.libandtests.325 tests, 3214 assertionsusing--exclude-group mysql57 --fail-on-incomplete --fail-on-skipped.2 tests, 20 assertionsusing--group mysql57 --fail-on-incomplete --fail-on-skipped.getName()exactly once andgetFieldsForIdentity()never.The two pre-existing PHPStan findings were resolved narrowly. The late-static
fromPdo()factory keeps its consumer-compatible API with a line-level analyzer exception. The placeholder parser now has a defensive default refusal for an unreachable token.This remains a draft. This PR performs no merge, release, tag, deployment, or consumer wiring.