Fix tsc -b build break on main: SwapAdvancedSettings bookLegMaxResult type #951

Merged
Brouie merged 1 commit from qa/337-swap-advanced-build-fix into main 2026-06-29 00:06:45 +00:00
Brouie commented 2026-06-28 22:40:27 +00:00 (Migrated from gitlab.com)

npm run build (tsc -b) is red on current main (8c56f4b8). Two TS2322s, both from one wrong prop type.

SwapAdvancedSettings declares bookLegMaxResult: { spendableRaw: string; human: string }, but the value passed in is ComputeMaxSpendableHumanAmountResult, where spendableRaw is a bigint (plus cappedByGas/reserveUluna). So it broke two ways:

  • SwapPage.tsx:1244 (#417) passes the real result -> not assignable to the string-shaped prop
  • SwapAdvancedSettings.tsx:130 (#413) reads bookLegMaxResult.spendableRaw (string) into AmountBalanceActions' spendableRaw, which is bigint

Fix: import the canonical ComputeMaxSpendableHumanAmountResult and use it for the prop. Type-only, no runtime change.

Verified locally:

  • tsc -b clean
  • vite prod bundle builds (with the #378 VITE_WC_PROJECT_ID guard satisfied)
  • vitest 1082/1084 — the 2 fails are the known terraExplorer localhost-vs-127.0.0.1 env artifact, unrelated to this

CI still doesn't run tsc -b, so this slipped through the same way the earlier build breaks did. Wiring tsc -b into the new functional CI jobs (#421) would catch this class.

npm run build (tsc -b) is red on current main (8c56f4b8). Two TS2322s, both from one wrong prop type. SwapAdvancedSettings declares `bookLegMaxResult: { spendableRaw: string; human: string }`, but the value passed in is `ComputeMaxSpendableHumanAmountResult`, where `spendableRaw` is a `bigint` (plus cappedByGas/reserveUluna). So it broke two ways: - SwapPage.tsx:1244 (#417) passes the real result -> not assignable to the string-shaped prop - SwapAdvancedSettings.tsx:130 (#413) reads `bookLegMaxResult.spendableRaw` (string) into `AmountBalanceActions`' `spendableRaw`, which is bigint Fix: import the canonical `ComputeMaxSpendableHumanAmountResult` and use it for the prop. Type-only, no runtime change. Verified locally: - tsc -b clean - vite prod bundle builds (with the #378 `VITE_WC_PROJECT_ID` guard satisfied) - vitest 1082/1084 — the 2 fails are the known terraExplorer localhost-vs-127.0.0.1 env artifact, unrelated to this CI still doesn't run tsc -b, so this slipped through the same way the earlier build breaks did. Wiring tsc -b into the new functional CI jobs (#421) would catch this class.
Brouie commented 2026-06-28 22:41:06 +00:00 (Migrated from gitlab.com)

mentioned in issue #337

mentioned in issue #337
PlasticDigits commented 2026-06-28 22:42:57 +00:00 (Migrated from gitlab.com)

Security review — MR !951

Commit reviewed: 3889651750be9e73aad53d2a93d81db7c368ce65
Scope: frontend-dapp/src/components/swap/SwapAdvancedSettings.tsx — prop type alignment for bookLegMaxResult (ComputeMaxSpendableHumanAmountResult import + Props field update). Single-file, type-only diff; no runtime logic changes.

Prior security threads: None on this MR (only system cross-reference to #337).

Analysis

Area Result
Injection / XSS No new sinks. bookLegMaxResult is computed locally via computeMaxSpendableHumanAmount (balance + payAmountRaw cap); human flows only into controlled amount inputs validated by isDecimalAmountDraft.
Authn / authz N/A — client-side UI prop typing only.
Permission boundaries Fix corrects a stale annotation (spendableRaw: string) to match runtime (bigint) already consumed by AmountBalanceActions.spendableRaw. No boundary change.
Secrets / logging None introduced.
SSRF / deserialization / path traversal Not in diff.
Supply chain No dependency changes.

TypeScript types are erased at compile time; aligning bookLegMaxResult with the canonical ComputeMaxSpendableHumanAmountResult does not alter swap submission, signing, or on-chain message construction.

Outcome: FINDINGS: 0 medium+

Inline threads: None (no actionable security issues on this diff).

Security review: no medium+ findings on this diff.

## Security review — MR !951 **Commit reviewed:** `3889651750be9e73aad53d2a93d81db7c368ce65` **Scope:** `frontend-dapp/src/components/swap/SwapAdvancedSettings.tsx` — prop type alignment for `bookLegMaxResult` (`ComputeMaxSpendableHumanAmountResult` import + Props field update). Single-file, type-only diff; no runtime logic changes. **Prior security threads:** None on this MR (only system cross-reference to #337). ### Analysis | Area | Result | |------|--------| | Injection / XSS | No new sinks. `bookLegMaxResult` is computed locally via `computeMaxSpendableHumanAmount` (balance + `payAmountRaw` cap); `human` flows only into controlled amount inputs validated by `isDecimalAmountDraft`. | | Authn / authz | N/A — client-side UI prop typing only. | | Permission boundaries | Fix corrects a stale annotation (`spendableRaw: string`) to match runtime (`bigint`) already consumed by `AmountBalanceActions.spendableRaw`. No boundary change. | | Secrets / logging | None introduced. | | SSRF / deserialization / path traversal | Not in diff. | | Supply chain | No dependency changes. | TypeScript types are erased at compile time; aligning `bookLegMaxResult` with the canonical `ComputeMaxSpendableHumanAmountResult` does not alter swap submission, signing, or on-chain message construction. **Outcome:** `FINDINGS: 0` medium+ **Inline threads:** None (no actionable security issues on this diff). Security review: no medium+ findings on this diff.
PlasticDigits commented 2026-06-29 00:06:45 +00:00 (Migrated from gitlab.com)

mentioned in commit e64670af94

mentioned in commit e64670af94b1305e7f2a787418781ab90b038763
PlasticDigits (Migrated from gitlab.com) merged commit e64670af94 into main 2026-06-29 00:06:45 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic!951
No description provided.