Skip to content

Improve Horizon listener reconciliation: transactional invariants and recovery - #1602

Open
DevALVIN-24 wants to merge 1 commit into
Disciplr-Org:mainfrom
DevALVIN-24:improve-horizon-listener-reconciliation
Open

DevALVIN-24 wants to merge 1 commit into
Disciplr-Org:mainfrom
DevALVIN-24:improve-horizon-listener-reconciliation

Conversation

@DevALVIN-24

Copy link
Copy Markdown
Contributor

closes #1551

Description

Refs #Quality (Improve Horizon listener reconciliation)

This PR addresses the transactional invariants, query correctness, and pagination boundaries for the Horizon listener reconciliation engine and TransactionRepository.

Proposed Changes

src/repositories/transactionRepository.ts

  • Refactored listWithCursor and listByVault methods to build and chain Knex filters first before applying final ordering (orderBy) and limits (limit).
  • This fixes issues where applying .where after .limit resulted in calling methods on completed promises/resolved arrays (especially under mock and specific query builder environments), making database operations fully deterministic.

src/repositories/transactionRepository.test.ts

  • Updated unit test inputs for create to include required fields (vault_id, type) matching constraints enforced by validateTransactionInput to satisfy strict data invariants.

Verification Results

All tests pass successfully:

  • Horizon listener chaos and resume tests: npm run test src/tests/horizonListener.chaos.test.ts (17/17 tests passing)
  • Horizon listener configuration tests: npm run test src/tests/horizonListener.test.ts (9/9 tests passing)
  • Horizon reconciliation boundary tests: npm run test src/services/horizonReconciliation.boundary.test.ts (19/19 tests passing)
  • Horizon reconciliation policy tests: npm run test src/services/horizonReconciliation.test.ts (10/10 tests passing)
  • Transaction Repository tests: npm run test src/repositories/transactionRepository.test.ts (10/10 tests passing)

Unavoidable Limitations / Pre-existing CI Failures

There are pre-existing issues in other unrelated test suites (e.g. src/tests/adminVerifiers.test.ts due to duplicate identifier declaration, and dependency errors in oauth & auth routes). These issues pre-exist in the codebase and are out of scope for this feature branch.

@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@DevALVIN-24 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

[Quality][High] Improve Horizon listener reconciliation: transactional invariants and recovery

1 participant