From d59bca6c1bfa94d012a300785f84ff0173855266 Mon Sep 17 00:00:00 2001 From: Darek Date: Thu, 3 Sep 2026 12:14:22 +0200 Subject: [PATCH 01/12] fix: bind source-funded repay reviews to snapshots - reuse warmed intents only when click-time semantics match - bind source and target positions into direct and batch review - cover deferred source changes with regression tests --- components/BatchContents.vue | 6 +- components/BatchReviewModal.vue | 20 +-- .../operation/OperationReviewModal.vue | 50 +++++--- composables/repay/useCollateralSwapRepay.ts | 97 ++++++++------ composables/repay/useSavingsRepay.ts | 119 +++++++++++------- composables/useExecutionReview.ts | 49 +++++--- composables/useTxBatch.ts | 9 +- docs/transaction-building.md | 2 + .../planning/requirements.ts | 30 +++++ pages/position/[number]/repay.vue | 48 +++---- .../useCollateralSwapRepay.test.ts | 87 ++++++++++++- tests/composables/useExecutionReview.test.ts | 43 ++++++- tests/composables/useSavingsRepay.test.ts | 62 ++++++++- tests/composables/useTxBatch.test.ts | 11 +- .../reviewed-execution/intent-factory.test.ts | 21 +++- tests/reviewed-execution/inventory.test.ts | 12 +- tests/utils/position-tag.test.ts | 21 ++++ utils/positionTag.ts | 29 +++++ 18 files changed, 560 insertions(+), 156 deletions(-) create mode 100644 tests/utils/position-tag.test.ts create mode 100644 utils/positionTag.ts diff --git a/components/BatchContents.vue b/components/BatchContents.vue index 54cd053b9..183a61acf 100644 --- a/components/BatchContents.vue +++ b/components/BatchContents.vue @@ -31,9 +31,9 @@ const modal = useModal() const openEntryReview = (entry: BatchEntry) => { if (!entry.review) return modal.open(OperationReviewModal, { - // Forward the entry's sub-account so the review shows the same "Position N" - // pill as the batch operations list (entry.review itself doesn't carry it). - props: { ...entry.review, subAccount: entry.subAccount, plan: entryPlans.value[entry.id], hideExecute: true }, + // Forward account context so position-funded operations identify both the + // target and the distinct account supplying assets or shares. + props: { ...entry.review, subAccount: entry.subAccount, sourceSubAccount: entry.sourceSubAccount, plan: entryPlans.value[entry.id], hideExecute: true }, }) } diff --git a/components/BatchReviewModal.vue b/components/BatchReviewModal.vue index bd6872df9..81df5951d 100644 --- a/components/BatchReviewModal.vue +++ b/components/BatchReviewModal.vue @@ -1,7 +1,7 @@