Repository navigation
fix(database): Add opt-in PostgreSQL session recovery - #1
Merged
Merged
Conversation
|
Caution Review failedThe pull request is closed. Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
wilcorrea
marked this pull request as ready for review
October 29, 2026 23:08
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.
Problem and behavior
A failed Swoole PostgreSQL session can spread transport/protocol errors through the pool. Extract the connectivity fixes from QuoteGuide #318 and #320 into an explicit Serendipity opt-in module.
The nine PostgreSQL implementation classes are extracted from QuoteGuide
eb75e2ad, with a subsequent classifier correction that preserves authoritative SQL diagnostics while still recognizing native transport failures with stale diagnostics. The backend remainshyperf/dbwithSwoole\Coroutine\PostgreSQL. Failed queries, writes, BEGIN and COMMIT are never replayed. Invalid transactions cannot reconnect; failed COMMIT confirmation remains an uncertain outcome. Native Hyperf pool counters and waiters are preserved.Enable through
...PostgreSQLSessionRecovery::dependencies()in application dependency configuration. Installation alone changes no bindings; other drivers remain unchanged. Seedocs/postgresql-session-recovery.md.Restore CI on a clean install
mongoshprimary-readiness check.InputExtensionwhile clearing cached validators/scenes for objects and isolating teardown context.RepositoryException, passing an integer code to PHP's constructor; normalize HTTP headers according to the PSR string-array contract.Validation
make setuppassed with PostgreSQL 16.2 and MongoDB 6.0: migrations completed, Mongo bootstrap exited 0, all service healthchecks passed. Local overrides only isolate names, ports, network, credentials and architecture.make cipassed: 633 tests / 1,849 assertions, including PHP-CS, PHPStan, Deptrac, PHPMD, Rector and Psalm.InputExtension, andRepositoryException: 100% statements and methods. Header normalization's changed lines are covered.actionlintand Compose configuration validation passed; independent review found no blocking defects.laminas/laminas-mime,opentracing/opentracing), yielding exit 2 under its default abandonment policy; this is not reported as an entirely clean audit.sha256:c099d1929deb41dad2d56e8c2077708ad378feed78ec84188dec9a2c8ea2df99.QuoteGuide's consuming PR has already passed its full lint, 2,790 tests / 5,940 assertions, 80% per-class coverage gate, and 18 focused consumer tests on development and production images. It currently pins the extraction revision
970f21f; replace that development reference with the published library version before merging the consumer.Classifier regression correction
Ordinary server SQL errors now take precedence over transport words appearing in SQL text or diagnostic details. Native driver error prefixes, nonzero driver codes and native Swoole warnings still identify current transport failure even when an old SQLSTATE remains present.
missing_onerror_review_probeinvalidated a healthy session.broken pipe.42P01and driver code zero still replaces the physical session on the next acquisition and executes the callback exactly once.Remote CI
GitHub Actions run 40962391413 completed successfully on commit
a6aa336: clean environment setup, all linters, 633 tests / 1,849 assertions, and SonarCloud analysis passed. No release or deployment was performed.Actual lost COMMIT acknowledgement is not a tested transport scenario. This change does not identify the original production trigger. No PDO migration, Terraform, tracing/logging/readiness extraction, partner retries, release or deployment.