Skip to content

test(e2e): only click a filter group header when it is closed - #3700

Open
wrn14897 wants to merge 1 commit into
mainfrom
warren/address-flaky-e2e
Open

wrn14897 wants to merge 1 commit into
mainfrom
warren/address-flaky-e2e

Conversation

@wrn14897

Copy link
Copy Markdown
Contributor

Summary

Fixes a flaky E2E test, should save and restore filters with saved searches. The bug is in the openFilterGroup test helper, not the app.

openFilterGroup clicked the middle of the whole filter group. A group with an active filter opens by itself on load, so when the test reloads the saved search, SeverityText is often already open. The blind click then did one of two things:

  • Hit the header and collapsed the group. The checkbox was no longer rendered: element(s) not found.
  • Landed inside the open group, most likely on a value row's hover "Only" button. That replaced the restored filter (info became debug): Received: unchecked.

The helper now reads the accordion's data-active attribute and clicks the filter-group-control header only while the group is closed. It retries until the group reports open. That retry also covers a group that opens by itself just after the check, where the click would collapse it again. The existing wait for the open animation to finish is unchanged.

Every caller of openFilterGroup means "make sure it's open", so dropping the toggle behaviour doesn't change what any test expects.

Both failure modes showed up in downstream CI: the test failed all three attempts in one shard. I haven't seen it fail on this repo's Main runs yet, but the same helper, test and auto-expand behaviour are here.

How to reproduce

Starting point: local E2E stack (make dev-e2e).

On main:

  1. make dev-e2e FILE=saved-search GREP="filters with saved searches" ARGS="--repeat-each=10"
  2. Some repeats fail in the "Verify filters are restored from saved search" step. This is timing-dependent and may need more repeats.

On this branch:

  1. Run the same command.
  2. The filter steps pass.

Local results on this branch:

  • search-filters and shared-filters: 8/8 passed each.
  • saved-search, whole file twice: 38 passed. The two failures were in tests that don't use the helper (a row-load timeout and a back-navigation timeout).
  • Target test, 5 repeats: 4 passed. One timed out waiting for the URL change after saving, after the filter had already been applied and checked. That save-flow flake is not touched here.

How to test on Vercel preview

N/A. This is a test-only change.

References

  • Related PRs: none

openFilterGroup clicked the middle of the whole filter group. A group with
an active filter auto-expands on load, so that click either collapsed the
group or landed on a value row's hover "Only" button and replaced the
selected filter. Read the accordion's data-active state, click only the
header while closed, and retry until the group reports open.
@wrn14897
wrn14897 requested a review from a team as a code owner November 17, 2026 21:08
@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Nov 17, 2026 9:13pm UTC
hyperdx-storybook Ready Ready Preview Nov 17, 2026 9:13pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b02713d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@github-actions github-actions Bot added the review/tier-2 Low risk — AI review + quick human skim label Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔵 Tier 2 — Low Risk

Small, isolated change with no API route or data model modifications.

Why this tier:

  • Standard feature/fix — introduces new logic or modifies core functionality

Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns.
SLA: Resolve within 4 business hours.

Stats
  • Production files changed: 0
  • Production lines changed: 0 (+ 14 in test files, excluded from tier calculation)
  • Branch: warren/address-flaky-e2e
  • Author: wrn14897

To override this classification, remove the review/tier-2 label and apply a different review/tier-* label. Manual overrides are preserved on subsequent pushes.

@github-actions

Copy link
Copy Markdown
Contributor

PR Review

✅ No issues found.

@github-actions

Copy link
Copy Markdown
Contributor

Duplicate code analysis

No new duplicate code introduced by this PR.


jscpd compared this branch against origin/main
across app, api and common-utils. Only new clones are listed; the codebase
currently holds 108 in total (1.17%).
Run yarn dupes locally to reproduce, or yarn dupes:all for the full picture.

@github-actions

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical issues found. The fix is correct and a clear net reduction in flakiness. openFilterGroup now reads Mantine's data-active expansion attribute and clicks the scoped filter-group-control header only while the group is closed, wrapped in expect(...).toPass so the documented read-then-click race (a late auto-expand collapsing an already-open group) self-heals on the next retry and converges within the 20s budget. Locator scoping is correct (.first() targets the group's own header, not nested nested-filter-group-control children or value rows), async/await and the Promise<string|null> null-handling are idiomatic, and every caller of the helper means "ensure open" so dropping the toggle behavior changes no test's expectation.

🔵 P3 nitpicks (3)
  • packages/app/tests/e2e/components/FilterComponent.ts:56 — the helper newly couples to Mantine's framework-internal data-active attribute as the "expanded" proxy; if a Mantine upgrade renames or defers it, openFilterGroup fails as an opaque 20s timeout rather than a clear error.
    • Fix: add a brief inline note recording the Mantine dependency, or expose a dedicated expansion test id on the group so the helper does not rely on a framework attribute.
    • maintainability, julik-frontend-races
  • packages/app/tests/e2e/components/FilterComponent.ts:52 — the comment says "Groups with an active filter auto-expand" using "active" to mean an applied filter, while the adjacent data-active attribute it reads means "expanded", a mild readability overlap for the next reader.
    • Fix: reword the comment to distinguish "has an applied filter" from the data-active/expanded state.
  • packages/app/tests/e2e/components/FilterComponent.ts:71 (pre-existing, unchanged by this diff) — the height-stabilization rAF loop can observe three stable collapsed-height frames and resolve before the open transition commits its first frame, reintroducing the row-slides-out race the loop exists to prevent.
    • Fix: require an observed height increase (or a non-collapsed panel height) before counting stable frames, and add a frame cap so a never-stabilizing panel surfaces a diagnostic instead of hanging to the test timeout.
    • julik-frontend-races, testing

Reviewers (5): correctness, testing, maintainability, julik-frontend-races, kieran-typescript.

Testing gaps:

  • The helper cannot distinguish "our header click expanded the group" from "the group auto-expanded on its own", so a regression where the click silently no-ops would still pass as long as auto-expand eventually fires.
  • Prior PR comments (2) are automated bot output (Vercel deployment status, changeset-bot); no substantive reviewer feedback existed to verify, so the previous-comments reviewer was not dispatched.

No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond

@github-actions

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 468 passed • 1 skipped • 1151s

Status Count
✅ Passed 468
❌ Failed 0
⚠️ Flaky 0
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — b02713d5 Deployed Nov 17, 2026 by vercel[bot]
Preview – hyperdx-storybook — b02713d5 Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review/tier-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant