Skip to content

ci(playwright): warn at plan time when a file has no timing history - #30813

Merged
chirag-madlani merged 1 commit into
mainfrom
ci/planner-warn-unweighted-suites
Aug 2, 2026
Merged

chirag-madlani merged 1 commit into
mainfrom
ci/planner-warn-unweighted-suites

Conversation

@chirag-madlani

Copy link
Copy Markdown
Collaborator

Summary

When a Playwright suite is re-enabled after being skipped at baseline capture, the shard planner falls through to FALLBACK_TEST_MS per 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.py now emits a GitHub Actions ::warning file=...:: from the plan step when a file's fallback allocation crosses either threshold:

  • ≥ 10 tests with no timing history, or
  • ≥ 1 min of reserved fallback time on a single file.

The annotation names the file and the reserved minutes, and tells the reader to refresh timing-baseline.json if 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).
  • Merge-queue plan step will emit no warnings on a normal run (all tests have baseline history).
  • Emits a warning on a synthetic re-enable (verified in unit tests).

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings August 1, 2026 21:30
@chirag-madlani
chirag-madlani requested review from a team, harshach and tutte as code owners August 1, 2026 21:30
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Aug 1, 2026

Copilot AI 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.

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

Comment on lines +344 to +350
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)
Comment on lines +333 to +338
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
Comment on lines +199 to +201
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-actions

github-actions Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 7b642edd976c71b315954db9b98774a83663b123 in Playwright run 30735093849, attempt 1.

✅ 550 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 3 skipped · 🧰 0 lifecycle flaky

Performance

Blocking 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:

  • Browser traffic was 201.24 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.83 per UI scenario (1617 boots / 571 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 139 0 0 3 0 0
✅ Shard chromium-02 136 0 0 0 0 0
✅ Shard chromium-03 124 0 0 0 0 0
✅ Shard data-asset-rules-01 61 0 0 0 0 0
✅ Shard domain-isolation-01 14 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard ingestion-01 1 0 0 0 0 0
✅ Shard reindex-01 2 0 0 0 0 0
✅ Shard search-01 10 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0

📦 Download artifacts

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]>
Copilot AI review requested due to automatic review settings August 2, 2026 05:59
@chirag-madlani
chirag-madlani force-pushed the ci/planner-warn-unweighted-suites branch from daf5938 to 7b642ed Compare August 2, 2026 05:59

Copilot AI 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.

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.file is 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’s file= 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). If emit_unweighted_warnings is updated to emit a repo-root path so GitHub can hyperlink the annotation, the expected file= 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_warnings emits a repo-root file path (so Actions can link the annotation), this test should assert against that repo-root file= value.
    planner.emit_unweighted_warnings(units, {}, {})

    assert f"::warning file={file}::" in capsys.readouterr().err

@gitar-bot

gitar-bot Bot commented Aug 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Adds GitHub Actions warning annotations to the Playwright shard planner when test files lack timing history. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar | Powered by Gitar — free for open source

akashverma0786 pushed a commit to itsroshanharry/OpenMetadata that referenced this pull request Aug 3, 2026
…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]>
k-anshul pushed a commit to k-anshul/OpenMetadata that referenced this pull request Aug 12, 2026
…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]>
k-anshul pushed a commit to k-anshul/OpenMetadata that referenced this pull request Aug 12, 2026
…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]>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants