Skip to content

fix(flaky): machine-timeline 'View all' strict mode violation#1587

Draft
timothyfroehlich wants to merge 1 commit into
mainfrom
claude/vigilant-franklin-hyy42x
Draft

fix(flaky): machine-timeline 'View all' strict mode violation#1587
timothyfroehlich wants to merge 1 commit into
mainfrom
claude/vigilant-franklin-hyy42x

Conversation

@timothyfroehlich

Copy link
Copy Markdown
Owner

Summary

  • Scopes the "View all" link locator in e2e/full/machine-timeline.spec.ts to the <section aria-labelledby="recent-activity-heading"> region, preventing Playwright strict mode violations when the machine details page contains more than one "View all" link.

Root-cause analysis

Flaky test audit — 2026-06-28 (7-day window: 2026-06-21 to 2026-06-28)

Methodology

  • Scanned 30 CI workflow runs across all branches; cross-referenced run attempts and SHAs.
  • A test is flaky by strict definition: the same commit SHA both passed and failed (via retry, re-run, or independent run).

Findings

No truly flaky tests found in the 7-day window. Every failing SHA appeared in exactly one run — no SHA had both a passing and a failing run. All 6 failing runs fell into two categories:

Category Runs Root cause
Infrastructure: Supabase CLI setup failed 3 Intermittent download/startup in GHA — non-code
Feature-in-progress test breakage 2 feat/machine-info-tab branch restructured the machine details page, breaking selectors written before the Info tab existed
E2E Supabase startup failure (main) 1 One-off infra issue

Latent quality issue (this PR)

The closest issue to "flaky" was a strict mode violation in the overview Recent-activity test:

Error: locator.click: Error: strict mode violation:
  getByRole('link', { name: /view all/i }) resolved to 2 elements

The feat/machine-info-tab work added a second "View all" link elsewhere on the machine details page, making the existing locator non-unique. While it failed consistently (3/3 retries) rather than intermittently, the root cause — an unscoped breadth-first link match — will cause unpredictable failures any time the page gains another "View all" link.

Fix

The MachineRecentActivity component renders:

<section aria-labelledby="recent-activity-heading"><Link href={`/m/${machineInitials}/timeline`}>View all</Link></section>

A <section> with aria-labelledby gets the implicit ARIA role region. Scoping the locator:

// Before (unscoped — matches any "View all" link on the page):
await page.getByRole("link", { name: /view all/i }).click();

// After (scoped to the Recent Activity region):
const recentActivity = page.getByRole("region", { name: /recent activity/i });
await recentActivity.getByRole("link", { name: /view all/i }).click();

Zero markup changes required — the <section aria-labelledby> pattern was already there.

Infrastructure note

Supabase CLI setup failed in ~10% of runs (3/30). These are transient GHA network issues, not code problems. No action needed beyond awareness.

🤖 Generated with Claude Code

https://claude.ai/code/session_018JNchvk5N4rBnsR9CNMybE


Generated by Claude Code

The `getByRole("link", { name: /view all/i })` call in the overview
Recent activity test resolved to more than one element when the machine
details page contained a second "View all" link (e.g. after the
feat/machine-info-tab restructure added extra links on the same page).
Playwright strict mode throws on multi-element matches, causing a
consistent failure that looked intermittent across branches.

Fix: scope the locator to `getByRole("region", { name: /recent activity/i })`
so it only matches the link inside the Recent Activity section.  The
<section aria-labelledby="recent-activity-heading"> element has the
implicit ARIA role "region", making this a zero-markup-change fix.

Root cause class: brittle selector (not scoped to its container).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018JNchvk5N4rBnsR9CNMybE
@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
pin-point Ready Ready Preview, Comment Jun 28, 2026 4:18pm

Request Review

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