Skip to content

fix(split-meow): 混幣行程停止跨幣別錯誤加總與結算#451

Merged
s123104 merged 1 commit into
mainfrom
converge/domC-splitmeow
Jun 26, 2026
Merged

fix(split-meow): 混幣行程停止跨幣別錯誤加總與結算#451
s123104 merged 1 commit into
mainfrom
converge/domC-splitmeow

Conversation

@s123104

@s123104 s123104 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

摘要

混幣行程(同一行程混用多種幣別)先前在「各人結算」仍把不同幣別的裸數字相加,顯示誤導金額。本 PR 收斂為:混幣時短路不計算總額/餘額/結算,僅保留警告並隱藏結算區塊。

背景 / 證據

變更

  • currencies.ts:抽出純函式 resolveExpenseCurrency / resolveTripCurrency / isMixedCurrencyTrip / computeMemberBalances 作為領域 SSOT,並補單元測試。
  • HistoryTab.tsx:混幣時 totalSpent=0balances={}settlements=[],隱藏「各人結算」;useShallow 窄 selector 訂閱;EditExpenseSheet 改用該筆 expense.currency 快照顯示符號。
  • 註解清理(移除重複/翻譯式註解)。

影響範圍

apps/split-meow;單幣別行程行為完全不變。

驗收

  • pnpm --filter @app/split-meow typecheck
  • vitest:useStore / currencies / HomeAndHistorySmoke 共 71 測試通過(全套 181 通過)✅

🤖 Generated with Claude Code

- 混幣行程的總額、各人餘額與結算改為短路不計算,避免裸加不同幣別

- 隱藏混幣情境的「各人結算」區塊,僅保留警告,杜絕誤導金額

- 抽出 resolveExpenseCurrency 等純函式至 currencies SSOT 並補單元測試

- 編輯既有費用改用該筆 currency 快照顯示符號,不再依賴全域幣別

測試:split-meow typecheck 通過、vitest 3 檔 71 測試全過
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 47353cc4db

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

expenses: { currency?: CurrencyCode }[],
globalCurrency: CurrencyCode,
): CurrencyCode {
return expenses[expenses.length - 1]?.currency ?? globalCurrency;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat legacy expenses as TWD before mixed detection

在既有舊資料缺少 currency 的情境下,ExpenseRecord 的契約註明這些記錄應視為 TWD,但這裡把最舊一筆缺欄位的行程幣別 fallback 成目前全域幣別。若使用者有 KRW 功能上線前的 TWD 記錄,之後全域幣別切到 KRW 並在同一行程新增 KRW 費用,isMixedCurrencyTrip 會把舊 TWD 費用也視為 KRW,導致這次混幣 guard 被繞過,總額/餘額/結算仍會裸加不同幣別;請在解析舊記錄時固定 default 為 TWD 或先做 migration。

Useful? React with 👍 / 👎.

@s123104 s123104 merged commit e655ff3 into main Jun 26, 2026
16 checks passed
@s123104 s123104 deleted the converge/domC-splitmeow branch June 26, 2026 15:55
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.

1 participant