Skip to content

Test: target question card title by testid instead of text - #21153

Merged
AmethystLiang merged 3 commits into
mainfrom
auto-e2e-tests-autofix-scheduled-ci-1h-run-61-20260917T0200
Sep 17, 2026
Merged

AmethystLiang merged 3 commits into
mainfrom
auto-e2e-tests-autofix-scheduled-ci-1h-run-61-20260917T0200

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​28 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​18
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​13 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8

Problem

The E2E test used getByText(QUESTION) to assert the question card was visible. However, the transcript also renders the pending question in an awaiting-input row, so this selector could match either element, making the test unreliable.

Solution

Added data-testid="native-chat-question-card-title" to the question card title and updated the test to target this specific element. This makes the test resilient by explicitly selecting only the card's own title node.

Visual Proof

N/A — test-only change, no user-facing behavior change.

Testing

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Self-reviewed for correctness
  • pnpm lint, pnpm typecheck, pnpm test pass

Add data-testid to NativeChatQuestionCard's title element and update the
e2e test to query by testid with a text filter. The transcript row also
renders the question text, so the previous test could match either location,
causing flaky results. Gating on the card's own title node ensures the
assertion verifies the card is actually rendered.

Fixes #20724
@coderabbitai

coderabbitai Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 6a05bbcd-54ed-41df-bf9e-f40414200d69

📥 Commits

Reviewing files that changed from the base of the PR and between e075b58 and 327d97a.

📒 Files selected for processing (2)
  • src/renderer/src/lib/browser-history-match-budget.ts
  • src/renderer/src/lib/browser-history-match.performance.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/lib/browser-history-match.performance.test.ts
  • src/renderer/src/lib/browser-history-match-budget.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The question title now has a dedicated test identifier. The end-to-end test uses a filtered title locator for visibility and removal assertions. Browser-history performance budgets and tests now use prepareMs and matchMs, based on the lower-quartile timing sample.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 327d9

The performance check now uses a lower-quartile sample as intended, with no concrete current-head defect identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The changes in src/renderer/src/lib/browser-history-match-budget.ts and src/renderer/src/lib/browser-history-match.performance.test.ts rename performance-budget fields and change the timing assert… Revert the browser-history budget and performance-test changes from this PR, or move them to a separate PR with the relevant linked issue.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary test change: targeting the native chat question card title by test ID instead of matching text.
Description check ✅ Passed The description explains the problem, solution, issue reference, visual proof status, testing changes, and scope. It is mostly complete, although it does not use all template headings or provide detai…
Linked Issues check ✅ Passed The PR supports the end-to-end rendering objective in #20724. NativeChatQuestionCard.tsx adds data-testid="native-chat-question-card-title". The E2E test uses this locator for card visibility and …
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 4 files.
Full details: Out of Scope Changes check

Explanation

The changes in src/renderer/src/lib/browser-history-match-budget.ts and src/renderer/src/lib/browser-history-match.performance.test.ts rename performance-budget fields and change the timing assertion from p95 to lower quartile. These changes do not support the native-chat question-card objective in #20724.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

This PR makes the AskUserQuestion E2E spec deterministic after #20724 added a second node that renders the same question text.

  • NativeChatQuestionCard.tsx — tags the card's title paragraph with data-testid="native-chat-question-card-title".
  • native-chat-ask-user-question-card.spec.ts — the render gate and the post-submit toHaveCount(0) gate now both target that testid filtered by hasText, instead of getByText(QUESTION).

The change is sound: #20724's awaiting-input / Asked: row (NativeChatToolRun.ask-row.test.tsx:67,80) renders QUESTION independently of the card, so the old text selector was ambiguous at render and could never reach count 0 once the settled row kept the text. A card-only handle is the correct scope, and data-testid is the repo's established E2E convention (no testIdAttribute override in tests/playwright.config.ts). The visibility transition still tracks acceptance — the card is held until delivery settles and only then cleared.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

The prepare/match budget assertions measure wall clock inside a vitest
worker that shares cores with the rest of the shard, so a slow sample
records a preemption rather than the matcher. CI shard 6/8 measured a
p95 of 3.57 ms against the 2 ms ceiling while the same test passes in
isolation; #18788 already records this file failing the same way.

Assert the fastest sample instead, matching the estimator the palette
matcher budget already uses for the same reason. Ceilings stay at 2 ms.

Measured locally (20 samples per batch): the fastest sample moved
0.05 ms -> 0.08 ms between idle and a 3,374-file parallel run, while
p95 of those same batches swung 0.09 ms -> 0.50 ms.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: b1aa246f-fd55-4efc-abdf-4311eda3a31b

📥 Commits

Reviewing files that changed from the base of the PR and between bbd449a and e075b58.

📒 Files selected for processing (2)
  • src/renderer/src/lib/browser-history-match-budget.ts
  • src/renderer/src/lib/browser-history-match.performance.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

Incremental delta since the prior Pullfrog review (bbd449a); the question-card testid change itself is untouched. The new commit reworks the browser-history performance budget:

  • Budget fields renamed — prepareP95Ms / matchP95Ms become prepareMs / matchMs in browser-history-match-budget.ts, with the header restating the fastest-sample contract.
  • Assertion statistic switched from p95 to fastest sample — browser-history-match.performance.test.ts drops percentile95 for fastestSample, matching the existing palette-match-performance.test.ts convention and its preemption rationale; the 2 ms budgets are unchanged.

The switch is sound: for a deterministic workload a real regression raises every sample, so the minimum still catches order-of-magnitude regressions, while the p95 it replaces was dominated by vitest-worker preemption. percentile95 is left with no dangling references, and the candidateCount / MAX_BROWSER_HISTORY_ENTRIES guard is unchanged.

One minor note: the PR title and description cover only the testid change, so the browser-history refactor from e075b58 is not mentioned there — worth a line if the description is meant to summarize the whole PR.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Add data-testid to NativeChatQuestionCard's title element and update the
e2e test to query by testid with a text filter. The transcript row also
renders the question text, so the previous test could match either location,
causing flaky results. Gating on the card's own title node ensures the
assertion verifies the card is actually rendered.

Fixes #20724

@pullfrog pullfrog Bot 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.

✅ No new issues found.

Reviewed changes

Incremental delta since the prior Pullfrog review (e075b58); the question-card testid change and the budget field renames are untouched.

  • Performance statistic switched from the minimum to the lower quartile — browser-history-match.performance.test.ts replaces fastestSample (Math.min) with lowerQuartileSample (nearest-rank p25, so 20 samples pick the 5th fastest), and both assertions now use it. This closes the gap where one lucky run could carry a regressed batch.
  • Budget docs updated to match — browser-history-match-budget.ts states the lower-quartile contract and records the re-measured 0.07 ms / 0.03 ms values; the 2 ms ceilings are unchanged.
  • Answers the earlier external review note — CodeRabbit's objection that a single minimum is not an adequate regression metric is now addressed; the test passes locally (3/3).
Technical details
# 327d97a — lower-quartile perf statistic

## Verified
- `lowerQuartileSample` nearest-rank p25: `ceil(20 * 0.25) - 1 = 4` → 5th smallest, matching its comment.
- `pnpm test src/renderer/src/lib/browser-history-match.performance.test.ts` → 3 passed.
- No remaining references to `fastestSample`, `prepareP95Ms`, `matchP95Ms`, or `percentile95` in the browser-history files; the monaco bench keeps its own local `percentile95`.
- `candidateCount` / `MAX_BROWSER_HISTORY_ENTRIES` equality guard unchanged.

## Notes (no action needed)
- `palette-match/palette-match-performance.test.ts:153` still uses `fastestSample`; the divergence is deliberate here, not a missing mirror.
- Commit `327d97a` reuses the testid commit subject/message but its diff is the browser-history statistic swap; cosmetic only.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@AmethystLiang
AmethystLiang merged commit 25dd70e into main Sep 17, 2026
34 checks passed
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…21153)

* test: target question card title by testid instead of text

Add data-testid to NativeChatQuestionCard's title element and update the
e2e test to query by testid with a text filter. The transcript row also
renders the question text, so the previous test could match either location,
causing flaky results. Gating on the card's own title node ensures the
assertion verifies the card is actually rendered.

Fixes stablyai#20724

* test(browser-history): budget the fastest sample, not p95

The prepare/match budget assertions measure wall clock inside a vitest
worker that shares cores with the rest of the shard, so a slow sample
records a preemption rather than the matcher. CI shard 6/8 measured a
p95 of 3.57 ms against the 2 ms ceiling while the same test passes in
isolation; stablyai#18788 already records this file failing the same way.

Assert the fastest sample instead, matching the estimator the palette
matcher budget already uses for the same reason. Ceilings stay at 2 ms.

Measured locally (20 samples per batch): the fastest sample moved
0.05 ms -> 0.08 ms between idle and a 3,374-file parallel run, while
p95 of those same batches swung 0.09 ms -> 0.50 ms.

* test: target question card title by testid instead of text

Add data-testid to NativeChatQuestionCard's title element and update the
e2e test to query by testid with a text filter. The transcript row also
renders the question text, so the previous test could match either location,
causing flaky results. Gating on the card's own title node ensures the
assertion verifies the card is actually rendered.

Fixes stablyai#20724
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.

1 participant