fix(orphan): bound timed-out renewal PostgreSQL lifetime - #35
Merged
Conversation
This was referenced Aug 17, 2026
bipolarrr
marked this pull request as ready for review
August 17, 2026 12:22
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.
Summary
statement_timeout=45sand rollback-before-release semanticsCloses #34.
Root cause and reproduction
PR #33's
Promise.race()bounded the reaper caller at 60 seconds but did not cancel the underlying Prisma/PostgreSQL query.Using the production repository path with PostgreSQL 16 and a separate transaction holding
OBJECT_REFERENCE_CLAIM_LOCK_IDreproduced both failure modes:pg_stat_activitystill showed the renewal asactive / Lock / advisory{ count: 1 }and increasedclaim_untilby 60,384msImplementation
renewActiveClaim()now runs in a Prisma interactive transaction pinned to one connection:The original SQL still requires
DELETE_CLAIMED, the current token, andclaim_until > clock_timestamp(). PostgreSQL timeout rejection remains distinct from{ count: 0 }ownership loss. Service heartbeat/pre-delete callers still share one physical renewal flight, and failed/aborted renewal cannot authorize LIST/DELETE work.Resource bounds and scope
The 45-second hard bound applies after the transaction-local settings reach a normally communicating PostgreSQL server. Prisma transaction timing is not active-query cancellation, and this change does not claim a hard client pool-slot bound for a network blackhole during
BEGIN, timeout setup,COMMIT, orROLLBACKtransport.PostgreSQL regression
The new
test:integration:orphan-renewal-timeoutsuite is registered in the repository integration orchestrator and verifies:claim_untilupdateidle in transactionor aborted transaction remains{ count: 0 }without mutationValidation
git diff --check— passedIndependent review
A fresh adversarial reviewer found and drove fixes for CI registration and overbroad resource-bound wording, then returned
ACCEPT. A different fresh verifier independently reproduced the original PostgreSQL waiter/late UPDATE, reran production-path and full validation, and returnedAPPROVE. There are no unresolved Critical/High/Medium findings.