harden: supersede ALL prior established reconciliations per dimension + UNIQUE guard #58
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#58
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?
The supersede saga (both the transaction-side and the new document-side, #53) looks up a single prior established reconciliation per dimension (
SqlSchema.findOneOption+ORDER BY reconciliation_id ASC;Array.findFirstin the in-memory port). If a document/transaction ever holds 2+ established reconciliations at establishment time — concurrent establishes racing the async saga, or legacy/backfill data — only one prior is superseded and the rest stayestablished, re-opening the double-count.#53 fixes the reported single-prior scenario; this tracks the deeper invariant:
findAll+ iterate, for both the transaction and document dimensions);reconciliation_id ASC) so tests and production pick the same rows;Surfaced in the #53 local review.
Add to scope: when reworking the in-memory
ReconciliationsQuerylookups for multi-prior, also (a) extract the sharedRef.get → filter(isEstablishedExcluding) → findFirststructure into one private helper, and (b) sort the filtered slice byreconciliationIdso the in-memory ordering matches the PostgresORDER BY reconciliation_id ASC. Surfaced again in the #125 review.