Repository navigation
ci(playwright): fail the plan step at PR time when a spec's baseline is stale - #30827
Conversation
…is stale Extends PR #30813's soft warning into a hard PR-time gate for the exact pattern that caused the chromium-12 SIGTERM (#30812): a spec file where every planned test falls through to FALLBACK_TEST_MS — no test_weights hit, no identity_weights hit — because the baseline is stale. Catches this at plan time, before any test runs. The merge queue never sees the mismatch, so we don't burn a 25-minute shard wall to discover it. Also fires on wholly-new spec files, where the author has just written the tests and knows the durations. Trigger: * A file has >= STALE_BASELINE_MIN_TESTS (5) planned tests. * Every one of those tests is on the fallback path. Non-triggers (kept as warnings via emit_unweighted_warnings): * A file with < 5 fallback tests. * A file where any test carries real history — mixed coverage is the "someone added a couple of new tests" case, not a re-enable. * Identity fallback covers the file — @tag drift or renamed IDs still resolve, so the planner uses real weights. Message names the file, the count, and gives three concrete fixes (seed durations, wait for nightly refresh, or run locally). PR authors who re-enable a suite get told what to do without having to open the raw log. 6 new pytest cases cover the threshold, the ignore paths, and the end-to-end SystemExit path from main(). 69 planning tests pass. 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 |
There was a problem hiding this comment.
Pull request overview
This PR turns the Playwright shard planner’s “stale baseline” signal into a PR-time gate by failing the planning step when an entire spec file’s planned tests have no timing history (i.e., all fall back to FALLBACK_TEST_MS), preventing under-budgeted shards from reaching the merge queue.
Changes:
- Add
stale_baseline_files_in_plan()and a hard-fail path inbuild_playwright_shards.pywhen a file meets the “all fallback over threshold” signature. - Emit
::error file=...::annotations and exit non-zero before writingmatrix.jsonwhen the gate fires. - Add pytest coverage for thresholding, ignore paths, and an end-to-end
main()failure case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.github/scripts/build_playwright_shards.py |
Adds stale-baseline detection and a hard failure in main() with GitHub Actions error annotations. |
.github/scripts/tests/test_playwright_ci_planning.py |
Adds unit + end-to-end tests covering the new stale-baseline gate behavior. |
| stale_files = stale_baseline_files_in_plan( | ||
| units, test_weights, identity_weights | ||
| ) |
| for file, count in stale_files: | ||
| print( | ||
| f"::error file={file}::All {count} planned test(s) in {file} " | ||
| "have no timing history in timing-baseline.json. This is the " | ||
| "stale-baseline pattern that caused the chromium-12 SIGTERM " | ||
| "in run 30716060441 (see PR #30812).", | ||
| file=sys.stderr, | ||
| ) |
| } | ||
| ) | ||
| ) | ||
| selection.write_text(json.dumps({"mode": "full"})) |
✅ 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) 1h 5m 18s ⏱️ Max setup 2m 55s · max shard execution 21m 13s · max shard-job elapsed before upload 28m 49s · reporting 4s 🌐 201.16 requests/attempt · 2.83 app boots/UI scenario · 19.87% 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 |
- Skip the stale-baseline gate in full mode. The gate blocking a full-mode run creates a deadlock: the run is what generates the new timing-history artifact that unblocks the "wait for the next full run" remediation. Only enforce for targeted (PR) planning; full mode still gets the softer emit_unweighted_warnings info. - Prefix `::error file=...::` annotations with `openmetadata-ui/src/main/resources/ui/playwright/e2e/` so GitHub Actions resolves them relative to the repo root and the annotation attaches inline to the spec file in the PR checks UI. - Rewrite the end-to-end test to use a targeted selection (matching what a real PR selection artifact carries) so it continues to exercise the gate after the full-mode exemption above. Also assert the full repo-relative annotation path is present. - Add a second end-to-end test that runs the same scenario in full mode and confirms the gate does NOT fire — matrix.json is written and planning succeeds so the run can capture fresh timing evidence. 70 planning tests pass locally. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (1)
.github/scripts/build_playwright_shards.py:625
- The hard-fail message is a bit absolute: if tests fall back to
FALLBACK_TEST_MS, the plan can be mis-budgeted, but it won’t necessarily under-budget or guarantee a merge-queue wrapper timeout. Making this less definitive will keep the error accurate while still explaining the risk.
"Stale timing-baseline.json entries detected for spec file(s) in "
"this plan. Every planned test in each file below falls through "
"to FALLBACK_TEST_MS, so the planner will under-budget the shard "
"containing them and the merge-queue wrapper will time out.\n\n"
Code Review ✅ ApprovedConverts the Playwright timing-baseline warning into a strict PR-time gate that fails the plan step when a spec's baseline is completely stale. No issues found. OptionsDisplay: 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 |
…is stale (open-metadata#30827) * ci(playwright): fail the plan step at PR time when a spec's baseline is stale Extends PR open-metadata#30813's soft warning into a hard PR-time gate for the exact pattern that caused the chromium-12 SIGTERM (open-metadata#30812): a spec file where every planned test falls through to FALLBACK_TEST_MS — no test_weights hit, no identity_weights hit — because the baseline is stale. Catches this at plan time, before any test runs. The merge queue never sees the mismatch, so we don't burn a 25-minute shard wall to discover it. Also fires on wholly-new spec files, where the author has just written the tests and knows the durations. Trigger: * A file has >= STALE_BASELINE_MIN_TESTS (5) planned tests. * Every one of those tests is on the fallback path. Non-triggers (kept as warnings via emit_unweighted_warnings): * A file with < 5 fallback tests. * A file where any test carries real history — mixed coverage is the "someone added a couple of new tests" case, not a re-enable. * Identity fallback covers the file — @tag drift or renamed IDs still resolve, so the planner uses real weights. Message names the file, the count, and gives three concrete fixes (seed durations, wait for nightly refresh, or run locally). PR authors who re-enable a suite get told what to do without having to open the raw log. 6 new pytest cases cover the threshold, the ignore paths, and the end-to-end SystemExit path from main(). 69 planning tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> * address Copilot review - Skip the stale-baseline gate in full mode. The gate blocking a full-mode run creates a deadlock: the run is what generates the new timing-history artifact that unblocks the "wait for the next full run" remediation. Only enforce for targeted (PR) planning; full mode still gets the softer emit_unweighted_warnings info. - Prefix `::error file=...::` annotations with `openmetadata-ui/src/main/resources/ui/playwright/e2e/` so GitHub Actions resolves them relative to the repo root and the annotation attaches inline to the spec file in the PR checks UI. - Rewrite the end-to-end test to use a targeted selection (matching what a real PR selection artifact carries) so it continues to exercise the gate after the full-mode exemption above. Also assert the full repo-relative annotation path is present. - Add a second end-to-end test that runs the same scenario in full mode and confirms the gate does NOT fire — matrix.json is written and planning succeeds so the run can capture fresh timing evidence. 70 planning tests pass locally. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Summary
Turn the soft plan-time warning from #30813 into a hard PR-time gate for the exact pattern that caused the chromium-12 SIGTERM (#30812): a spec file where every planned test falls through to
FALLBACK_TEST_MSbecause the baseline is stale.The idea: align planner + implementation at PR time, so a stale baseline can't reach the merge queue. A wrapper timeout there costs ~25 min per shard and blocks every downstream PR; catching it at the plan step is ~1 s.
What trips the gate
stale_baseline_files_in_planreturns files where:STALE_BASELINE_MIN_TESTS(default 5) tests are in the plan for that file.test_weightshit, noidentity_weightshit.That combination is the "re-enabled suite" or "wholly-new spec" signature — it doesn't match a normal PR that adds a couple of tests to a well-covered file.
What does NOT trip it
Kept as warnings via
emit_unweighted_warnings(PR #30813):@tagdrift, renamed IDs, etc. still resolve.The error message
If the gate fires, the plan step exits non-zero after writing:
The
::error file=...::annotation surfaces on the PR checks page next to the file, so reviewers see it inline.Test plan
test_stale_baseline_*) covering the threshold, the three ignore paths (below threshold, mixed history, identity match), and the end-to-endmain()SystemExit.Related: #30812 (planner all-zero-history fix), #30813 (soft warning), #30814 (harness baseline-freshness warning), #30822 (glossary hang fix), #30824 (perf gate alignment).
🤖 Generated with Claude Code