Repository navigation
ci(harness): add baseline-freshness check for Playwright timings - #30814
Conversation
When a Playwright suite is re-enabled after being skipped at baseline capture, `timing-baseline.json` keeps 0-ms skipped entries for each test until the next full-run captures new timings. Under the old planner (pre-#30812) that was catastrophic (LPT dumped the suite on one shard); under the new planner it just under-budgets the first plan after re-enable. Either way, the misalignment goes unnoticed until a shard times out. Adds a 7th harness-integrity check that catches the discrepancy directly: for every spec file whose timing-baseline entries are ALL {outcome: skipped, durationMs: 0}, if the spec file has any live `test(...)` calls, emit a warning naming the file and the count. The check is intentionally cheap (regex over the spec text) and picks up `test.skip(` correctly (a legitimately skipped case is not counted as live). Non-blocking — a `::warning::`, not a failure — matching the other six checks. Running the new check locally on origin/main today flags three real cases: `Pages/Domains.spec.ts` (47 live vs 46 skipped baseline entries), `Features/LandingPageWidgets/DomainDataProductsWidgets.spec.ts` (6 vs 6), and `Features/BulkImport.spec.ts` (5 vs 6). The first two are seeded in #30812; BulkImport was previously believed to be legitimately skipped but the check reveals its .spec.ts has live `test(...)` calls too — worth a follow-up refresh. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
| # `test.beforeAll(`, `test.only(`, `test.skip(`, etc. `test.only(` and `test.fixme(` | ||
| # should not appear in merged code either, but a `test.skip(` is a valid signal | ||
| # that the case is still intentionally disabled, so it is treated as *not live*. | ||
| _LIVE_TEST_CALL = re.compile(r"(?<![A-Za-z_.])test\s*\(") |
There was a problem hiding this comment.
💡 Edge Case: Live-test regex counts test( in comments/strings, risking spurious warnings
_LIVE_TEST_CALL runs over the entire raw file text, so a test( appearing inside a line comment, block comment, or string literal is counted as a live test. A fully-skipped spec that mentions test( in a comment would then emit a false baseline-freshness warning. Since the check is non-blocking this is low impact, but stripping obvious // line comments before matching (or noting the limitation) would reduce noise.
Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 0 resolved / 2 findingsAdds a seventh harness-integrity check to detect stale Playwright timing baselines. Update the clean-run summary message to reflect seven checks, and refine the live-test regex to avoid matching comments and strings. 💡 Quality: Summary still reports "all six checks clean" after adding 7th check📄 scripts/harness/check_harness.py:552-553 This PR adds a 7th check ( Derive the count from CHECKS so the message never goes stale again.💡 Edge Case: Live-test regex counts test( in comments/strings, risking spurious warnings📄 scripts/harness/check_harness.py:454 📄 scripts/harness/check_harness.py:462
🤖 Prompt for agentsOptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source |
There was a problem hiding this comment.
Pull request overview
Adds a new harness-integrity warning check to detect stale Playwright timing baselines when a spec file has only {outcome: skipped, durationMs: 0} entries but the corresponding .spec.ts contains live test(...) calls—surfacing potential under-budgeting issues in shard planning at PR time.
Changes:
- Add
baseline-freshness(7th) harness-integrity check that cross-validatestiming-baseline.jsonagainst livetest(...)calls in the referenced spec files. - Update the module docstring to document seven checks and describe the new check’s intent.
| check_doc_size, | ||
| check_rule_globs, | ||
| check_generated_fresh, | ||
| check_baseline_freshness, | ||
| ] |
| def _spec_has_live_tests(path): | ||
| try: | ||
| text = read(path) | ||
| except (FileNotFoundError, IsADirectoryError): | ||
| return None | ||
| return len(_LIVE_TEST_CALL.findall(text)) |
✅ Playwright Results — workflow succeededValidated commit ✅ 549 passed · ❌ 0 failed · 🟡 1 flaky · ⏭️ 3 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 50m 53s ⏱️ Max setup 2m 54s · max shard execution 18m 15s · max shard-job elapsed before upload 21m 36s · reporting 5s 🌐 201.18 requests/attempt · 2.83 app boots/UI scenario · 6.76% common-shard skew Optimization targets still in progress:
🟡 1 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
🚦 Removed from the merge queue —
|
…n-metadata#30814) When a Playwright suite is re-enabled after being skipped at baseline capture, `timing-baseline.json` keeps 0-ms skipped entries for each test until the next full-run captures new timings. Under the old planner (pre-open-metadata#30812) that was catastrophic (LPT dumped the suite on one shard); under the new planner it just under-budgets the first plan after re-enable. Either way, the misalignment goes unnoticed until a shard times out. Adds a 7th harness-integrity check that catches the discrepancy directly: for every spec file whose timing-baseline entries are ALL {outcome: skipped, durationMs: 0}, if the spec file has any live `test(...)` calls, emit a warning naming the file and the count. The check is intentionally cheap (regex over the spec text) and picks up `test.skip(` correctly (a legitimately skipped case is not counted as live). Non-blocking — a `::warning::`, not a failure — matching the other six checks. Running the new check locally on origin/main today flags three real cases: `Pages/Domains.spec.ts` (47 live vs 46 skipped baseline entries), `Features/LandingPageWidgets/DomainDataProductsWidgets.spec.ts` (6 vs 6), and `Features/BulkImport.spec.ts` (5 vs 6). The first two are seeded in open-metadata#30812; BulkImport was previously believed to be legitimately skipped but the check reveals its .spec.ts has live `test(...)` calls too — worth a follow-up refresh. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
When a Playwright suite is re-enabled after being
test.skip'd at baseline capture,timing-baseline.jsonretains its 0-ms skipped entries until the next full-run refresh. Under the old planner (pre-#30812) that packed the suite onto one shard and blew the wall timeout (run 30716060441); under the new planner it just under-budgets the first plan. Either way the misalignment is invisible today.Change
Adds a 7th harness-integrity check (
baseline-freshness) that catches the discrepancy at PR time. For every spec file whose baseline entries are ALL{outcome: skipped, durationMs: 0}, it opens the corresponding.spec.tsand counts livetest(...)calls (excludingtest.skip(,test.describe(,test.beforeAll(, etc.). If any live tests exist, emit a::warning file=...::annotatingtiming-baseline.jsonwith the file name and counts.Non-blocking — a warning, not a failure — matching the other six checks.
Real-world hits on
origin/maintodayRunning the check as-is flags three files (in addition to #30812's fix):
Pages/Domains.spec.ts— 47 live tests vs 46 skipped baseline entries. Seeded in fix(playwright): unblock chromium shards after Domains re-enable #30812.Features/LandingPageWidgets/DomainDataProductsWidgets.spec.ts— 6 vs 6. Seeded in fix(playwright): unblock chromium shards after Domains re-enable #30812.Features/BulkImport.spec.ts— 5 live vs 6 skipped baseline entries. Previously believed to be legitimately skipped, but its.spec.tsshows 5 livetest(...)calls. Worth a follow-up baseline refresh.Once #30812 lands, only the BulkImport case remains — exactly the sort of latent gap this check is meant to surface.
Test plan
python3 scripts/harness/check_harness.py— locally confirms the check runs and emits the three expected annotations againstorigin/main.make harness-check— same, via the Makefile target.🤖 Generated with Claude Code