Skip to content

ci(playwright): unify postgres/mysql e2e into a reusable workflow - #31628

Merged
chirag-madlani merged 4 commits into
mainfrom
unify-nightly-e2e-workflows
Aug 18, 2026
Merged

chirag-madlani merged 4 commits into
mainfrom
unify-nightly-e2e-workflows

Conversation

@chirag-madlani

@chirag-madlani chirag-madlani commented Aug 17, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The nightly postgres and mysql workflows had drifted from the maintained playwright-postgresql-e2e.yml pipeline — same intent, but hand-copied shard logic, no smart selection, no distribution/fixture cache, and their own env blocks. Changing the pipeline meant editing three files.

Extract every job into playwright-e2e-reusable.yml (on: workflow_call) parameterised by database, profile, workflow_filename, and ref. Three thin callers now share it:

File Triggers Purpose
playwright-postgresql-e2e.yml (94 lines) PR + PR-target + merge_group + on-demand PR gate
playwright-postgresql-nightly.yml (81 lines, new) on-demand only, branch: input Release-branch runner
playwright-mysql-nightly.yml (80 lines) on-demand only, branch: input Release-branch runner

The old on-demand runners (postgresql-nightly-e2e.yml, mysql-nightly-e2e.yml) and the required-check placeholder playwright-mysql-e2e-skip.yml are deleted; their behaviour is folded into the callers above.

Notable design points

  • ref: input on the reusable — branch-runners are always dispatched from main; the input drives every test-path checkout (7 places: cache-keys, build, detect-changes, plan-playwright, restore-playwright-fixture, prepare-playwright-fixture, playwright-ci, plus slack-notify).
  • Security-sensitive checkouts stay pinned — the playwright-summary render script uses github.sha and the timing-baseline refresh uses main, so a compromised release branch can't rewrite the trusted-code paths.
  • playwright-ci-postgresql → playwright-ci — the sharded job is DB-neutral now. This shows up in 4 tests / 2 comments that parsed the workflow by string; all 103 workflow-parsing tests still pass.
  • Slack notification preserved — both nightly callers expose send_slack_notification (was already there on the old nightly files); the PR flow never had it and still doesn't.

Test plan

  • python3 -m pytest .github/scripts/tests/test_playwright_ci_planning.py .github/scripts/tests/test_playwright_cache_assets.py .github/scripts/tests/test_playwright_performance_gate.py — 103 passed
  • python3 -c "import yaml; ..." on all 4 workflow YAMLs — parses clean
  • make harness-check — no new warnings introduced (2 pre-existing dead-reference warnings, 2 doc-size, 1 generated-fresh, all unrelated)
  • Dispatch Postgresql PR Playwright E2E Tests (workflow_dispatch) on this branch — full suite, http, coarse=true — and confirm green
  • Dispatch PostgreSQL Playwright E2E (release branch) from main with branch: unify-nightly-e2e-workflows — confirm every checkout picks up this branch, summary/baseline-refresh stay on main
  • Dispatch MySQL Playwright E2E (release branch) from main with branch: unify-nightly-e2e-workflows — confirm mysql compose file (docker-compose.yml) is selected, -d mysql reaches the setup action, --profile mysql-nightly reaches the shadow-gate

🤖 Generated with Claude Code

Greptile Summary

The PR consolidates PostgreSQL and MySQL Playwright pipelines into a reusable workflow while retaining thin trigger-specific callers.

  • Adds database, profile, workflow filename, source-ref, and notification inputs to the shared pipeline.
  • Replaces the old nightly workflows with PostgreSQL and MySQL release-branch callers.
  • Keeps the PostgreSQL PR summary and timing-baseline refresh in the caller to preserve trusted checkout and required-check behavior.
  • Updates workflow-parsing tests and documentation for the renamed shared jobs.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains within the eligible follow-up review scope.

No blocking failure remains.

Important Files Changed

Filename Overview
.github/workflows/playwright-e2e-reusable.yml Introduces the parameterized workflow containing the shared gating, caching, fixture preparation, shard execution, reporting, and notification jobs.
.github/workflows/playwright-postgresql-e2e.yml Converts the PostgreSQL PR workflow into a reusable-workflow caller while retaining its trusted summary and baseline-refresh jobs.
.github/workflows/playwright-postgresql-nightly.yml Adds a manual PostgreSQL release-branch caller that forwards database-specific inputs to the reusable pipeline.
.github/workflows/playwright-mysql-nightly.yml Adds a manual MySQL release-branch caller that selects the MySQL compose and shadow-gate configuration.
.github/scripts/tests/test_playwright_ci_planning.py Updates workflow-structure assertions for the reusable job names and caller-owned summary job.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  PR[PostgreSQL PR and merge triggers] --> PGC[playwright-postgresql-e2e.yml]
  PGD[PostgreSQL release-branch dispatch] --> PGN[playwright-postgresql-nightly.yml]
  MYD[MySQL release-branch dispatch] --> MYN[playwright-mysql-nightly.yml]
  PGC --> RW[playwright-e2e-reusable.yml]
  PGN -->|database: postgresql| RW
  MYN -->|database: mysql| RW
  RW --> PLAN[Change detection and shard planning]
  RW --> FIXTURE[Build or restore fixture]
  RW --> TESTS[Playwright shard jobs]
  RW --> REPORTS[Reports and optional Slack notification]
  PGC --> SUMMARY[Trusted PR summary and baseline refresh]
Loading

Reviews (3): Last reviewed commit: "ci(playwright): move summary+baseline-re..." | Re-trigger Greptile

The nightly postgres and mysql files had drifted from the maintained
`playwright-postgresql-e2e.yml` pipeline — same intent, but hand-copied
shard logic, no smart selection, no distribution/fixture cache, and their
own env blocks. A change to the pipeline meant editing three files.

Extract every pipeline job into `playwright-e2e-reusable.yml`
(`on: workflow_call`) parameterised by `database`, `profile`,
`workflow_filename`, and `ref`. Three thin callers:

  - `playwright-postgresql-e2e.yml` (94 lines) — PR + merge_group +
    pull_request_target + workflow_dispatch on the current branch.
  - `playwright-postgresql-nightly.yml` (81 lines, new) — on-demand,
    takes a `branch:` input for release-branch verification.
  - `playwright-mysql-nightly.yml` (80 lines) — on-demand, same shape;
    MySQL is not a PR gate.

The old on-demand branch-runners (`postgresql-nightly-e2e.yml`,
`mysql-nightly-e2e.yml`) and the required-check placeholder
`playwright-mysql-e2e-skip.yml` are deleted; their behaviour is folded
into the callers above.

Security-sensitive checkouts (`playwright-summary` render script,
`refresh-timing-baseline`) deliberately ignore the branch input and
stay on `github.sha`/`main` so a compromised release branch cannot
tamper with the trusted-code paths.

The 20-line rename `playwright-ci-postgresql` → `playwright-ci` (the
sharded job is DB-neutral now) shows up in the four tests / two comments
that parsed the workflow file by string; all 103 workflow-parsing tests
still pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 17, 2026 10:54

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

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 17, 2026
…thing

Declaring a `secrets:` block on `on: workflow_call` turns it into the
closed set of secrets the reusable can reference. The prior version
listed only `E2E_SLACK_BOT_OAUTH_TOKEN`, so every `secrets.TEST_*`
reference elsewhere in the file became an undefined property — GitHub
Actions caught this at parse time and reported `startup_failure` on the
`pull_request` run of the caller.

Remove the block entirely so `secrets: inherit` on both callers passes
the full secret set through unchanged. Actionlint drops from 44 errors
to zero (only a pre-existing SC2016 warning remains).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 17, 2026 12:22

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Startup_failure on the pull_request run:
  "The nested job 'refresh-timing-baseline' is requesting
  'contents: write, pull-requests: write', but is only allowed
  'contents: read, pull-requests: read'."

In reusable workflows the caller's job permissions are the *upper bound*
on what any reusable job can request. The `refresh-timing-baseline` job
inside the reusable declares `contents: write, pull-requests: write` so
it can open the auto-refresh PR — but the callers only granted read.

Elevate the caller-side `jobs.playwright.permissions` on all three
callers so the reusable's baseline-refresh job is inside the grant.
Every other reusable job declares its own read-only permissions block,
and baseline-refresh itself is gated on `github.event_name ==
'merge_group'` — so PRs, PR-targets, and dispatches never invoke a
writer, they just declare a header they don't use.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 17, 2026 12:26

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit 9f8f6257821a14182c6eb47d57a53da70ea58aa8 in Playwright run 32058451904, attempt 1.

✅ 551 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 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) 57m 39s

⏱️ Max setup 2m 58s · max shard execution 18m 36s · max shard-job elapsed before upload 22m 24s · reporting 4s

🌐 213.70 requests/attempt · 2.83 app boots/UI scenario · 13.17% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 213.7 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 142 0 0 0 0 0
✅ Shard chromium-02 133 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 11 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

Reusable workflow jobs are always reported by GitHub as
`<caller-job> / <sub-job>`, so a `playwright-summary` job inside the
reusable ended up as `playwright / playwright-summary` — invisible to a
branch-protection rule requiring the unprefixed name. Same story for
`refresh-timing-baseline`.

Move both jobs out of the reusable and into `playwright-postgresql-e2e.yml`
so they run at the caller top level and produce the exact check names
branch protection expects:

  * `playwright-summary`         — required PR check + PR-comment payload
  * `Refresh timing baseline`    — merge_group-only auto-PR

To surface the reusable's per-job results/outputs into the caller, add a
`workflow_call.outputs:` block that publishes:
  gate_result, gate_should_run, check_changes_{result,e2e,docker_compose},
  cache_keys_result, build_result,
  detect_changes_{result,mode}, plan_playwright_{result,matrix},
  restore_playwright_fixture_result, prepare_playwright_fixture_result,
  playwright_ci_result

The caller's summary/refresh jobs consume these via
`needs.playwright.outputs.<key>`. Every other reusable job (gate through
playwright-ci) still runs inside the reusable so the mysql/postgres
branch-runners inherit the pipeline unchanged. `slack-notify` inside the
reusable drops its dep on `playwright-summary` and now waits only on
`playwright-ci`.

Reverts the caller-side `contents/pull-requests: write` grant added in
9ccd91f — nothing inside the reusable needs write now that the refresh
job has moved out. Only the caller-level `refresh-timing-baseline`
declares its own write permissions block.

Actionlint warns 9x about `jobs.<id>.result` not being a valid property
in `workflow_call.outputs.value`; GitHub Actions accepts it at runtime
per docs on the `jobs` context. If runtime disagrees we'll add an
aggregator job.

Tests: point workflow-parsing tests at the caller / reusable as
appropriate; all 103 pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 17, 2026 19:05

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chirag-madlani
chirag-madlani added this pull request to the merge queue Aug 18, 2026
Merged via the queue into main with commit 865f87e Aug 18, 2026
86 of 89 checks passed
@chirag-madlani
chirag-madlani deleted the unify-nightly-e2e-workflows branch August 18, 2026 14:02
@gitar-bot

gitar-bot Bot commented Aug 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Consolidates PostgreSQL and MySQL Playwright end-to-end pipelines into a single parameterized reusable workflow with thin callers, reducing duplication across configuration files. 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 👍 / 👎 | Powered by Gitar — free for open source

ShaileshParmar11 added a commit that referenced this pull request Aug 25, 2026
lint:playwright:full differed from lint:playwright only by
--suppressions-location eslint-suppressions.json, which is already ESLint's
default — both produced byte-identical output. The name also misled: :full
implied full-corpus versus something narrower, but lint:playwright globs the
same corpus; the genuinely narrow variant is ui-checkstyle:playwright:changed.

CI and lint:playwright:suppressions now chain off lint:playwright, so the
remaining pair reads as what it is: check, versus check-and-prune.

Also narrows the lint and prettier globs from {ts,tsx,js,jsx} to {ts,tsx} —
the corpus is TypeScript-only and corpus.test.ts enforces it — and documents
both lint commands plus yarn flake:report in the handbook. The flake
aggregator has no CI caller after #31628 moved the upload's anchor, so it is
labelled a local utility rather than left looking like dead code.
ShaileshParmar11 added a commit that referenced this pull request Aug 25, 2026
Neither had a caller. The flake aggregator lost its only one when #31628
unified the postgres/mysql e2e workflows and moved the upload step's anchor,
so the script, its test and the flake:report entry were reachable only by
typing the command by hand. expectRowFor was exported and never referenced
anywhere, not even by a rule message.

getRowByName and clickAndWaitFor stay: no-positional-locator and
require-response-listener-before-action name them in their error messages, so
the rules would otherwise point contributors at helpers that do not exist.

Removing expectRowFor also orphaned the expect import — ESLint could not see
it, since no-unused-vars is off for playwright files, but tsc's noUnusedLocals
did.
timothybrush pushed a commit to timothybrush/OpenMetadata that referenced this pull request Aug 28, 2026
… via ESLint + suppressions ratchet (open-metadata#31994)

* chore(playwright): promote six zero-violation lint rules to error

* chore(playwright): promote remaining lint rules to error behind suppressions ratchet

* chore(playwright): stop Prettier from fighting the ESLint suppressions file

* chore(playwright): scaffold local eslint plugin for custom rules

Adds the CommonJS eslint-rules plugin skeleton (rules: {}) that later
tasks register rules into, wires it into eslint.config.mjs under the
om-playwright namespace, and adds a node --test based unit test target.

Also adds an eslint.config.mjs block scoping the plugin's own .js files
to CommonJS globals/no-require-imports:off, and switches the
test:eslint-rules script to a glob instead of a bare directory path --
both needed because `node --test <dir>` does not recurse into an
explicit directory argument on this repo's pinned Node (22.17.0),
confirmed against the .nvmrc version, not just the locally active one.

* feat(playwright): add clickAndWaitFor helper for race-free response waits

* feat(playwright): add require-response-listener-before-action rule and fix 16 races

Registers a listener promise before the triggering action instead of awaiting
waitForResponse() after it, which races an already-fired response and hangs
until timeout. Zero suppressions — all 16 pre-existing violations fixed by hand.

* fix(playwright): register dataAsset listener before Explore navigation, not as a weaker loader wait

Review found the explore.ts fix from the prior commit substituted a strictly
weaker wait (toHaveCount(0) is a no-op if the loader hasn't mounted yet) with
an inaccurate comment. selectDataAssetFilter has exactly one call site, so
the listener moves to EntitySummaryPanel.spec.ts's single beforeEach, before
the sidebarClick that actually triggers the query.

* feat(playwright): add no-blanket-test-slow rule

* fix(playwright): catch blanket test.slow() in beforeEach and aliased test objects

- beforeEach runs on the triggering test's own timeout slot (verified
  against playwright@1.57.0 worker/workerMain.js), so test.slow() there
  has the same blast radius as a describe-scope call; the previous
  heuristic treated it as legal. beforeAll/afterAll/afterEach each get
  their own slot and correctly remain legal.
- Widen detection to aliased test objects (e.g. base.slow() inside
  base.describe(), where base = test.extend(...)) via a dynamic
  test-object-identifier signal, while excluding variables bound
  directly to the describe function itself (const d = test.describe;)
  from being misclassified as per-test callbacks.
- Add RuleTester cases pinning beforeEach, beforeAll, afterEach,
  test.step, aliased test objects, and the describe-alias edge case.
- Re-snapshot: 89 violations (79 + 9 beforeEach + 1 aliased describe),
  suppressions total 94 (unchanged, 4 promoted rules) + 89 = 183.

* feat(playwright): add require-assertion-per-test rule

Flags e2e tests whose body only performs page/locator interactions
(clicks, fills, navigation) with no expect() reference anywhere and no
call to anything beyond the test's own Playwright fixtures - i.e. tests
that are provably assertion-free.

The rule intentionally does not flag delegation to a helper or
page-object method (entity.descriptionUpdate(page), addUser(...),
verifyAuthenticated(...)), since those may assert internally and
proving otherwise needs interprocedural analysis this rule doesn't do.
An earlier text-scan-only design flagged 474 tests, but hand-verifying
samples showed most delegate to helpers that do assert - a large,
confirmed false-positive rate. Scoping the rule to only what it can
prove (no expect text + every call rooted at a page fixture) drops
that to a single, high-confidence violation:
playwright/e2e/nightly/ServiceIngestion.spec.ts's "Default Pagination
size should be 15" test, which waits on two network patterns and
clicks once but never asserts a status, body, or visible count.

Registered as om-playwright/require-assertion-per-test, scoped to
playwright/e2e/**/*.spec.{js,jsx,ts,tsx} only (utils/support files
contain no tests). Snapshot suppresses the one existing violation via
--suppress-rule; the four already-promoted playwright/* suppressions
(94) and om-playwright/no-blanket-test-slow (89) are untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(playwright): make test.slow/setTimeout/step transparent in require-assertion-per-test

test.slow(true), test.setTimeout(...), and test.step(...) were being
treated as ordinary non-page calls, so any test opening with one of
them (89 suppressed sites use test.slow()) was silently exempted no
matter how purely it clicked afterward - none of them can assert.

A call rooted at the `test` identifier is now filtered out before the
"every remaining call is page/locator-only" check, instead of counting
either way. test.step's own nested calls are unaffected: they're
separate CallExpression nodes checked on their own merits, since the
callback is inline and fully visible, not a delegated helper.

Corpus impact: still exactly 1 violation, same site
(ServiceIngestion.spec.ts:189) - no re-snapshot needed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(playwright): add scoped locator helpers and no-positional-locator rule

* fix(playwright): close positional-locator receiver-type evasion, fix row helper defaults

Widen no-positional-locator to flag Identifier/MemberExpression receivers
(hoisted-variable and property-stored locators), not just inline call-chain
tails - 185 previously-missed sites, closing the cheapest evasion path
(hoist into a variable). Discriminate genuine Playwright .first()/.last()/
.nth() calls from same-named non-Locator calls (e.g. lodash) by argument
arity instead.

Fix scopedLocators helpers: getRowByName defaulted to a CSS attribute
selector that never matches implicit ARIA roles (Ant Design <tr> rows),
and expectRowFor never forwarded rowSelector. Default to page.getByRole('row')
and thread rowSelector through both helpers; document the hasText
substring-collision failure mode.

Re-snapshot: no-positional-locator suppressions 1068 -> 1253 via
--suppress-rule (never --suppress-all/--prune-suppressions); the three
pre-existing suppression groups are byte-identical.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* feat(playwright): add heuristic guardrail rules with justified-disable escape hatch

Add no-unscoped-count-assertion and require-unique-entity-name (heuristic,
expect false positives) plus justified-rule-disable, the escape hatch that
lets a developer document why a heuristic misfire is being suppressed.

require-unique-entity-name is implemented, tested, and registered in the
plugin but deliberately not enabled: a raw pass found 1625 violations, and
a 25-sample hand review found 0/25 true positives (matches were almost
entirely Playwright's own getByRole(..., { name }) option and static
config keys, not entity creation). Snapshotting that baseline would ratchet
near-total noise; left for a follow-up to narrow the heuristic. The other
two rules were sanity-checked, found to carry real signal, and are
snapshotted normally (+73, +9 violations; suppressions total 1437 -> 1519).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(playwright): remove no-unscoped-count-assertion and require-unique-entity-name

Both were reviewed against their full/near-full population, not just the
sanity-check samples from the initial implementation:

- require-unique-entity-name: confirmed ~3/1625 (0.18%) true-positive
  rate. The heuristic can't distinguish assigning a name to a new entity
  from using one to look an existing element up — 59% of hits are
  Playwright's own getByRole/getByLabel(role, { name }) accessible-name
  option, where adding uuid() would break the locator. 43/51 files under
  playwright/support/entity/ already call uuid() internally, so
  uniqueness is solved one layer down from where this rule looked.
  Never enabled, so no suppressions to remove.

- no-unscoped-count-assertion: full classification of all 73 sites found
  ~77% false positives (17 true / 56 false), dominated by the rule
  flagging locators already scoped through a variable per its own
  recommended fix (const c = loc.filter({ hasText }); expect(c)...) —
  failing code for following its own advice. Suppressions pruned via a
  full-corpus --prune-suppressions run; total 1519 -> 1446.

justified-rule-disable is untouched (its count of 9 was independently
re-verified) and now registers as the fifth rule in the plugin.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(playwright): generate rule table from eslint config and consolidate guidance

Docs previously listed a hand-written, stale error/warn split for the Playwright
ESLint rules that no longer matched eslint.config.mjs (every rule now runs at
error). Generate the rule table from the config instead, so the docs can't
drift from what CI actually enforces, and consolidate the overlapping rules
file and skills onto the generated table and the real lint:playwright:suppressions gate.

* ci(playwright): enforce guardrail rules and suppressions ratchet

Adds a corpus meta-test that fails if eslint-suppressions.json's total
grows (ceiling 1446, the current baseline), and wires a full-corpus CI
step running the rule unit tests, the suppressions-aware lint with
pruning, and the generated rule-table freshness check. The step is
unconditional rather than changed-files-scoped because
--prune-suppressions against a partial file set would delete valid
suppressions for files the PR didn't touch. Until this lands, all 18
Playwright guardrail rules only ran locally.

Also updates skills/playwright-validation/SKILL.md's stale
three-rule/warn-tier description to reflect that every rule is now
error-level with no warn tier.

* fix(ci): restore pruned suppressions file and harden pipefail in playwright guardrail step

--prune-suppressions writes eslint-suppressions.json in place when it
drops a stale entry, and the step never restored it — a later step in
the same job (lint_core_components) runs a repo-wide git status check
that could then misattribute this failure to itself. Restore the file
unconditionally on both the pass and fail paths.

Also guard the failure-detail grep with `|| true`: under GitHub's
default `bash -eo pipefail` shell, a grep with no matches exits
non-zero and would abort the script before the GITHUB_OUTPUT writes,
leaving the PR summary comment blank.

* ci(playwright): aggregate flake data from existing reporter output

Playwright already runs with retries: 1 and the JSON reporter is already
enabled, so flaky/failed data is produced and discarded on every CI run.
Add a small aggregator that turns results.json into a flake-report.json
summary per shard, uploaded as an artifact. Purely additive: no new test
runtime, no changes to any existing step or job outcome.

* fix(playwright): close ratchet/bypass gaps and harden flake-report upload

Four fixes from final branch review:
- ui-checkstyle: run the non-pruning yarn lint:playwright:full so a fixed
  violation fails CI until its stale suppression is pruned and committed,
  instead of silently discarding the rewrite; drop the now-dead
  git checkout restore; update the failure-reason text accordingly.
- justified-rule-disable rule + CI grep guard: a bare eslint-disable (no
  rule list) or a disable of the rule itself previously bypassed all 18
  guardrail rules undetected; the rule now reports blanket disables and a
  CI-level grep guard catches the self-referential case the rule cannot see.
- playwright-postgresql-e2e: add continue-on-error/overwrite/if-no-files-found
  to the flake-report upload so artifact-name collisions on job re-run don't
  fail an otherwise-passing 40-minute shard.
- docs: point developer-facing lint instructions at
  yarn lint:playwright:suppressions to match the new CI command split.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* style(playwright): apply prettier formatting to guardrail source files

CI's changed-files checkstyle runs prettier, which the guardrail work did not.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* ci(playwright): fold guardrail checks into the existing playwright step

CodeQL flagged the separate guardrail step as a high-severity cache-poisoning
risk: it executes PR-authored code (the eslint config and the local rule
plugin) in a pull_request_target job with a privileged checkout.

The file already documents the convention - every `run:` executing PR code in
this job is a poisonable step, so a separate step adds one more for no gain in
isolation. Folding the guardrail commands into the existing playwright step
removes the new alert without weakening the gate.

The checks now run before --fix/--write so they judge what the contributor
actually wrote, and the changed-files matcher is widened to eslint.config.mjs
and eslint-suppressions.json so a config-only change still triggers the gate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* chore(playwright): baseline the suppressions ratchet at 1520

`--suppress-all` over the current corpus (366 spec files, 618 linted)
captures every existing violation per file/rule, so all 18 rules can run at
`error` without fixing anything first.

The notch is what an unlinted corpus accumulated, not a budget: no rule here
has ever been enforced, so nothing has held the count down. corpus.test.js
pins it and fails if the total rises. From here it only moves downward.

* fix(ci): close the bypass-guard hole in the playwright guardrail grep

The guard's second alternative used [^\\n]* to span the gap between
'eslint-disable' and the rule name. Inside a POSIX bracket expression a
backslash is literal, so [^\\n] means 'not a backslash and not the letter
n' — it cannot cross the 'n' in '-next-line'. The most common bypass form,

  // eslint-disable-next-line om-playwright/justified-rule-disable

therefore slipped straight through the check meant to catch it, while the
block form was caught. Use .* instead: grep is line-oriented, so the
newline exclusion was redundant as well as wrong.

* docs(playwright): document clickAndWaitFor's first-match semantics

The helper resolves on the first response matching urlPattern and judges
that one's status. When a single click produces several matching responses,
a later healthy response cannot rescue an earlier failure — callers need to
narrow the pattern rather than assume the helper picks the relevant one.

* fix(playwright): scope the guardrail rules to TypeScript and enforce it

The playwright rule globs were inherited as {js,jsx,ts,tsx}. Nothing in the
corpus is JavaScript — all 245 baselined files are .ts — but the glob pulled
in the new CommonJS plugin under eslint-rules/, applying test rules like
no-positional-locator to the linter's own source. That is also why the CI
bypass-guard grep had to be restricted to .ts/.tsx: the plugin's RuleTester
fixtures contain literal eslint-disable strings it would match.

Narrow the four rule globs to {ts,tsx}. The plugin keeps its own CommonJS
block, so its source is still linted, just not as a Playwright test. The
suppressions baseline is byte-identical.

Scoping alone would trade one gap for another: Playwright's default
testMatch collects *.spec.js, so a JavaScript spec would run with no rules
applied at all. Verified directly — a planted .spec.js is collected as
'[chromium] > Features/__ExtCheck.spec.js'. So the TypeScript-only property
the scoping relies on is now asserted in corpus.test.js rather than assumed,
and fails with the offending paths if a .js/.jsx ever lands in the corpus.

* refactor(playwright): convert the guardrail plugin and scripts to TypeScript

The 16 files this PR added were plain CommonJS JavaScript in a TypeScript
repo. Node 22 runs TypeScript directly via type stripping (CI is on v22.22.2),
so they are now .ts ESM with real types and no build step.

- 6 rule sources typed against eslint/estree — 0 type errors; tsc:playwright
  stays at main's 164-error baseline.
- 7 rule tests and 3 scripts converted to ESM: require -> import,
  module.exports -> export, __dirname -> import.meta.dirname, and the
  CommonJS require.main guard -> an import.meta.url comparison.
- eslint.config.mjs imports the plugin entry as .ts, and the Playwright rule
  globs narrow to {ts,tsx} with eslint-rules/ ignored: the plugin is a linter,
  not a test, and its RuleTester fixtures deliberately contain the exact
  anti-patterns those rules look for.
- playwright/tsconfig.json gains allowImportingTsExtensions, and excludes
  eslint-rules/tests — their node:test imports have no types to check against
  under this repo's @types/node 15.x.

Also fixes a duplicate package.json key this PR had introduced:
test:eslint-rules was defined twice, so the second silently shadowed main's
own rule tests and CI ran only half of them. One key now runs both suites —
93 tests, all passing.

* ci(playwright): follow the TypeScript conversion in the guardrail step

The rule-table generator moved to .ts, so the --check invocation and the
failure message that quotes it both had to follow, or the step would fail on
a missing file.

The bypass grep also needed rescoping. Its .ts/.tsx filter previously skipped
the plugin's RuleTester fixtures for free, because those lived in .test.js —
after the conversion they are .test.ts and the guard matched the very strings
they exist to assert on, firing on 5 lines of the plugin's own source. Exclude
eslint-rules/ by path instead: it is a linter, not a test, and eslint.config.mjs
already declines to apply the guardrail rules to it. Verified the guard is
still clean on the real corpus and still fires on a planted blanket disable.

* fix(playwright): sort plugin imports and raise the eslint floor to 9.39

organize-imports reorders the converted TypeScript modules, so the four
affected files are committed in their sorted form — CI's checkstyle applies
the same pass and failed on the diff.

package.json declared eslint ^9.18.0, but the ratchet depends on bulk
suppressions (--suppressions-location / --prune-suppressions), which only
exist from 9.24. It worked solely because yarn.lock happens to resolve
9.39.4; a fresh resolution landing on 9.18-9.23 would have failed CI with an
unknown-flag error. Raise the declared floor to ^9.39.0 to match the feature
the guardrails actually require, and retarget the lockfile entry — the
resolved 9.39.4 satisfies both ranges, so --frozen-lockfile still passes.

* chore(playwright): drop the redundant lint:playwright:full script

lint:playwright:full differed from lint:playwright only by
--suppressions-location eslint-suppressions.json, which is already ESLint's
default — both produced byte-identical output. The name also misled: :full
implied full-corpus versus something narrower, but lint:playwright globs the
same corpus; the genuinely narrow variant is ui-checkstyle:playwright:changed.

CI and lint:playwright:suppressions now chain off lint:playwright, so the
remaining pair reads as what it is: check, versus check-and-prune.

Also narrows the lint and prettier globs from {ts,tsx,js,jsx} to {ts,tsx} —
the corpus is TypeScript-only and corpus.test.ts enforces it — and documents
both lint commands plus yarn flake:report in the handbook. The flake
aggregator has no CI caller after open-metadata#31628 moved the upload's anchor, so it is
labelled a local utility rather than left looking like dead code.

* chore(playwright): drop the unused flake aggregator and expectRowFor

Neither had a caller. The flake aggregator lost its only one when open-metadata#31628
unified the postgres/mysql e2e workflows and moved the upload step's anchor,
so the script, its test and the flake:report entry were reachable only by
typing the command by hand. expectRowFor was exported and never referenced
anywhere, not even by a rule message.

getRowByName and clickAndWaitFor stay: no-positional-locator and
require-response-listener-before-action name them in their error messages, so
the rules would otherwise point contributors at helpers that do not exist.

Removing expectRowFor also orphaned the expect import — ESLint could not see
it, since no-unused-vars is off for playwright files, but tsc's noUnusedLocals
did.

* fix(playwright): close four guardrail bypasses found in review

CRIT-1/2/3 — the CI bypass grep let three forms through. Its pattern required
eslint-disable to be followed by `*/` or end-of-line, so the justified forms
`/* eslint-disable -- why */` and `// eslint-disable-line -- why` never
matched, while still silencing all 18 rules. Match an empty rule list instead:
`*/`, `--`, or end-of-line. A directive that names a rule is untouched.

The exclusion was --exclude-dir='eslint-rules', which grep matches against a
basename at any depth, while eslint.config.mjs only ignores the adjacent
playwright/eslint-rules/. A spec at playwright/e2e/**/eslint-rules/ was
therefore linted but exempt from the guard, needing no justification at all.
Replaced with a path-anchored filter.

CRIT-4 — corpus.test.ts asserted total <= a hard-coded 1520 that nothing
recomputes, so a burn-down dropping the total to 200 would open 1,320 units of
free headroom. Now asserts exact per-rule counts, making every movement an
explicit edit; the undocumented PW_SUPPRESSION_CEILING override is gone.
Verified: a lowered total and a cross-rule swap both fail now. Same-rule,
same-file swaps remain invisible and are documented as such in the test.

HIGH-2/HIGH-3 — the five RuleTester suites ran under espree, not the
@typescript-eslint/parser the rules ship with, so the 107 green tests measured
a different AST. no-positional-locator allowlisted receiver node types and
failed open on rows!.first(), (rows as Locator).nth(2), await (…).first() and
page.locator('td')['first'](). Transparent TypeScript/await wrappers are now
unwrapped and computed string members resolved; the four escapes have
regression cases that could not previously have been parsed.

HIGH-5 — importing the plugin as .ts requires Node's unflagged type stripping
(22.18+), which broke `yarn lint` for the whole app on 22.0-22.17. engines.node
raised to >=22.18.0.

* fix(playwright): address the should-fix findings from review

HIGH-1 — require-response-listener-before-action performed no ordering
analysis: it reported every inline `await …waitForResponse(…)` and could not
see which statement triggered the response, while its name, description,
handbook row and .claude/rules entry all promised ordering enforcement.
Banning the inline shape is a sound proxy — hoisting is the only way to
register first — so the rule is renamed no-awaited-wait-for-response to say
what it does, and its scope note records that an aliased call slips past it.

HIGH-4 — require-assertion-per-test detected assertions with a \bexpect\b
scan over raw source text, so `// we expect the click to work` or a URL
containing "expect" exempted an assertion-free test. Now collects real
`expect` identifiers from the AST, which still credits an assertion
delegated by reference (`verifyRow(page, expect)`). Verified: comment and
string cases are flagged, delegation is not, and the corpus baseline does not
move.

MED-1 — the guardrail step also runs the rule tests and the rule-table drift
check, but its changed-files trigger listed only playwright sources, the
eslint config and the suppressions file. The handbook holding the generated
table, eslint-rules/, the generator and package.json could all change without
the step running — the drift guard never firing for the files that cause
drift. Note kept outside the `files:` block scalar, where every line is a
glob rather than a comment.

MED-2/3 — the skills and .claude/rules asserted "no warn tier" and "no
advisory rules", contradicted by the config, and pointed contributors at
lint:playwright:suppressions as the gate. That variant is not stronger: it
passes on the stale-entry case CI fails on and rewrites a tracked file. Docs
now name lint:playwright as the CI-equivalent check, with the pruning variant
scoped to post-cleanup. Also corrects "every test needs an expect()", which
the rule cannot and does not enforce.

* style(playwright): re-sort plugin imports after the rule rename

* chore(playwright): declare @types/estree and fix a misleading skill description

The TypeScript conversion imports types from 'estree' but never declared the
package. It resolved only because a transitive dependency happens to hoist it
to the top of node_modules — the same works-by-accident-of-resolution class as
the eslint version floor, which did bite. The lockfile already keys on ^1.0.0,
so declaring it changes no resolution and --frozen-lockfile still passes.

This PR also reduced skills/writing-playwright-tests to a redirect stub while
leaving its frontmatter advertising 'testing philosophy, patterns, and best
practices'. Skills are selected by that description, so an agent choosing it
got a redirect instead of guidance. The description now says what the file is.

* chore(playwright): ratchet no-skipped-test 5 -> 4 after merging main

main unskipped the glossary advanced-operations test (open-metadata#32010), which left its
no-skipped-test suppression unused. The full lint failed with exit 2 on the
stale entry, exactly as the ratchet intends; pruned and recorded the lower
count. Total 1520 -> 1519.

This is the exact-count check earning its keep: the baseline moved and the
test refused to pass until the movement was written down.

* fix(ci): stop the playwright checkstyle step crashing on non-TypeScript files

organize-imports resolves each argument against the TypeScript project and
aborts with "Could not find source file" on anything that is not in it. The
playwright step passed $CHANGED_FILES straight through, while the src step
has always filtered to code files first.

The trigger for this step deliberately includes eslint-suppressions.json,
package.json and the handbook .md — a change to any of them must run the
guardrails — so those land in the changed-file list and kill the step before
any check runs.

That is why it passed on PRs and failed in the merge queue every time: a PR
push lists only what that push touched, and most pushes do not include the
suppressions file, whereas the merge queue lists everything the PR changes
against main, which always does.

Filter to .ts/.tsx for organize-imports only; eslint and prettier handle JSON
and Markdown correctly and keep the full list. Verified under bash against the
exact file list from the failing run: unfiltered exits 1, filtered exits 0,
with lint and prettier still clean on the full set.

* chore(playwright): re-baseline against main (1519 -> 1520)

main moved 25 commits under the branch, three of them touching playwright.
open-metadata#30909 (Conversation V2) reworked 21 spec and util files (+600/-270), which
pushed several files past their recorded counts while others dropped below —
so the merge-queue run failed both ways at once: 17 no-positional-locator
errors plus stale entries.

Net movement is small: no-positional-locator 1341 -> 1343 (main added two new
call sites), no-wait-for-selector 36 -> 35. Total 1519 -> 1520.

These landed before the gate is live, so absorbing them is initialization
rather than the ratchet slipping — the same argument as the original 1265 ->
1341. The never-rises rule binds every PR after this one merges.

* chore(playwright): re-baseline after open-metadata#29849 landed (1520 -> 1516)

open-metadata#29849 (QueryBuilderWidgetV1 migration) merged along with open-metadata#32097 and open-metadata#32112,
touching the playwright corpus. The full lint failed both ways as expected:
10 unsuppressed errors plus stale entries.

Net movement is downward — no-positional-locator 1343 -> 1339, total
1520 -> 1516. open-metadata#29849's diff added 18 positional call sites, but other changes
in the same range removed more than that, so the ratchet tightens rather than
loosens here.

tsc:playwright moves 165 -> 166; the new error is in
playwright/e2e/Features/AdvancedSearch.spec.ts, a file main changed and this
branch does not touch. Zero tsc errors come from any file this PR adds.

* fix(ui): keep engines.node at >=22.0.0 so collate-ui can still install

Raising the floor to >=22.18.0 broke Collate's build. collate-ui's
prepare_collate-ui target runs `yarn install` against this package on Node
22.17, and yarn enforces engines at install time — so the build failed before
anything ran:

  error open-metadata@0.1.0: The engine "node" is incompatible with this
  module. Expected version ">=22.18.0". Got "22.17.0"

That step only installs; it never loads eslint.config.mjs, so the floor was
blocking a consumer that does not need the capability it describes.

The underlying requirement is real — importing the plugin as .ts needs Node's
type stripping, unflagged from 22.18 and behind --experimental-strip-types
from 22.6 — so it is now documented at the import site rather than dropped
silently. This repo's own .nvmrc is v22.22.2, and CI runs it, so the
supported path is unaffected.

* refactor(playwright): write the guardrail plugin as .mjs, not TypeScript

Reverts the TypeScript conversion for the plugin, its tests and the rule-table
generator, and with it the Node floor that broke Collate's build.

Importing the plugin as .ts made eslint.config.mjs depend on Node's type
stripping — unflagged only from 22.18. That is a real requirement, so engines
was raised to match; but collate-ui runs `yarn install` against this package
on Node 22.17 and yarn enforces engines at install time, so a capability the
Collate build never uses blocked it from installing at all.

Writing the plugin as plain ESM removes the requirement rather than declaring
or working around it. It also matches what this repo already does: every
other rule plugin in eslint-rules/ is .mjs, including main's own
openmetadata-playwright.mjs, and scripts/ is .js/.mjs throughout — the .ts
files were the only ones of their kind.

Verified the constraint is genuinely gone: eslint now runs clean with
--no-experimental-strip-types, the exact condition that previously failed with
ERR_UNKNOWN_FILE_EXTENSION.

Also drops @types/estree, added only for the annotations, and removes
allowImportingTsExtensions plus the eslint-rules/tests exclude from
playwright/tsconfig.json, which existed only because the tests were .ts.

* chore(playwright): re-baseline suppressions after merging main

main moved the Playwright corpus since the last push: SettingsNavigationPage
gained one positional locator (8 -> 9) and Users.spec.ts had five fixed
(21 -> 16). Absorb both so the ratchet reflects the merged tree.

no-positional-locator 1339 -> 1335; baseline total 1516 -> 1512.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(playwright): trim over-long guardrail comments

Cut comments that restated the code and compressed the rationale blocks that
had grown into essays. Kept the notes that record something unrecoverable from
reading the source: the workerMain.js timeout-slot evidence, the grep
basename-matching gotcha, --prune-suppressions exiting 0, the organize-imports
crash on .json, and the $$ replacement corruption.

Comments only; no functional lines touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(lint): give scripts/*.mjs the Node globals it runs with

scripts/ had no ESLint config block, so `process` and `console` were undefined
there. The rule table generator was shielded by its .ts extension --
typescript-eslint disables no-undef for TypeScript -- until it moved to .mjs to
drop the Node type-stripping dependency. That re-armed no-undef against a
directory the config never covered.

Only reachable when a scripts/ file lands in a changed-file lint: a PR event
resolves a narrower diff, while the merge queue lists the whole PR against main
and always includes it.

Scoped to .mjs; the .js tooling alongside is CommonJS and needs a separate fix.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(playwright): close the .spec.mjs hole in the TypeScript-only guard

The guard rejected only .js/.jsx, but Playwright's default testMatch also
collects .mjs/.cjs/.mts/.cts, and the guardrails are scoped to .ts/.tsx -- so a
.spec.mjs would run entirely unlinted. Now that .mjs is a normal extension in
this tree, that is a realistic bypass.

Stated as an allowlist rather than a list of banned extensions, so any future
module extension is closed by default. Non-module files (.png, .md, .json) are
untouched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(playwright): keep js/jsx in the guardrail globs

Narrowing these to {ts,tsx} left the guardrails depending entirely on the
corpus TypeScript-only test: a .js spec would run with no rules applied if that
one test were ever skipped or bypassed. The narrowing bought nothing -- no
.js/.jsx exists under playwright/ -- so restoring them is free and puts the
lint back as a second line of defence behind the guard.

Verified unchanged: 0 errors, 218 warnings before and after.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(ci): cut the playwright step comments to one or two lines each

Comments only; no functional lines touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(ci): close four queue-only holes in the playwright guardrail step

Found by review of the merge-queue failure. Each was reproduced.

Trigger globs missed playwright/eslint-rules/**, playwright.config.ts and the
module extensions, and the whole step is gated on any_changed -- so a PR
touching only the guardrail plugin, the Playwright config, or a .spec.mts ran
no guardrails at all. The plugin's own tests never gated changes to the plugin.

The bypass grep only recognised directives starting with eslint-disable. An
inline `/* eslint <rule>: 0 */` silenced every rule undetected: a probe with
.first(), force:true and waitForTimeout linted clean.

Return codes are now captured so the git-status gate always runs. organize-imports
and prettier disagree permanently, so files are dirty between those lines; under
bash -e a lint failure aborted before cleanup and left the dirt for the next step,
which is how a playwright lint error turned the unrelated i18n job red.

The suppressions gate now splits real violations from stale entries. Both exit
non-zero, and the code is 2 even when a real violation is present, so keying off
it would swallow violations. Violations are counted from errorCount in the JSON
report and fail; a stale entry is main drifting under the branch, not a defect
here, and only warns.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(playwright): match eslint-disable directives that wrap across lines

`[^\n]*` cannot span a newline, so a directive whose rule list wrapped was not
recognised as a directive at all -- the rule reported nothing and no
justification was demanded. The CI grep missed it too, since that only fires
when eslint-disable sits alone on its line.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(playwright): correct the corpus guard's comment and failure message

Restoring js/jsx to the guardrail globs made this file's wording wrong: it still
claimed the guardrails cover .ts/.tsx only, that every flagged extension would
run unlinted, and it called .mts/.cts "non-TypeScript".

What is actually true: .js/.jsx are linted but do not belong in the corpus;
.mjs/.cjs/.mts/.cts fall outside the globs and really would run unlinted.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

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.

5 participants