bug: bank-account sync re-emits a detected event for every transaction every run (no dedup/cursor → unbounded stream) #54
Labels
No labels
bug
enhancement
pr-split
question
security
transaction-matcher
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
momsse/octant#54
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: correctness/scalability (CONFIRMED by local review).
decideSynchroniseBankAccount(bank-account.aggregate.ts:178) maps everycommand.detectedTransactionsto aBankTransactionDetectedEventwith no dedup against already-known external ids — the aggregate state holds none — and the recordedlastTransactionCheckAtcursor is never fed back intobankApi.fetchTransactions(its input is only{ bankAccountId, bankId }, synchronise-bank-account.use-case.ts:56).Scenario: on each scheduled sync the bank API returns its transaction list and the aggregate re-appends a detected event for all of them, so the bank-account event stream grows without bound. Every subsequent sync reconstitutes an ever-larger stream and re-drives the async
TransactionMatchingSagato re-scan documents per event; sync latency climbs until the daemon times out / exhausts memory, silently stopping ingestion.Fix direction: track known external ids (or a high-water cursor) in
BankAccountStateand only emit detected events for genuinely new transactions; passlastTransactionCheckAtintofetchTransactionsso the adapter can fetch incrementally. Relates to #50 (sync activation) and #44 (matcher scan cost).Surfaced by the local review during #41.