Repository navigation
Test: target question card title by testid instead of text - #21153
AmethystLiang merged 3 commits into
Conversation
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
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe 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 Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to 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)
✅ Passed checks (4 passed)
Full details: Out of Scope Changes checkExplanation The changes in
✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
✅ 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 withdata-testid="native-chat-question-card-title".native-chat-ask-user-question-card.spec.ts— the render gate and the post-submittoHaveCount(0)gate now both target that testid filtered byhasText, instead ofgetByText(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.
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.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: b1aa246f-fd55-4efc-abdf-4311eda3a31b
📒 Files selected for processing (2)
src/renderer/src/lib/browser-history-match-budget.tssrc/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.
There was a problem hiding this comment.
✅ 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/matchP95MsbecomeprepareMs/matchMsinbrowser-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.tsdropspercentile95forfastestSample, matching the existingpalette-match-performance.test.tsconvention 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.
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
There was a problem hiding this comment.
✅ 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.tsreplacesfastestSample(Math.min) withlowerQuartileSample(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.tsstates 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.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…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

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
pnpm lint,pnpm typecheck,pnpm testpass