Repository navigation
ci(playwright): warn at plan time when a file has no timing history - #30813
Conversation
❌ 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
Adds plan-time visibility to Playwright shard planning when test files lack usable timing history, by emitting GitHub Actions warnings before shards are executed. This helps catch likely under-budgeting scenarios (e.g., re-enabled suites) earlier in CI.
Changes:
- Add
emit_unweighted_warnings(...)to annotate spec files that exceed configurable “missing timing history” thresholds (by count or reserved fallback time). - Wire the warning emission into the planner
main()flow after applying history weights. - Add unit tests covering warning/no-warning behavior across threshold and history-present cases.
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 plan-time GitHub Actions warnings for files with many tests missing timing history (fallback allocation risk). |
| .github/scripts/tests/test_playwright_ci_planning.py | Adds unit tests validating warning emission thresholds and suppression when history exists. |
Suppressed comments (1)
.github/scripts/tests/test_playwright_ci_planning.py:228
- If the planner emits a repo-root-relative
file=path (recommended so the annotation links), this assertion should be updated to match the new annotated path.
planner.emit_unweighted_warnings(units, {}, {})
assert f"::warning file={file}::" in capsys.readouterr().err
| message = ( | ||
| f"{entry['count']} test(s) in {file} have no timing history; " | ||
| f"planner reserved {reserved_ms / 60_000:.1f} min via FALLBACK_TEST_MS. " | ||
| "If this suite was recently re-enabled, refresh timing-baseline.json " | ||
| "with real durations to avoid shard overruns on the first plan." | ||
| ) | ||
| print(f"::warning file={file}::{message}", file=sys.stderr) |
| for unit in units: | ||
| for test_id in unit.test_ids: | ||
| if test_id in test_weights: | ||
| continue | ||
| if (unit.file, unit.test_names[test_id]) in identity_weights: | ||
| continue |
| captured = capsys.readouterr() | ||
| assert f"::warning file={file}::" in captured.err | ||
| assert f"{planner.UNWEIGHTED_WARN_MIN_TESTS} test(s) in {file}" in captured.err |
✅ Playwright Results — workflow succeededValidated commit ✅ 550 passed · ❌ 0 failed · 🟡 0 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) 51m 6s ⏱️ Max setup 2m 59s · max shard execution 17m 53s · max shard-job elapsed before upload 21m 10s · reporting 4s 🌐 201.24 requests/attempt · 2.83 app boots/UI scenario · 2.61% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
When a suite is re-enabled after being skipped at baseline capture, the planner falls through to FALLBACK_TEST_MS per test — safe, but the plan still under-budgets by whatever margin the fallback misses reality. That first-run gap is invisible today: the plan step logs nothing, the failure surfaces later as a shard timeout. Emit a GitHub Actions `::warning file=...::` when a file's fallback allocation crosses a threshold (10 tests, or 1 min of reserved time, whichever comes first), naming the file and the reserved minutes. The re-enabling PR author sees the annotation on the plan step and can refresh timing-baseline.json before the shard timeout finds them. Non-blocking by design — a warning, not an error. Follow-up work (hard-gate at harness-integrity) is tracked separately. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
daf5938 to
7b642ed
Compare
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 (3)
.github/scripts/build_playwright_shards.py:370
::warning file=...::should point to a real path in the repository so the annotation can link to the spec.unit.fileis a path relative to the Playwright testDir (e.g.Pages/Domains.spec.ts), but there is no such path at the repo root, so this warning’sfile=metadata will be unresolved in GitHub Actions.
message = (
f"{entry['count']} test(s) in {file} have no timing history; "
f"planner reserved {reserved_ms / 60_000:.1f} min via FALLBACK_TEST_MS. "
"If this suite was recently re-enabled, refresh timing-baseline.json "
"with real durations to avoid shard overruns on the first plan."
)
print(f"::warning file={file}::{message}", file=sys.stderr)
.github/scripts/tests/test_playwright_ci_planning.py:201
- This test asserts the
file=attribute equals the suite-relative spec path (e.g.Pages/NewSuite.spec.ts). Ifemit_unweighted_warningsis updated to emit a repo-root path so GitHub can hyperlink the annotation, the expectedfile=value here should be updated accordingly.
captured = capsys.readouterr()
assert f"::warning file={file}::" in captured.err
assert f"{planner.UNWEIGHTED_WARN_MIN_TESTS} test(s) in {file}" in captured.err
.github/scripts/tests/test_playwright_ci_planning.py:228
- Same as the earlier warning assertion: once
emit_unweighted_warningsemits a repo-root file path (so Actions can link the annotation), this test should assert against that repo-rootfile=value.
planner.emit_unweighted_warnings(units, {}, {})
assert f"::warning file={file}::" in capsys.readouterr().err
Code Review ✅ ApprovedAdds GitHub Actions warning annotations to the Playwright shard planner when test files lack timing history. 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]>
…pen-metadata#30813) When a suite is re-enabled after being skipped at baseline capture, the planner falls through to FALLBACK_TEST_MS per test — safe, but the plan still under-budgets by whatever margin the fallback misses reality. That first-run gap is invisible today: the plan step logs nothing, the failure surfaces later as a shard timeout. Emit a GitHub Actions `::warning file=...::` when a file's fallback allocation crosses a threshold (10 tests, or 1 min of reserved time, whichever comes first), naming the file and the reserved minutes. The re-enabling PR author sees the annotation on the plan step and can refresh timing-baseline.json before the shard timeout finds them. Non-blocking by design — a warning, not an error. Follow-up work (hard-gate at harness-integrity) is tracked separately. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
…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
When a Playwright suite is re-enabled after being skipped at baseline capture, the shard planner falls through to
FALLBACK_TEST_MSper test. That's safe now (see #30812) but still under-budgets whatever the fallback misses. The first-run gap is invisible today — the plan step logs nothing; the miss surfaces later as a shard timeout.Change
build_playwright_shards.pynow emits a GitHub Actions::warning file=...::from the plan step when a file's fallback allocation crosses either threshold:The annotation names the file and the reserved minutes, and tells the reader to refresh
timing-baseline.jsonif the suite was recently re-enabled.Non-blocking by design — plan step still succeeds; the re-enabling PR author just sees an annotation. Hard-gate at harness-integrity will follow separately.
Test plan
python3 -m pytest .github/scripts/tests/test_playwright_ci_planning.py— 64 passed locally (60 existing + 4 new).🤖 Generated with Claude Code