Skip to content

Commit 065b0a2

Browse files
svenvoskampclaude
andcommitted
fix(laboratory): make pairingReceiveSessionProposal canary metric reliably emit
The "AppKit Receive Session Proposal Timing > 7000ms" Grafana alerts (all 4 regions) were firing on No-Data, not on real latency. Their query targets HappyPath.sign.timing.pairingReceiveSessionProposal, which the canary only recorded when pairingCreatedTime was set — and that was captured by scraping a WalletConnect "set core/pairing/pairing" console log that no longer fires. So the metric was never published (0 datapoints in CloudWatch), while the unconditional receiveSessionProposal metric stayed healthy (~1.8s). Capture pairingCreatedTime deterministically when the wallet begins processing the connection URI instead of depending on SDK console output, and push the metric unconditionally. The metric name is unchanged, so the existing Grafana alert starts receiving data with no dashboard change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 50c531a commit 065b0a2

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

apps/laboratory/tests/shared/fixtures/w3m-wallet-fixture.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,13 @@ interface ModalWalletFixture {
1515
export const testConnectedMW = base.extend<ModalWalletFixture>({
1616
walletPage: async ({ context, modalPage, timingRecords }, use) => {
1717
// Setup
18-
let pairingCreatedTime: Date | null = null
1918
let verificationStartedTime: Date | null = null
2019

2120
timeStart('new WalletPage')
2221
const walletPage = new WalletPage(await context.newPage())
2322
timeEnd('new WalletPage')
2423

2524
walletPage.page.on('console', msg => {
26-
if (msg.text().includes('set') && msg.text().includes('core/pairing/pairing')) {
27-
pairingCreatedTime = new Date()
28-
}
2925
if (msg.text().includes('resolving attestation')) {
3026
verificationStartedTime = new Date()
3127
}
@@ -51,6 +47,14 @@ export const testConnectedMW = base.extend<ModalWalletFixture>({
5147
const uri = await modalPage.getConnectUri(timingRecords)
5248
timeEnd('modalPage.getConnectUri')
5349

50+
/*
51+
* Pairing is created when the wallet begins processing the connection URI.
52+
* Captured deterministically here instead of by scraping the SDK's
53+
* "core/pairing/pairing" console log, which stopped firing and left the
54+
* pairingReceiveSessionProposal metric permanently unpopulated.
55+
*/
56+
const pairingCreatedTime = new Date()
57+
5458
timeStart('walletPage.connectWithUri')
5559
await walletPage.connectWithUri(uri)
5660
timeEnd('walletPage.connectWithUri')
@@ -69,12 +73,10 @@ export const testConnectedMW = base.extend<ModalWalletFixture>({
6973
timeMs: proposalReceived.getTime() - connectionInitiated.getTime()
7074
})
7175

72-
if (pairingCreatedTime) {
73-
timingRecords.push({
74-
item: 'pairingReceiveSessionProposal',
75-
timeMs: proposalReceived.getTime() - (pairingCreatedTime as Date).getTime()
76-
})
77-
}
76+
timingRecords.push({
77+
item: 'pairingReceiveSessionProposal',
78+
timeMs: proposalReceived.getTime() - pairingCreatedTime.getTime()
79+
})
7880

7981
const walletValidator = new WalletValidator(walletPage.page)
8082

0 commit comments

Comments
 (0)