Skip to content

Conversation

@tomiir
Copy link
Collaborator

@tomiir tomiir commented Nov 14, 2025

Description

  • Adds retries for: fetchProjectConfigs, fetchAllowedOrigins and fetchProjectLimits

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • Code in this PR is covered by automated tests (Unit tests, E2E tests)
  • My changes generate no new warnings
  • I have reviewed my own code
  • I have filled out all required sections
  • I have tested my changes on the preview link
  • Approver of this PR confirms that the changes are tested on the preview link

Note

Introduce a reusable retry helper and apply 3x/5s retries to project config, usage limits, and allowed origins requests, with expanded tests and error handling.

  • ApiController:
    • Add withRetries helper to retry async operations.
    • Wrap fetchProjectConfig, fetchUsage (/appkit/v1/project-limits), and fetchAllowedOrigins with retries (interval ControllersConstantsUtil.FIVE_SEC_MS, max 3).
    • Preserve/match error handling for fetchAllowedOrigins: map 429 to RATE_LIMITED, 5xx to SERVER_ERROR, otherwise return [].
  • Tests:
    • Update and add tests to validate retry behavior using fake timers for all three endpoints.
    • Expand assertions for error mapping (429 and 5xx) and successful retry recovery.

Written by Cursor Bugbot for commit 3b59780. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings November 14, 2025 16:16
@changeset-bot
Copy link

changeset-bot bot commented Nov 14, 2025

⚠️ No Changeset found

Latest commit: 3b59780

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Nov 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
appkit-basic-html Ready Ready Preview Comment Nov 14, 2025 5:09pm
appkit-demo Ready Ready Preview Comment Nov 14, 2025 5:09pm
appkit-gallery Ready Ready Preview Comment Nov 14, 2025 5:09pm
appkit-headless-sample-app Ready Ready Preview Comment Nov 14, 2025 5:09pm
appkit-laboratory Ready Ready Preview Comment Nov 14, 2025 5:09pm
10 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
appkit-basic-example Ignored Ignored Nov 14, 2025 5:09pm
appkit-basic-sign-client-example Ignored Ignored Nov 14, 2025 5:09pm
appkit-basic-up-example Ignored Ignored Nov 14, 2025 5:09pm
appkit-ethers5-bera Ignored Ignored Nov 14, 2025 5:09pm
appkit-nansen-demo Ignored Ignored Nov 14, 2025 5:09pm
appkit-vue-solana Ignored Ignored Nov 14, 2025 5:09pm
appkit-wagmi-cdn-example Ignored Ignored Nov 14, 2025 5:09pm
ethereum-provider-wagmi-example Ignored Ignored Nov 14, 2025 5:09pm
next-wagmi-solana-bitcoin-example Ignored Ignored Nov 14, 2025 5:09pm
vue-wagmi-example Ignored Ignored Nov 14, 2025 5:09pm

@github-actions
Copy link
Contributor

github-actions bot commented Nov 14, 2025

Visual Regression Test Results ✅ Passed

✨ No visual changes detected

Chromatic Build: https://www.chromatic.com/build?appId=6493191bf4b10fed8ca7353f&number=436
Storybook Preview: https://6493191bf4b10fed8ca7353f-wkyucygpkm.chromatic.com/

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds retry logic to three API methods (fetchProjectConfig, fetchAllowedOrigins, and fetchUsage) to improve reliability when communicating with backend services.

  • Introduces a new withRetries helper function to handle retry logic
  • Configures all three methods with 3 retries and 5-second intervals between attempts
  • Imports ConstantsUtil from controllers to use the FIVE_SEC_MS constant

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 14, 2025

📦 Bundle Size Check

All bundles are within size limits

📊 View detailed bundle sizes

> @reown/[email protected] size /home/runner/work/appkit/appkit


> size-limit

@reown/appkit - Main Entry
Size limit:   80 kB
Size:         71.14 kB with all dependencies, minified and gzipped
Loading time: 1.4 s    on slow 3G
Running time: 538 ms   on Snapdragon 410
Total time:   2 s
@reown/appkit/react
Size limit:   230 kB
Size:         228.25 kB with all dependencies, minified and gzipped
Loading time: 4.5 s     on slow 3G
Running time: 1.1 s     on Snapdragon 410
Total time:   5.6 s
@reown/appkit/vue
Size limit:   80 kB
Size:         71.14 kB with all dependencies, minified and gzipped
Loading time: 1.4 s    on slow 3G
Running time: 402 ms   on Snapdragon 410
Total time:   1.8 s
@reown/appkit-scaffold-ui
Size limit:   220 kB
Size:         209.44 kB with all dependencies, minified and gzipped
Loading time: 4.1 s     on slow 3G
Running time: 604 ms    on Snapdragon 410
Total time:   4.7 s
@reown/appkit-ui
Size limit:   500 kB
Size:         13.15 kB with all dependencies, minified and gzipped
Loading time: 257 ms   on slow 3G
Running time: 65 ms    on Snapdragon 410
Total time:   322 ms

@github-actions
Copy link
Contributor

github-actions bot commented Nov 14, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 79.2% 38047 / 48038
🔵 Statements 79.2% 38047 / 48038
🔵 Functions 77.18% 4091 / 5300
🔵 Branches 86.64% 9211 / 10631
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/controllers/src/controllers/ApiController.ts 96.3% 97.31% 90.16% 96.3% 145-146, 312-313, 548-556, 583, 597, 601, 605
Generated in workflow #16368 for commit 3b59780 by the Vitest Coverage Report Action

// 3 retries with 5 seconds interval
ControllersConstantsUtil.FIVE_SEC_MS,
3
)
Copy link

Choose a reason for hiding this comment

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

Bug: Retry wrapper incorrectly retries client errors.

The withRetries wrapper retries all errors including HTTP 429 (rate limit) responses. When rate limited, the function makes 4 total attempts (initial + 3 retries) with 5-second intervals before throwing RATE_LIMITED. Retrying on 429 errors without respecting rate limit signals can exacerbate rate limiting and violate HTTP semantics. The retry logic should skip retries for 4xx client errors, particularly 429.

Fix in Cursor Fix in Web

@github-actions
Copy link
Contributor

Warnings
⚠️

🌐 Non-company domain introduced (host: example.com) in packages/controllers/tests/controllers/ApiController.test.ts (line 904): https://example.com

Generated by 🚫 dangerJS against 3b59780

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.

3 participants