Skip to content

fix(core): Fix v2 finalization rollback on duplicate tx - #385

Merged
raymondjacobson merged 2 commits into
mainfrom
codex/fix-v2-finalize-savepoint
Jul 27, 2026
Merged

fix(core): Fix v2 finalization rollback on duplicate tx#385
raymondjacobson merged 2 commits into
mainfrom
codex/fix-v2-finalize-savepoint

Conversation

@raymondjacobson

Copy link
Copy Markdown
Contributor

Summary

  • add a regression for an accepted block containing the same v2 ERN transaction twice
  • isolate v2 transaction finalization in a nested pg savepoint so a tx-level finalization error rolls back only that tx side effect work
  • preserve the existing behavior where the duplicate tx returns Code=2, but the block transaction can still commit

Test plan

  • TEST_DB_URL=postgres://localhost:55438/openaudio_test?host=/tmp/openaudio-hunt4-pg.pYbDYu go test ./pkg/core/server -run=TestFinalizeBlockDuplicateV2ERNTransactionDoesNotPoisonCommit -count=1 -v
  • TEST_DB_URL=postgres://localhost:55438/openaudio_test?host=/tmp/openaudio-hunt4-pg.pYbDYu go test ./pkg/core/server -count=1

@raymondjacobson raymondjacobson changed the title Fix v2 finalization rollback on duplicate tx fix(core): Fix v2 finalization rollback on duplicate tx Jul 27, 2026
Replace the finalizeV2TransactionIsolated wrapper with a generic
withBlockSavepoint helper next to the other block-tx plumbing, so the
call site reads as what it is: run v2 finalization in a savepoint so a
failed tx can't abort the block's pg transaction. Also reusable for the
v1 finalize path later.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@raymondjacobson
raymondjacobson merged commit 16c2893 into main Jul 27, 2026
5 checks passed
@raymondjacobson
raymondjacobson deleted the codex/fix-v2-finalize-savepoint branch July 27, 2026 15:55
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