Skip to content

Fix stale bridge quote refresh lifecycle - #4146

Open
ChiTimesChi wants to merge 2 commits into
masterfrom
codex/stale-quote-refresh
Open

ChiTimesChi wants to merge 2 commits into
masterfrom
codex/stale-quote-refresh

Conversation

@ChiTimesChi

@ChiTimesChi ChiTimesChi commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Stale bridge quotes can retain mouse listeners after replacement or disabling, causing obsolete callbacks to issue extra quote requests. Remove listeners during cleanup, use the latest callback and enabled state, and replace the repeating interval with guarded timeouts that rearm after a refresh settles.

Keep the in-flight guard local to each quote cycle. A never-settling older refresh cannot block a replacement quote from becoming stale or refreshing, and an older completion cannot clear the replacement cycle's pending state. The bridge page pauses automatic refresh while loading.

Additional context

  • Preserve the 15-second refresh delay and 30-second automatic-refresh window, followed by mouse-triggered refreshes when stale.
  • Requests already started may finish; obsolete cycles cannot start or reschedule more work. Duplicate refreshes within the current cycle remain blocked.
  • Addresses SonarCloud S7750 with findLast in the regression tests and the cycle-ownership issue identified in the review of Reduce HyperCore SYN quote RPC load #4144.
  • No quote-sharing, provider lifetime, SYN SDK, or allowance changes. This PR targets master directly and is independent of Reduce HyperCore SYN quote RPC load #4144 and Reduce duplicate bridge quote requests #4145.

Validation

  • Eight focused tests passed, covering cleanup, obsolete callbacks, current callback selection, automatic refresh and retries, stalled previous requests, and late previous completions.
  • Interface TypeScript passed with explicit Next.js ambient types for the fresh worktree.
  • Scoped ESLint (zero warnings), formatting, and git diff --check passed.

70eb6b6: synapse-interface preview link

@vercel

vercel Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
sanguine Error Error Sep 28, 2026 1:17pm UTC

@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: synapsecns/sanguine/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: d4d819d6-8d3d-4f9a-a3f4-642ef5a7ea8d

📥 Commits

Reviewing files that changed from the base of the PR and between 7c81262 and 724392c.

📒 Files selected for processing (3)
  • packages/synapse-interface/__tests__/staleQuoteUpdater.test.tsx
  • packages/synapse-interface/components/StateManagedBridge/hooks/useStaleQuoteUpdater.ts
  • packages/synapse-interface/pages/state-managed-bridge/index.tsx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.57648%. Comparing base (fc3e96f) to head (724392c).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@              Coverage Diff              @@
##              master       #4146   +/-   ##
=============================================
  Coverage   57.57648%   57.57648%           
=============================================
  Files            147         147           
  Lines           4217        4217           
  Branches         809         809           
=============================================
  Hits            2428        2428           
  Misses          1699        1699           
  Partials          90          90           
Flag Coverage Δ
packages 57.57648% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 724392c
Status: ✅  Deploy successful!
Preview URL: https://112ae0d5.sanguine-fe.pages.dev
Branch Preview URL: https://codex-stale-quote-refresh.sanguine-fe.pages.dev

View logs

@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 62.1kB (0.18%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sdk-router-@synapsecns/sdk-router-esm 485.37kB 24.46kB (5.31%) ⬆️
sdk-router-@synapsecns/sdk-router-cjs 220.11kB 9.91kB (4.71%) ⬆️
synapse-interface-server-cjs 2.29MB 13.7kB (0.6%) ⬆️
synapse-interface-edge-server-array-push 92.94kB 138 bytes (0.15%) ⬆️
synapse-interface-client-array-push 8.04MB 13.89kB (0.17%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sdk-router-@synapsecns/sdk-router-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
sdk-router.cjs.production.min.js 9.91kB 220.11kB 4.71%
view changes for bundle: synapse-interface-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
6814.js 11.62kB 485.73kB 2.45%
../pages/index.js 695 bytes 77.24kB 0.91%
2007.js 1.17kB 59.9kB 1.99%
4248.js -1 bytes 45.67kB -0.0%
8580.js 303 bytes 14.81kB 2.09%
2595.js 1 bytes 11.71kB 0.01%
5009.js (New) 10.62kB 10.62kB 100.0% 🚀
3773.js (Deleted) -10.7kB 0 bytes -100.0% 🗑️

Files in 2007.js:

  • ./components/StateManagedBridge/hooks/useStaleQuoteUpdater.ts → Total Size: 3.37kB

  • ./pages/state-managed-bridge/index.tsx → Total Size: 24.72kB

view changes for bundle: synapse-interface-edge-server-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
pages/api/rpc/[chainId].js 138 bytes 90.44kB 0.15%
view changes for bundle: sdk-router-@synapsecns/sdk-router-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
sdk-router.esm.js 24.46kB 485.37kB 5.31% ⚠️
view changes for bundle: synapse-interface-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js 11.88kB 2.41MB 0.5%
static/css/*.css 185 bytes 157.58kB 0.12%
static/chunks/pages/index-*.js 691 bytes 66.84kB 1.04%
static/chunks/4089-*.js 1.21kB 53.06kB 2.34%
static/chunks/7846-*.js (New) 11.62kB 11.62kB 100.0% 🚀
static/K2OxC0Bkm5DqfKd4H5YJh/_buildManifest.js (New) 6.67kB 6.67kB 100.0% 🚀
static/chunks/pages/pools-*.js 4 bytes 6.32kB 0.06%
static/K2OxC0Bkm5DqfKd4H5YJh/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/chunks/3230-*.js (Deleted) -11.7kB 0 bytes -100.0% 🗑️
static/3hQklxM09vkYek63F_SRq/_buildManifest.js (Deleted) -6.67kB 0 bytes -100.0% 🗑️
static/3hQklxM09vkYek63F_SRq/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️

This branch had an error being deployed

1 failed deployment
Preview — 724392c9 Deployed Sep 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant