Skip to content

fix(testing): deterministic canary session-proposal timing#5710

Open
tomiir wants to merge 1 commit into
mainfrom
tomiir/grafana-session-proposal-data
Open

fix(testing): deterministic canary session-proposal timing#5710
tomiir wants to merge 1 commit into
mainfrom
tomiir/grafana-session-proposal-data

Conversation

@tomiir

@tomiir tomiir commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Why

The AppKit Receive Session Proposal Timing > 7000ms Grafana canary alert paged as a false positive (see the burst of P3 escalations on 2026-07-14). Root cause: the queried metric, HappyPath.sign.timing.pairingReceiveSessionProposal, was captured by matching WalletConnect SDK console.log strings on the external wallet page (core/pairing/pairing, resolving attestation, verifyContext). When those internal logs changed format/level the metric silently stopped emitting → the panel went blank → the gap was evaluated as a >7000ms breach.

The fix removes the brittle path and replaces it with a deterministic signal.

What changed

packages/testing (@reown/appkit-testing)

  • Add WalletPage.waitForSessionProposal() — resolves when the wallet renders the request UI (approve button visible). It reuses the same owned session-approve-button testid as performRequestAction (extracted into sessionRequestButton()), so a selector change breaks the approve flow and this wait together → the run fails and pages via the success/failure canary, rather than silently dropping just the timing metric.

apps/laboratory canary fixture (w3m-wallet-fixture.ts)

  • Delete the page.on('console') block (the only console-log-gated timing capture in the suite).
  • Replace receiveSessionProposal / pairingReceiveSessionProposal / sessionProposalVerification with two deterministic timings:
    • sessionProposalReceivedconnectWithUri resolved → proposal rendered in wallet (the metric the alert should track)
    • sessionProposalApproved — proposal rendered → session approved (approve round-trip; the boundary split)
  • Capture interval timestamps immediately on await resolution (no work in between) to avoid skew.

Required monitoring-repo follow-up

Repoint the Grafana query (cloudwatch.libsonnet) from timing.pairingReceiveSessionProposaltiming.sessionProposalReceived. Until then the panel stays blank (timing alerts already resolve gaps to OK, so no false page in the interim). New baseline reads lower — it excludes the approve round-trip — so retune thresholds against real data once it flows.

Notes / known limitations

  • sessionProposalReceived includes the test wallet's render time; the pure relay/SDK delivery leg needs a wallet-side signal (owned markers in react-wallet-v2) — tracked as a separate follow-up.
  • Dropped attestation-latency (sessionProposalVerification); Verify correctness is still covered by the pass/fail verify canaries.

Verification

  • pnpm build && (cd apps/laboratory && pnpm typecheck) — not run in the authoring workspace (deps not installed); relying on CI.
  • Canary run: sessionProposalReceived + sessionProposalApproved present in timingRecords; old items absent.

🤖 Generated with Claude Code

The "Receive Session Proposal Timing" Grafana canary alert fired as a
false positive because its metric (pairingReceiveSessionProposal) was
captured by matching WalletConnect SDK console.log strings on the
external wallet page. When those logs changed the metric silently
stopped emitting, the panel went blank, and the gap was evaluated as a
>7000ms breach.

Replace the brittle console-log parsing with a deterministic signal:
- Add WalletPage.waitForSessionProposal() — waits on the owned
  session-approve-button testid (same selector as the approve action, so
  a selector change fails the run and pages instead of silently dropping
  the metric).
- Fixture now emits two deterministic timings: sessionProposalReceived
  (connect -> proposal rendered) and sessionProposalApproved (approve
  round-trip), replacing receiveSessionProposal /
  pairingReceiveSessionProposal / sessionProposalVerification.
- Capture interval timestamps immediately on await resolution to avoid
  skew.

Monitoring must repoint its query to timing.sessionProposalReceived.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 14, 2026 13:35
@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
appkit-demo Ready Ready Preview, Comment Jul 14, 2026 1:38pm
appkit-gallery Ready Ready Preview, Comment Jul 14, 2026 1:38pm
appkit-headless-sample-app Ready Ready Preview, Comment Jul 14, 2026 1:38pm
appkit-laboratory Ready Ready Preview, Comment Jul 14, 2026 1:38pm
9 Skipped Deployments
Project Deployment Actions Updated (UTC)
appkit-basic-example Ignored Ignored Jul 14, 2026 1:38pm
appkit-basic-sign-client-example Ignored Ignored Jul 14, 2026 1:38pm
appkit-basic-up-example Ignored Ignored Jul 14, 2026 1:38pm
appkit-ethers5-bera Ignored Ignored Jul 14, 2026 1:38pm
appkit-nansen-demo Ignored Ignored Jul 14, 2026 1:38pm
appkit-wagmi-cdn-example Ignored Ignored Jul 14, 2026 1:38pm
ethereum-provider-wagmi-example Ignored Ignored Jul 14, 2026 1:38pm
next-wagmi-solana-bitcoin-example Ignored Ignored Jul 14, 2026 1:38pm
vue-wagmi-example Ignored Ignored Jul 14, 2026 1:38pm

Request Review

@changeset-bot

changeset-bot Bot commented Jul 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 79d1416

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 26 packages
Name Type
@reown/appkit-testing Patch
@reown/appkit Patch
@reown/appkit-adapter-bitcoin Patch
@reown/appkit-adapter-ethers Patch
@reown/appkit-adapter-ethers5 Patch
@reown/appkit-adapter-solana Patch
@reown/appkit-adapter-ton Patch
@reown/appkit-adapter-tron Patch
@reown/appkit-adapter-wagmi Patch
@reown/appkit-common Patch
@reown/appkit-universal-connector Patch
@reown/appkit-ui Patch
@reown/appkit-controllers Patch
@reown/appkit-core Patch
@reown/appkit-utils Patch
@reown/appkit-scaffold-ui Patch
@reown/appkit-polyfills Patch
@reown/appkit-wallet Patch
@reown/appkit-siwe Patch
@reown/appkit-siwx Patch
@reown/appkit-wallet-button Patch
@reown/appkit-cdn Patch
@reown/appkit-experimental Patch
@reown/appkit-cli Patch
@reown/appkit-pay Patch
@reown/appkit-codemod Patch

Not sure what this means? Click here to learn what changesets are.

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

@github-actions

Copy link
Copy Markdown
Contributor

Visual Regression Test Results ✅ Passed

⚠️ 20 visual change(s) detected

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

👉 Please review the visual changes in Chromatic and accept or reject them.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 makes the laboratory canary session-proposal timing metrics deterministic by removing brittle WalletConnect console-log parsing and replacing it with a wallet-UI-driven signal exposed via @reown/appkit-testing.

Changes:

  • Added WalletPage.waitForSessionProposal() (approve-button visibility) as a deterministic “proposal received” signal.
  • Updated the laboratory wallet fixture to emit new timing metrics (sessionProposalReceived, sessionProposalApproved) and removed console-log-based timings.
  • Added a changeset bumping @reown/appkit-testing with the new helper.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/testing/src/pages/WalletPage.ts Adds a deterministic session-proposal wait helper and refactors request-button selection into a shared helper.
apps/laboratory/tests/shared/fixtures/w3m-wallet-fixture.ts Removes console-log timing capture and records deterministic session proposal received/approved timings.
.changeset/canary-session-proposal-timing.md Publishes the new testing helper via a patch changeset.

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

Comment on lines +86 to +88
sessionRequestButton(variant: string) {
return this.page.getByTestId(`session-${variant}-button`)
}
Comment on lines 29 to 33
timeStart('walletPage.connectWithUri')
await walletPage.connectWithUri(uri)
// Capture immediately on resolution — nothing awaited in between — to avoid skewing the interval.
const connectionInitiated = new Date()
timeEnd('walletPage.connectWithUri')
@github-actions

Copy link
Copy Markdown
Contributor

📦 Bundle Size Check

All bundles are within size limits

📊 View detailed bundle sizes

> @reown/appkit-monorepo@1.7.1 size /home/runner/work/appkit/appkit


> size-limit

@reown/appkit - Main Entry
Size limit:   80 kB
Size:         75.84 kB with all dependencies, minified and gzipped
Loading time: 1.5 s    on slow 3G
Running time: 2.2 s    on Snapdragon 410
Total time:   3.7 s
@reown/appkit/react
Size limit:   236 kB
Size:         235.08 kB with all dependencies, minified and gzipped
Loading time: 4.6 s     on slow 3G
Running time: 7.2 s     on Snapdragon 410
Total time:   11.8 s
@reown/appkit/vue
Size limit:   80 kB
Size:         75.84 kB with all dependencies, minified and gzipped
Loading time: 1.5 s    on slow 3G
Running time: 2.1 s    on Snapdragon 410
Total time:   3.6 s
@reown/appkit-scaffold-ui
Size limit:   220 kB
Size:         214.38 kB with all dependencies, minified and gzipped
Loading time: 4.2 s     on slow 3G
Running time: 4.1 s     on Snapdragon 410
Total time:   8.3 s
@reown/appkit-ui
Size limit:   500 kB
Size:         13.16 kB with all dependencies, minified and gzipped
Loading time: 258 ms   on slow 3G
Running time: 629 ms   on Snapdragon 410
Total time:   886 ms

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.55% 40093 / 51038
🔵 Statements 78.55% 40093 / 51038
🔵 Functions 76.06% 4283 / 5631
🔵 Branches 86.66% 9784 / 11290
File CoverageNo changed files found.
Generated in workflow #17179 for commit 79d1416 by the Vitest Coverage Report Action

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.

2 participants