Skip to content

test: implement indexer_runner transaction isolation validation (#185) - #382

Closed
Davoski1 wants to merge 1 commit into
Goldii-locks:mainfrom
Davoski1:fix-indexer-runner-transaction-isolation
Closed

test: implement indexer_runner transaction isolation validation (#185)#382
Davoski1 wants to merge 1 commit into
Goldii-locks:mainfrom
Davoski1:fix-indexer-runner-transaction-isolation

Conversation

@Davoski1

Copy link
Copy Markdown
Contributor

Description

Closes #185

This PR addresses the requirement to ensure that indexer_runner operations run inside SQLite transaction blocks to protect data consistency under load.

During investigation, we confirmed that the primary write path for the main indexer event poller execution loop (insertEventBatch called from pollEvents) is already safely wrapped in a strict synchronous db.transaction() block provided by better-sqlite3.

To fulfill the issue's validation and testing requirements, this PR focuses on formally proving this transactional safety by introducing explicit test coverage that asserts the rollback behavior.

Changes Included

  • Added: __tests__/indexer-runner-transaction.test.ts to validate transaction isolation during polling.
  • Validation: Added a specific test case that simulates a constraint/execution failure mid-transaction and asserts that the last_ledger_sequence pointer does not advance (i.e., verifying that partial database updates rollback fully on execution failures).

Testing & Verification

  • Confirmed database updates rollback fully on execution failures via the new test suite.
  • Verified that all existing project tests continue to compile and pass successfully.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@Davoski1 Davoski1 closed this Aug 29, 2026
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.

Implement database transaction isolation in indexer_runner

1 participant