Skip to content

ci(playwright): fail the plan step at PR time when a spec's baseline is stale - #30827

Merged
chirag-madlani merged 2 commits into
mainfrom
ci/planner-fail-on-stale-baseline
Aug 3, 2026
Merged

chirag-madlani merged 2 commits into
mainfrom
ci/planner-fail-on-stale-baseline

Conversation

@chirag-madlani

Copy link
Copy Markdown
Collaborator

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_MS because 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_plan returns files where:

  • ≥ STALE_BASELINE_MIN_TESTS (default 5) tests are in the plan for that file.
  • Every one of those tests is on the fallback path — no test_weights hit, no identity_weights hit.

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

  • Files with fewer than 5 fallback tests — "wrote a couple of new tests" case.
  • Files where any test carries real history — mixed coverage is not a re-enable.
  • Files whose fallback tests match the baseline via identity (file + leaf title) — @tag drift, renamed IDs, etc. still resolve.

The error message

If the gate fires, the plan step exits non-zero after writing:

::error file=Pages/Reactivated.spec.ts::All 6 planned test(s) in Pages/Reactivated.spec.ts
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).

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.

  Pages/Reactivated.spec.ts: 6 planned test(s), 0 with baseline history

To fix, either:
  * Seed the observed durations for these files into .github/playwright/timing-baseline.json
    (see PR #30812 for the pattern — parse a passing job's log and write real durationMs
    with outcome: expected).
  * Wait for a nightly full-mode run to organically refresh the baseline, then rebase.
  * If this is a wholly-new spec file, run it locally and copy its durations into the
    baseline before merging.

This gate catches the failure at PR time rather than on the merge queue — a wrapper timeout
in the queue costs ~25 min per shard and blocks every downstream PR.

The ::error file=...:: annotation surfaces on the PR checks page next to the file, so reviewers see it inline.

Test plan

  • 6 new pytest cases (test_stale_baseline_*) covering the threshold, the three ignore paths (below threshold, mixed history, identity match), and the end-to-end main() SystemExit.
  • Manually reproduced the pre-fix(playwright): unblock chromium shards after Domains re-enable #30812 pattern with a synthetic test-list + all-skipped baseline — gate exits 1 with the expected message.
  • All 69 planning tests pass locally.

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

…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]>
Copilot AI review requested due to automatic review settings August 2, 2026 11:34
@github-actions

github-actions Bot commented Aug 2, 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 2, 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

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 in build_playwright_shards.py when a file meets the “all fallback over threshold” signature.
  • Emit ::error file=...:: annotations and exit non-zero before writing matrix.json when 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.

Comment on lines +591 to +593
stale_files = stale_baseline_files_in_plan(
units, test_weights, identity_weights
)
Comment on lines +595 to +602
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"}))
@github-actions

github-actions Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit cd413ea6e38d9eb5f09de8fde254e615cf2a238f in Playwright run 30791556154, attempt 1.

✅ 549 passed · ❌ 0 failed · 🟡 1 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) 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:

  • Common shard skew was 19.87% (convergence target: at most 15%).
  • Browser traffic was 201.16 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.83 per UI scenario (1618 boots / 572 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 28 0 1 0 0 0
🟡 1 flaky test(s) (passed on retry)
  • Flow/SearchRBAC.spec.ts › User with permission (shard search-rbac-01, 1 retry)

📦 Download artifacts

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]>
Copilot AI review requested due to automatic review settings August 3, 2026 06:51

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 (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"

@chirag-madlani
chirag-madlani added this pull request to the merge queue Aug 3, 2026
Merged via the queue into main with commit a175100 Aug 3, 2026
74 of 75 checks passed
@chirag-madlani
chirag-madlani deleted the ci/planner-fail-on-stale-baseline branch August 3, 2026 13:45
@gitar-bot

gitar-bot Bot commented Aug 3, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Converts 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.

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

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