Guard RemoveSupportingDocumentCommand with the documentId being un-reconciled #45
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#45
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?
Follow-up from the #100 review (epic #42).
Problem
SupportingDocumentSaga.detachForReconciliationissuesRemoveSupportingDocumentCommand({ bankTransactionId })with nodocumentId, so the banking aggregate removes whatever document is currently attached — not necessarily the one that belonged to the reconciliation being undone.Reachable in a cross-stream eventual-consistency window:
SupportingDocumentSagaattaches D2 to T1 (replacing D1);SupersedeReconciliationSagahas not yet appendedReconciliationSupersededEventto R1.establishedin its own stream, soReconciliationUndoneEventfires.SupportingDocumentSagaprocesses R1's undo →removeSupportingDocument(T1)strips D2 (the replacement). R2 stays established but T1 has no supporting document.Proposed work
documentIdtoRemoveSupportingDocumentCommand;decideRemoveSupportingDocumentrejects (or no-ops) the removal when the currently-attached document is not the one named. The saga already knows the reconciliation'sdocumentIdfrom the read model.Scope note
This is a banking-domain change (command + aggregate decide + event contract), deliberately kept out of the #100 composition PR. Race-dependent, not blocking at current concurrency.