UI: wrap mapper rate limit disables submit button with no inline alert or copy [SEC-I05] (F04) #463

Closed
opened 2026-06-30 18:36:15 +00:00 by totdking · 13 comments
totdking commented 2026-06-30 18:36:15 +00:00 (Migrated from gitlab.com)
No description provided.
totdking commented 2026-06-30 18:36:49 +00:00 (Migrated from gitlab.com)

Summary

When the wrap mapper rate limit is exceeded, SwapPage.tsx disables the submit button with the label "Daily wrap limit exceeded" but does not render an inline alert block explaining the situation or offering guidance. The indexer 429 case surfaces a user-visible INDEXER_RATE_LIMIT_RETRY_MESSAGE banner via humanizeOffChainError.ts, but the wrap mapper rate limit state has no equivalent visible feedback below the button. A user who hits this limit sees a disabled button with no explanation visible on the page unless they read the button label closely.


What Was Checked

  • frontend-dapp/src/pages/SwapPage.tsx lines 934-935: isRateLimitExceeded gates button disable and label.
  • frontend-dapp/src/utils/marketDataServiceCopy.ts line 32: WRAP_RATE_LIMIT_EXCEEDED_MESSAGE copy exists but is used only as the button label.
  • frontend-dapp/src/pages/SwapPage.tsx line 1679: isPairPaused renders a visible alert block below the form. No equivalent alert block for isRateLimitExceeded.
  • frontend-dapp/src/utils/humanizeOffChainError.ts line 81: indexer 429 maps to calm copy shown as a banner; the wrap rate limit does not trigger this path.

Expected (per checklist)

When isRateLimitExceeded is true, an inline alert block (matching the style of the isPairPaused alert) is displayed below the swap form explaining the rate limit and providing retry guidance. Users should not need to read the disabled button label to understand why they cannot submit.


Actual

No inline alert renders when the wrap mapper rate limit is exceeded. The only visible indication is the disabled button label "Daily wrap limit exceeded."


Suggested Fix

In SwapPage.tsx, add an alert block conditional on isRateLimitExceeded (similar to the isPairPaused alert at line 1679) with copy such as: "Daily wrap limit reached for this amount. Try again later or reduce the amount." The block should be visible without the user focusing on the button.


Verification Checklist

  • isRateLimitExceeded triggers an inline alert block below the swap form in addition to the disabled button label
  • Alert copy is clear and actionable (retry guidance included)
  • Unit test asserts the alert block renders when isRateLimitExceeded is true
  • E2e test (wrap-swap.spec.ts) updated to assert the alert is visible when the rate limit is exceeded

Cc: @PlasticDigits

### Summary When the wrap mapper rate limit is exceeded, `SwapPage.tsx` disables the submit button with the label "Daily wrap limit exceeded" but does not render an inline alert block explaining the situation or offering guidance. The indexer 429 case surfaces a user-visible `INDEXER_RATE_LIMIT_RETRY_MESSAGE` banner via `humanizeOffChainError.ts`, but the wrap mapper rate limit state has no equivalent visible feedback below the button. A user who hits this limit sees a disabled button with no explanation visible on the page unless they read the button label closely. --- ### What Was Checked - `frontend-dapp/src/pages/SwapPage.tsx` lines 934-935: `isRateLimitExceeded` gates button disable and label. - `frontend-dapp/src/utils/marketDataServiceCopy.ts` line 32: `WRAP_RATE_LIMIT_EXCEEDED_MESSAGE` copy exists but is used only as the button label. - `frontend-dapp/src/pages/SwapPage.tsx` line 1679: `isPairPaused` renders a visible alert block below the form. No equivalent alert block for `isRateLimitExceeded`. - `frontend-dapp/src/utils/humanizeOffChainError.ts` line 81: indexer 429 maps to calm copy shown as a banner; the wrap rate limit does not trigger this path. --- ### Expected (per checklist) When `isRateLimitExceeded` is true, an inline alert block (matching the style of the `isPairPaused` alert) is displayed below the swap form explaining the rate limit and providing retry guidance. Users should not need to read the disabled button label to understand why they cannot submit. --- ### Actual No inline alert renders when the wrap mapper rate limit is exceeded. The only visible indication is the disabled button label "Daily wrap limit exceeded." --- ### Suggested Fix In `SwapPage.tsx`, add an alert block conditional on `isRateLimitExceeded` (similar to the `isPairPaused` alert at line 1679) with copy such as: "Daily wrap limit reached for this amount. Try again later or reduce the amount." The block should be visible without the user focusing on the button. --- ### Verification Checklist - [ ] `isRateLimitExceeded` triggers an inline alert block below the swap form in addition to the disabled button label - [ ] Alert copy is clear and actionable (retry guidance included) - [ ] Unit test asserts the alert block renders when `isRateLimitExceeded` is true - [ ] E2e test (wrap-swap.spec.ts) updated to assert the alert is visible when the rate limit is exceeded Cc: @PlasticDigits
totdking commented 2026-06-30 18:37:45 +00:00 (Migrated from gitlab.com)

mentioned in issue #454

mentioned in issue #454
totdking commented 2026-06-30 18:37:56 +00:00 (Migrated from gitlab.com)

mentioned in issue #381

mentioned in issue #381
Brouie commented 2026-06-30 19:26:55 +00:00 (Migrated from gitlab.com)

mentioned in merge request !988

mentioned in merge request !988
Brouie commented 2026-06-30 19:29:03 +00:00 (Migrated from gitlab.com)

Done. When the wrap-mapper rate limit is hit, the swap form only disabled the button with a "Rate Limit Exceeded" label — no visible explanation, unlike the pair-paused and blacklist states which render an alert below the form.

Added an alert-error block gated on isRateLimitExceeded (same pattern as the isPairPaused alert), with actionable copy: "Daily wrap limit reached for this amount. Wait and try again later, or reduce the amount." (WRAP_RATE_LIMIT_EXCEEDED_MESSAGE in marketDataServiceCopy.ts).

Note: the issue referenced WRAP_RATE_LIMIT_EXCEEDED_MESSAGE at marketDataServiceCopy.ts:32, but that line was actually INDEXER_RATE_LIMIT_RETRY_MESSAGE and the wrap label was hardcoded — so I added the dedicated constant.

Tests: extended the wrap rate-limit suite to assert swap-wrap-rate-limit-banner renders with the retry guidance; SwapPage suites green, tsc clean. Source + unit verified here; the e2e assertion in wrap-swap.spec.ts is a laptop item.

MR !988, branch qa/463-wrap-rate-limit-alert, commit 152f7064. Needs review/merge @PlasticDigits — leaving open for verification.

Done. When the wrap-mapper rate limit is hit, the swap form only disabled the button with a "Rate Limit Exceeded" label — no visible explanation, unlike the pair-paused and blacklist states which render an alert below the form. Added an `alert-error` block gated on `isRateLimitExceeded` (same pattern as the isPairPaused alert), with actionable copy: "Daily wrap limit reached for this amount. Wait and try again later, or reduce the amount." (`WRAP_RATE_LIMIT_EXCEEDED_MESSAGE` in marketDataServiceCopy.ts). Note: the issue referenced `WRAP_RATE_LIMIT_EXCEEDED_MESSAGE` at marketDataServiceCopy.ts:32, but that line was actually `INDEXER_RATE_LIMIT_RETRY_MESSAGE` and the wrap label was hardcoded — so I added the dedicated constant. Tests: extended the wrap rate-limit suite to assert `swap-wrap-rate-limit-banner` renders with the retry guidance; SwapPage suites green, tsc clean. Source + unit verified here; the e2e assertion in wrap-swap.spec.ts is a laptop item. MR !988, branch `qa/463-wrap-rate-limit-alert`, commit `152f7064`. Needs review/merge @PlasticDigits — leaving open for verification.
PlasticDigits commented 2026-06-30 22:06:33 +00:00 (Migrated from gitlab.com)

mentioned in commit d163b55507

mentioned in commit d163b55507a7ac01c7389958d44f83af8e65af55
PlasticDigits commented 2026-06-30 22:37:10 +00:00 (Migrated from gitlab.com)

mentioned in commit cca89a6ad4

mentioned in commit cca89a6ad4ece4017086d84c67d0043344170c4a
PlasticDigits commented 2026-06-30 22:38:24 +00:00 (Migrated from gitlab.com)

mentioned in merge request !998

mentioned in merge request !998
PlasticDigits commented 2026-07-01 00:09:09 +00:00 (Migrated from gitlab.com)

mentioned in commit 4621116ed2

mentioned in commit 4621116ed2b587f1cb1ffd3b1b1420249decd427
PlasticDigits commented 2026-07-01 00:58:47 +00:00 (Migrated from gitlab.com)

Verification complete — all acceptance criteria PASS

Verified on main (commits 152f7064, cca89a6a, merged via !988).

Checklist

Criterion Result How verified
isRateLimitExceeded renders inline alert-error below swap form (not only disabled CTA) PASS SwapPage.tsx gates data-testid="swap-wrap-rate-limit-banner" on isRateLimitExceeded (same alert-error mb-3 text-xs pattern as pair-paused/blacklist alerts)
Alert copy is clear and actionable (retry guidance) PASS WRAP_RATE_LIMIT_EXCEEDED_MESSAGE: "Daily wrap limit reached for this amount. Wait and try again later, or reduce the amount."
Unit test asserts alert block when rate limit exceeded PASS SwapPage.test.tsx — shows an inline rate-limit alert with retry guidance, not just the disabled button
E2E asserts banner visible when rate limit exceeded PASS wrap-swap.spec.ts E12 — swap-wrap-rate-limit-banner visible with retry copy

Commands run

# Unit — SEC-A02 suite (pause + rate limit CTA + inline alert)
bash scripts/with-node.sh --cwd frontend-dapp -- npm run test:run -- src/pages/SwapPage.test.tsx -t "SEC-A02"
# → 6 passed

# Unit — #463 inline alert only
bash scripts/with-node.sh --cwd frontend-dapp -- npm run test:run -- src/pages/SwapPage.test.tsx -t "rate-limit alert"
# → 1 passed

# E2E — E12 banner assertion (LCD route mock, e2e-tx)
make setup-cloud-localterra   # provisioned LocalTerra + deploy env
bash scripts/with-node.sh --cwd frontend-dapp -- npx playwright test e2e/wrap-swap.spec.ts -g "E12" --project=e2e-tx
# → 1 passed (40s)

# Typecheck
bash scripts/with-node.sh --cwd frontend-dapp -- npx tsc --noEmit
# → clean

Notes

  • Submit CTA still shows Rate Limit Exceeded (disabled) per SEC-A02; inline banner satisfies SEC-I05 F-04 without requiring users to read the button label.
  • Docs/skills already cross-reference #463 (skills/AGENTS_FRONTEND_SWAP_SAFETY_CTA.md, docs/testing.md).

Closing as verified — no further code changes required.

## Verification complete — all acceptance criteria **PASS** Verified on `main` (commits `152f7064`, `cca89a6a`, merged via !988). ### Checklist | Criterion | Result | How verified | |-----------|--------|--------------| | `isRateLimitExceeded` renders inline `alert-error` below swap form (not only disabled CTA) | **PASS** | `SwapPage.tsx` gates `data-testid="swap-wrap-rate-limit-banner"` on `isRateLimitExceeded` (same `alert-error mb-3 text-xs` pattern as pair-paused/blacklist alerts) | | Alert copy is clear and actionable (retry guidance) | **PASS** | `WRAP_RATE_LIMIT_EXCEEDED_MESSAGE`: "Daily wrap limit reached for this amount. Wait and try again later, or reduce the amount." | | Unit test asserts alert block when rate limit exceeded | **PASS** | `SwapPage.test.tsx` — `shows an inline rate-limit alert with retry guidance, not just the disabled button` | | E2E asserts banner visible when rate limit exceeded | **PASS** | `wrap-swap.spec.ts` E12 — `swap-wrap-rate-limit-banner` visible with retry copy | ### Commands run ```bash # Unit — SEC-A02 suite (pause + rate limit CTA + inline alert) bash scripts/with-node.sh --cwd frontend-dapp -- npm run test:run -- src/pages/SwapPage.test.tsx -t "SEC-A02" # → 6 passed # Unit — #463 inline alert only bash scripts/with-node.sh --cwd frontend-dapp -- npm run test:run -- src/pages/SwapPage.test.tsx -t "rate-limit alert" # → 1 passed # E2E — E12 banner assertion (LCD route mock, e2e-tx) make setup-cloud-localterra # provisioned LocalTerra + deploy env bash scripts/with-node.sh --cwd frontend-dapp -- npx playwright test e2e/wrap-swap.spec.ts -g "E12" --project=e2e-tx # → 1 passed (40s) # Typecheck bash scripts/with-node.sh --cwd frontend-dapp -- npx tsc --noEmit # → clean ``` ### Notes - Submit CTA still shows **Rate Limit Exceeded** (disabled) per SEC-A02; inline banner satisfies SEC-I05 F-04 without requiring users to read the button label. - Docs/skills already cross-reference #463 (`skills/AGENTS_FRONTEND_SWAP_SAFETY_CTA.md`, `docs/testing.md`). Closing as verified — no further code changes required.
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-07-01 00:58:48 +00:00
PlasticDigits commented 2026-07-29 02:07:48 +00:00 (Migrated from gitlab.com)

mentioned in issue #502

mentioned in issue #502
PlasticDigits commented 2026-07-29 02:08:06 +00:00 (Migrated from gitlab.com)

mentioned in issue #503

mentioned in issue #503
PlasticDigits commented 2026-08-08 11:26:46 +00:00 (Migrated from gitlab.com)

mentioned in issue #507

mentioned in issue #507
Sign in to join this conversation.
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#463
No description provided.