Skip to content

fix(reconciliation): select runs by run_at and validate tx_batch_id - #1355

Open
innocentharuna wants to merge 1 commit into
RevoraOrg:masterfrom
innocentharuna:fix/1256-reconciliation-filters
Open

innocentharuna wants to merge 1 commit into
RevoraOrg:masterfrom
innocentharuna:fix/1256-reconciliation-filters

Conversation

@innocentharuna

Copy link
Copy Markdown

Closes #1256

Replaces #1307, which I closed because it included unrelated files that shouldn't have been there.

Changes

  • reconcile and quickBalanceCheck now filter distribution runs on run_at (inclusive of both ends) instead of the non-existent distribution_date.
  • validateChainEventConsistency reads the transaction reference from tx_batch_id instead of stellar_transaction_hash. Runs without one are still reported as STELLAR_TX_NOT_FOUND.
  • Removed a duplicate Decimal import. tsc --noEmit now reports no errors for revenueReconciliationService.ts.

I kept the in-memory filter rather than adding a new repository query, to keep the diff focused.

Tests

  • Test fixtures now use the real DistributionRun fields (run_at, tx_batch_id).
  • New distribution run period filtering (run_at) block:
    • balanced report + run (regression)
    • run on periodEnd is counted
    • run outside the period is not counted
  • The regression and boundary tests fail on master.
  • Added an assertion that a run with tx_batch_id is not flagged STELLAR_TX_NOT_FOUND. The existing "missing transaction hash" test still covers the flagged case.

npx jest src/services/revenueReconciliationService.test.ts: 39 passing, 4 failing. The same 4 tests fail on master and are unrelated to this issue: decimal-scale formatting (0.00 vs 0.0000000000), a missing findByOffering mock, and the verifier-disabled path. This file isn't part of the CI job.

🤖 Generated with Claude Code

RevenueReconciliationService filtered distribution runs on
distribution_date and read stellar_transaction_hash, neither of which
exists on DistributionRun. Every run was dropped, so reconciliation always
reported zero payouts. Filter on run_at and use tx_batch_id as the chain
transaction reference. Also drop a duplicate Decimal import that tsc
flagged in the same file.

Closes RevoraOrg#1256

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@innocentharuna

Copy link
Copy Markdown
Author

@thlpkee20-wq please merge

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.

fix(reconciliation): filter runs by non-existent distribution_date/stellar_transaction_hash, so every period reconciles to zero payouts

1 participant