Skip to content

fix(postgres): preserve uncertain transaction outcomes through cleanup - #137

Merged
kevinlin-openai merged 5 commits into
mainfrom
codex/work-4f093aba450a3d088a059fa7
Sep 14, 2026
Merged

kevinlin-openai merged 5 commits into
mainfrom
codex/work-4f093aba450a3d088a059fa7

Conversation

@freeqaz-openai

@freeqaz-openai freeqaz-openai commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A PostgreSQL connection can fail after the server commits a resource mutation but before the client receives its acknowledgment. Reporting that failure as definite rollback can trigger unsafe Driver compensation. Cleanup errors can also hide the original transaction failure.

Update the existing PostgreSQL transaction owner to preserve the outcome through connection release:

  • Require an exact COMMIT acknowledgment; an acknowledged ROLLBACK remains a known failure.
  • Treat ambiguous or unclassified SQLSTATEs as possibly committed, while retaining the specific server rejection classes that establish no commit.
  • Retain transport errors until release, discard failed connections, and preserve the original callback error when rollback or cleanup also fails.
  • Report cleanup failure after acknowledged commit as PostgresCommitOutcomeUnknownError, which the existing controller already uses to suppress unsafe compensation.

This change is based directly on main and applies to the state owner already used by the production controller and worker. Extend the existing shared rollback contract to compare the original Error identity while retaining resource, audit, and queued-work absence checks. Register the focused outcome suites and document the readback requirement in the PostgreSQL testing guide.

Validation

  • 11 protocol cases passed, covering acknowledgment, SQLSTATE classification, cleanup, and effective connection routing.
  • Both real COMMIT-response faults passed against fresh PostgreSQL 16.15 databases (three reported tests including their parent). The TCP proxy drops the actual server acknowledgment; independent readback proves the resource committed and a subsequent read proves the pool remains usable.
  • All five existing PostgreSQL platform cases passed, including shared rollback and controller/worker behavior.
  • Regression control: the exact pre-fix main owner fails six protocol cases and both real faults. Restoring the fix returns the identical tested source.
  • Type checking, workspace checks, full formatting, CI suite-map audit, documentation length, and all 17 documentation tests passed. All selected product tests ran without skips.

Local PostgreSQL 16.15 evidence does not establish the PostgreSQL 18.6 CI result; the new main-based candidate needs its own required CI run.

@freeqaz-openai
freeqaz-openai marked this pull request as ready for review September 12, 2026 00:39
@freeqaz-openai
freeqaz-openai requested a review from a team as a code owner September 12, 2026 00:39
@freeqaz-openai
freeqaz-openai force-pushed the codex/work-8ac03db200ba1d850e6a5f56 branch from d07d6c4 to f6b0c22 Compare September 13, 2026 00:06
@freeqaz-openai
freeqaz-openai force-pushed the codex/work-4f093aba450a3d088a059fa7 branch from 9062ac9 to 4991689 Compare September 13, 2026 00:06
@freeqaz-openai freeqaz-openai changed the title Preserve PostgreSQL transaction outcomes across connection failures Preserve exact PostgreSQL transaction outcomes Sep 13, 2026
@freeqaz-openai
freeqaz-openai removed this pull request from stack #142 September 13, 2026 21:52
kevinslin
kevinslin previously approved these changes Sep 14, 2026
@freeqaz-openai
freeqaz-openai force-pushed the codex/work-8ac03db200ba1d850e6a5f56 branch from f6b0c22 to cb22ec7 Compare September 14, 2026 07:49
@freeqaz-openai
freeqaz-openai force-pushed the codex/work-4f093aba450a3d088a059fa7 branch 2 times, most recently from 89146ba to 43a15c0 Compare September 14, 2026 11:12
@freeqaz-openai freeqaz-openai changed the title Preserve exact PostgreSQL transaction outcomes fix(postgres): preserve uncertain transaction outcomes through cleanup Sep 14, 2026
@freeqaz-openai
freeqaz-openai changed the base branch from codex/work-8ac03db200ba1d850e6a5f56 to main September 14, 2026 11:12
@freeqaz-openai
freeqaz-openai dismissed kevinslin’s stale review September 14, 2026 11:12

The base branch was changed.

@freeqaz-openai
freeqaz-openai force-pushed the codex/work-4f093aba450a3d088a059fa7 branch from 43a15c0 to 2e2084a Compare September 14, 2026 18:15
@freeqaz-openai

Copy link
Copy Markdown
Collaborator Author

oi, should have used stacked PRs. Merged the other branch into this one. Gonna wait for CI and then merge this (if GitHub permissions let me; UI still says "blocked on code owner review")

@kevinlin-openai
kevinlin-openai merged commit 95a5909 into main Sep 14, 2026
11 checks passed
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.

3 participants