fix(ratewise): 修正 v2 rate chip 基準標籤與切換鈕不可用態(QA-I D1/D3) - #659
Merged
s123104 merged 1 commit intoJul 6, 2026
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
s123104
force-pushed
the
fix/v2-chip-basis-honesty
branch
from
July 6, 2026 22:08
564c160 to
cf4fde9
Compare
Contributor
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
- D1:引擎 per-leg 選價改回傳 { rate, side }(side 感知 fallback),
getUnitExchangeRateWithBasis 回傳實際採用 basis 供 chip 直接消費,無平行推導
- D1:買入缺失回落賣出時標籤同步標賣出;mid 模式標「中間價」;
auto 交叉兩腿買/賣不一致只標 rate type(現金/即期)不過度宣稱
- D1:4 語系補 rateBasisCashBuy/rateBasisSpotBuy/rateBasisMid key
- D3:切換目標基準不可用時比照 v1 RateSelector 慣例加 aria-disabled、
不可用樣式與 RateTypeTooltip 原因提示
- 補值與標籤耦合測試(雙方向/fallback/mid/cross)與 rate 同源斷言;changeset(patch)
測試:vitest run SingleConverterV2 exchangeRateCalculation 131 例全綠;pnpm typecheck 通過
Co-authored-by: Cursor <cursoragent@cursor.com>
s123104
force-pushed
the
fix/v2-chip-basis-honesty
branch
from
July 6, 2026 23:07
cf4fde9 to
eb75f8a
Compare
Contributor
|
✅ SEO 審計通過!所有 2026 標準驗證項目都符合要求。
|
This was referenced Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要
修復 QA-I 稽核發現的兩個 converter v2 缺陷(D1 P1+D3 P2)。單一 hotfix PR,無順帶重構。
已依審查(REQUEST CHANGES)重構:標籤由引擎回傳的實際採用 basis 驅動,刪除平行推導函式。
D1(P1):rate chip 標籤與實際計算數值不符
根因:
basisLabel只看rateType平行推導,忽略 auto 模式(預設)實際選價方向與 fallback——引擎外幣→TWD 用銀行買入價、買入缺失時回落賣出價,chip 卻恆標「賣出」(或修法不完整時恆標「買入」)。修法(審查裁決版):
resolveConversionLeg(auto from=買入/to=賣出、sell=賣出、mid=中間價),回傳{ rate, side }——side 感知 fallback(買入全缺回落賣出時回sell;mid 退化時回實際採用側)convertCurrencyAmountWithMode與新增的getUnitExchangeRateWithBasis共用同一 leg 決策;chip 直接消費引擎回傳的side,已刪除getUnitRateSide平行推導函式getUnitExchangeRate/getBuyRate/getMidRate保持原簽名(thin wrapper),既有呼叫端零變動、數值 bit-for-bit 一致PM 同步裁決(同一 code path 一併修正):
rateBasisMid×4 語系;引擎 mid 依當前 rateType 計價且 fallback 可跨型,故不宣稱現金/即期)標籤全矩陣(rateType=現金示例;即期同理)
D3(P2):基準切換鈕不可用態零回饋
根因:KRW(spot=null)時
handleToggleBasis靜默 early-return,無樣式、無提示。修法:比照 v1
RateSelector慣例——aria-disabled+cursor-not-allowed opacity-60+既有RateTypeTooltip顯示「目前不提供 即期 匯率」(重用既有 4 語系 key)。前後對比(390×844,KRW→TWD auto 模式)
1 KRW = 0.0192 TWD ・ 現金賣出(值為買入價、標籤錯誤;切換鈕無不可用態)1 KRW = 0.0192 TWD ・ 現金買入(標籤=引擎實際 basis;chip 呈不可用態,點擊出現原因 tooltip)截圖存於 worktree
screenshots/(gitignored QA 暫存):v2-chip-krw-twd-before.png、v2-chip-krw-twd-after.png、v2-chip-krw-twd-d3-tooltip.png。測試
pnpm --filter @app/ratewise exec vitest run SingleConverterV2 exchangeRateCalculation:131 例全綠(含既有紅線回歸)WithBasis.rate === convertCurrencyAmountWithMode(1,…))來源:QA-I 行動 PWA 稽核 D1/D3;審查 REQUEST CHANGES 兩項 Blocking+PM 裁決 3/4/5。