Skip to content

ci(harness): add baseline-freshness check for Playwright timings - #30814

Merged
chirag-madlani merged 1 commit into
mainfrom
ci/harness-baseline-freshness-check
Aug 2, 2026
Merged

chirag-madlani merged 1 commit into
mainfrom
ci/harness-baseline-freshness-check

Conversation

@chirag-madlani

Copy link
Copy Markdown
Collaborator

Summary

When a Playwright suite is re-enabled after being test.skip'd at baseline capture, timing-baseline.json retains 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.ts and counts live test(...) calls (excluding test.skip(, test.describe(, test.beforeAll(, etc.). If any live tests exist, emit a ::warning file=...:: annotating timing-baseline.json with the file name and counts.

Non-blocking — a warning, not a failure — matching the other six checks.

Real-world hits on origin/main today

Running the check as-is flags three files (in addition to #30812's fix):

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 against origin/main.
  • make harness-check — same, via the Makefile target.
  • CI's harness-integrity workflow renders the annotations on subsequent PRs.

🤖 Generated with Claude Code

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]>
Copilot AI review requested due to automatic review settings August 1, 2026 21:33
@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
# `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*\(")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 👍 / 👎

@gitar-bot

gitar-bot Bot commented Aug 1, 2026

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 0 resolved / 2 findings

Adds 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 (check_baseline_freshness) to CHECKS, but the clean-run summary message still prints "no warnings — all six checks clean", which is now inaccurate. Update the string to "all seven checks clean" (or make it count-agnostic, e.g. derive from len(CHECKS)).

Derive the count from CHECKS so the message never goes stale again.
print(f"no warnings — all {len(CHECKS)} checks clean")
💡 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

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

🤖 Prompt for agents
Code Review: Adds 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.

1. 💡 Quality: Summary still reports "all six checks clean" after adding 7th check
   Files: scripts/harness/check_harness.py:552-553

   This PR adds a 7th check (`check_baseline_freshness`) to `CHECKS`, but the clean-run summary message still prints "no warnings — all six checks clean", which is now inaccurate. Update the string to "all seven checks clean" (or make it count-agnostic, e.g. derive from `len(CHECKS)`).

   Fix (Derive the count from CHECKS so the message never goes stale again.):
   print(f"no warnings — all {len(CHECKS)} checks clean")

2. 💡 Edge Case: Live-test regex counts test( in comments/strings, risking spurious warnings
   Files: scripts/harness/check_harness.py:454, scripts/harness/check_harness.py:462

   `_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.

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

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 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-validates timing-baseline.json against live test(...) calls in the referenced spec files.
  • Update the module docstring to document seven checks and describe the new check’s intent.

Comment on lines 532 to 536
check_doc_size,
check_rule_globs,
check_generated_fresh,
check_baseline_freshness,
]
Comment on lines +457 to +462
def _spec_has_live_tests(path):
try:
text = read(path)
except (FileNotFoundError, IsADirectoryError):
return None
return len(_LIVE_TEST_CALL.findall(text))
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 3f72a15e0370d882d71ca3d1293fcb2f7a719efc in Playwright run 30719398180, 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) 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:

  • Browser traffic was 201.18 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.83 per UI scenario (1620 boots / 572 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 143 0 0 3 0 0
🟡 Shard chromium-02 132 0 1 0 0 0
✅ Shard chromium-03 123 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
🟡 1 flaky test(s) (passed on retry)
  • Pages/Entity.spec.ts › Domain Propagation (shard chromium-02, 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

@chirag-madlani
chirag-madlani added this pull request to the merge queue Aug 2, 2026
@chirag-madlani
chirag-madlani removed this pull request from the merge queue due to a manual request Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — manual (2026-08-02T09:10:22Z)

No failing check on merge-queue commit 651e06e — removed by hand, invalidated by an entry ahead in the queue, or a required check timed out.

@chirag-madlani
chirag-madlani merged commit c3b6932 into main Aug 2, 2026
78 of 79 checks passed
@chirag-madlani
chirag-madlani deleted the ci/harness-baseline-freshness-check branch August 2, 2026 09:10
k-anshul pushed a commit to k-anshul/OpenMetadata that referenced this pull request Aug 12, 2026
…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]>

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