Skip to content

test: fixes corner cases for metrics collection data#30197

Merged
jvbriones merged 1 commit into
mainfrom
cferreira/fix-metrics-collection
May 15, 2026
Merged

test: fixes corner cases for metrics collection data#30197
jvbriones merged 1 commit into
mainfrom
cferreira/fix-metrics-collection

Conversation

@christopherferreira9

@christopherferreira9 christopherferreira9 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Description

Tightens the declarative MetaMetrics expectations static scan in collect-qa-stats.mjs so QA stats include every event naming pattern used under tests/helpers/analytics/expectations/.
The metametrics slice of qa-stats.json is built by regex-parsing expectation modules. Several valid patterns produced no counted event names, so Grafana / coverage metrics understated E2E analytics coverage even when expectations existed.

Cases that were previously missed

Pattern Example / where it showed up Prior failure
{ name: SOME_CONST } (no comma before }) Card expectations: events: [{ name: CARD_BUTTON_VIEWED }, …] Parser required name: Ident, only; } after the identifier did not match.
Only eventNames: [ CONST ], no events[].name predict-geo-restriction.analytics.ts (Geo Blocked Triggered) Inline eventNames arrays were never read; only name:, global onboardingEvents, and const … = […]; with an “event-ish” variable name were.
eventNames: [ A, B, … ] as the sole or extra inline list Onramp (RAMPS_*), opt-out, bridge/swap/predict smoke files, etc. Same as above — redundant for files that also had name:, but eventNames-only specs were fully dropped.

Not a regression / intentional: eventNames: [ ...someArray ] — spread segments are ignored here because the referenced const (e.g. transactionEventNames, expectedEventNames) is still ingested via the existing const *Names* / event-ish array path.

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

N/A

Screenshots/Recordings

Before

N/A

After

N/A

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Changes the regex-based static scan that feeds Grafana QA metrics; mistakes could under/over-count events or fail the stats job, impacting CI observability but not app runtime behavior.

Overview
Tightens .github/scripts/collect-qa-stats.mjs MetaMetrics static scanning so qa-stats.json captures more valid event-name patterns from declarative *.analytics.ts expectations.

The parser now (1) recognizes name: SOME_CONST even when it is the last field in an object, (2) extracts inline eventNames: [...] lists using a simple balanced-bracket slice, and (3) centralizes list-token resolution (string literals, onboardingEvents.*, string consts) while skipping spread entries like ...someArray.

Reviewed by Cursor Bugbot for commit 76bc803. Bugbot is set up for automated code reviews on this repo. Configure here.

@christopherferreira9 christopherferreira9 requested a review from a team as a code owner May 14, 2026 17:13
@christopherferreira9 christopherferreira9 added team-qa QA team no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed labels May 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@sonarqubecloud

Copy link
Copy Markdown

@christopherferreira9 christopherferreira9 added this pull request to the merge queue May 14, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 14, 2026
@jvbriones jvbriones added this pull request to the merge queue May 15, 2026
Merged via the queue into main with commit 75d1e2b May 15, 2026
89 checks passed
@jvbriones jvbriones deleted the cferreira/fix-metrics-collection branch May 15, 2026 14:34
@github-actions github-actions Bot locked and limited conversation to collaborators May 15, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.79.0 Issue or pull request that will be included in release 7.79.0 label May 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.79.0 Issue or pull request that will be included in release 7.79.0 size-S team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants