Skip to content

Fixes 31036: Playwright guardrails — enforce test anti-patterns in CI via ESLint + suppressions ratchet - #31026

Closed
ShaileshParmar11 wants to merge 25 commits into
mainfrom
claude/playwright-guardrails-gate
Closed

ShaileshParmar11 wants to merge 25 commits into
mainfrom
claude/playwright-guardrails-gate

Conversation

@ShaileshParmar11

@ShaileshParmar11 ShaileshParmar11 commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Part of #31035.

PR 1 of a series. This one adds the enforcement machinery only. It changes no test behaviour — every pre-existing violation is captured in a suppressions baseline, so the suite behaves exactly as before. The actual remediation follows in separate, reviewable PRs.

Revived 2026-08-25. This PR was parked on 08-13 pending the 2.0 release and has been rebased onto current main (509 commits). Four things changed versus the original:

  • Suppressions baseline regenerated — the 08-04 file described a 352-spec corpus; today's has 366. The stale file failed CI twice over (236 violations in new files had no entry, and entries for since-fixed violations were flagged unused).
  • Ratchet notch raised 1,446 → 1,521. Across those 509 unenforced commits no-positional-locator gained 88 sites while four other rules shrank, for +75 net. This is the ratchet's initialization, not a rise — it cannot have bound the commits that predate its own existence. corpus.test.js documents this, and the "must never rise" rule binds every PR after this one.
  • CI flake-report wiring dropped. playwright-postgresql-e2e.yml was unified into playwright-e2e-reusable.yml by ci(playwright): unify postgres/mysql e2e into a reusable workflow #31628, moving the step's anchor. scripts/aggregate-flake-report.js, its tests, and yarn flake:report still ship and run locally; only the CI upload is deferred to a follow-up.
  • Bypass-guard bug fixed. The blanket-disable grep used [^\n]*, which in a POSIX bracket expression means "not a backslash and not the letter n" — so it could not span the n in -next-line, and // eslint-disable-next-line om-playwright/justified-rule-disable passed the check meant to catch it. Now .*.

Playwright test quality was governed by prose, not by machines. A 30,000-word PLAYWRIGHT_DEVELOPER_HANDBOOK.md, three overlapping skills, and .claude/rules/frontend-playwright.md all stated rules that nothing enforced — and they had drifted out of agreement with each other and with the linter. The handbook banned .first() for years; ESLint never checked, and 1,265 uses accumulated.

This moves every guardrail into one runnable command, yarn lint:playwright, at error severity.

Type of change:

  • Improvement

High-level design:

The ratchet. ESLint 9.39's native bulk suppressions let every rule run at error from day one without fixing anything first. --suppress-all captured today's violations per file/rule; a new violation has no entry and fails CI, while legacy ones don't block. The count only ever decreases, and the suppressions file doubles as the remediation backlog.

18 rules, all error:

  • 13 eslint-plugin-playwright rules promoted (6 had zero violations and cost nothing)
  • 5 custom rules in a local plugin at playwright/eslint-rules/
Rule Catches Baseline
no-positional-locator .first() / .last() / .nth() — "not recommended" per Playwright's docs 1,265
no-blanket-test-slow test.slow() at file/describe/beforeEach scope, which hides real perf regressions 89
justified-rule-disable disabling a playwright rule without a -- <why> justification 9
require-assertion-per-test a test that only performs page interactions and verifies nothing 1
require-response-listener-before-action await waitForResponse after the triggering action 0

The last shipped with a clean baseline: all 16 real race conditions were fixed by hand rather than suppressed. Those 16 are the only test changes in this PR.

Two rules were built and then removed after measurement showed they were net-negative: no-unscoped-count-assertion (~77% false positives — it fired on the exact remediation its own error message recommended) and require-unique-entity-name (0.18% true positives; 59% of its hits were Playwright's own getByRole(…, { name }), where adding uuid() would break the locator).

Helpers ship with the rules, on the principle that a restrictive rule without an ergonomic alternative just creates a backlog that never burns down: clickAndWaitFor() makes the listener-before-action race unrepresentable, and getRowByName() / expectRowFor() scope list assertions to a test's own entity instead of by position.

Anti-drift. The handbook's rule table is now generated from eslint.config.mjs, with a --check mode in CI. A rule can no longer appear in the docs without existing in the linter — which is exactly how the two diverged before.

CI. The guardrail checks run inside ui-checkstyle.yml's existing playwright step, full-corpus. Full-corpus matters: --prune-suppressions against a partial file set deletes suppressions for unlinted files. A full lint takes ~8s.

They are folded into the existing step rather than added as a new one because CodeQL flags every run: that executes PR-authored code in this pull_request_target job as a cache-poisoning risk — a separate step adds one more for no gain in isolation, since it would run the same commands with the same privileges against the same checkout. The checks 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.

Flake measurement at zero cost. Playwright already runs retries: 1, already emits flaky status, and the JSON reporter was already enabled — that data was produced every run and discarded. scripts/aggregate-flake-report.js consumes it via yarn flake:report. The CI upload that would publish a per-shard report is not wired in this PR (see the revival note) — the script and its tests ship, and it runs locally today.

Tests:

Use cases covered

  • A new .first() / waitForTimeout / force: true in any playwright file fails CI
  • Pre-existing violations don't block, but their count can never grow
  • A stale suppression (violation fixed, entry not pruned) fails CI, forcing cleanup to be recorded
  • A blanket /* eslint-disable */ cannot silently opt a file out of all 18 rules
  • The handbook rule table drifting from the ESLint config fails CI

Unit tests

  • Added — one RuleTester suite per custom rule
  • Files: playwright/eslint-rules/tests/*.test.js (5 rule suites + plugin smoke test + corpus.test.js pinning the suppression ceiling), scripts/aggregate-flake-report.test.js
  • yarn test:eslint-rules → 7/7 pass

Backend integration tests

  • Not applicable (no backend changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable as new tests — this is test infrastructure. The only test changes are the 16 waitForResponse race fixes described above.

Manual testing performed

  1. yarn lint:playwright:full → exit 0
  2. yarn test:eslint-rules → 7/7
  3. node scripts/generate-playwright-rule-table.js --check → exit 0
  4. node --test scripts/aggregate-flake-report.test.js → 3/3
  5. Injected a .first() into a spec → CI sequence fails; reverted → passes
  6. Inflated a suppression count → lint fails with the stale-suppression error
  7. Added a blanket /* eslint-disable */ → blocked
  8. yarn tsc:playwright → 163 errors, unchanged from the pre-branch baseline

UI screen recording / screenshots:

Not applicable — no application UI changes. Test infrastructure, lint config, CI, and docs only.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: not applicable.
  • For UI changes: not applicable.
  • I have added tests and listed them above.

What follows this PR

The remediation, split by rule so each is reviewable on its own:

PR Scope Sites
2–5 no-positional-locator, split by area (utils+support / Pages / Features / Flow+PageObject) 1,341
later no-blanket-test-slow 84
later no-wait-for-timeout / no-wait-for-selector / no-force-option / no-skipped-test 83

Those PRs each modify eslint-suppressions.json, so they can be reviewed in parallel but must merge sequentially, each rebasing and re-pruning after the previous.

🤖 Generated with Claude Code

Greptile Summary

This PR introduces an ESLint-based Playwright guardrail suite, a bulk-suppression ratchet, generated documentation, race-free response-listener rewrites, and flake-report aggregation.

  • Adds five local Playwright ESLint rules with RuleTester coverage.
  • Promotes Playwright rules to blocking errors while baselining existing violations.
  • Runs full-corpus guardrail and generated-table checks in UI checkstyle.
  • Reorders response listeners before triggering actions and adds reusable locator/wait helpers.

Confidence Score: 4/5

The PR should not merge until the two custom-rule gaps are fixed, because supported test syntax and ordinary source text can bypass the new guardrails.

Chained describe suites can evade blanket-slow detection, while comments or string literals containing expect can make assertion-free tests pass the assertion rule.

Files Needing Attention: openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/no-blanket-test-slow.js; openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/require-assertion-per-test.js

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/no-blanket-test-slow.js Adds scope analysis for blanket test.slow(), but chained describe variants used by the corpus are not adequately handled or tested.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/require-assertion-per-test.js Adds assertion detection, but an unrestricted source-text search lets comments and literals bypass enforcement.
openmetadata-ui/src/main/resources/ui/eslint.config.mjs Registers the local plugin and promotes Playwright guardrails to blocking errors behind bulk suppressions.
.github/workflows/ui-checkstyle.yml Adds full-corpus rule tests, linting, suppression validation, blanket-disable detection, and generated-document checks.
openmetadata-ui/src/main/resources/ui/scripts/aggregate-flake-report.js Aggregates Playwright JSON outcomes into a compact flake report, though no checked CI invocation was found.
openmetadata-ui/src/main/resources/ui/playwright/utils/waitHelpers.ts Adds a helper that registers response listeners before clicks and validates the resulting status.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Change[Playwright or lint-config change] --> Checkstyle[UI checkstyle workflow]
  Checkstyle --> RuleTests[Custom rule unit tests]
  RuleTests --> FullLint[Full Playwright ESLint corpus]
  FullLint --> Suppressions[Bulk suppressions baseline]
  Suppressions -->|New violation or stale entry| Fail[Fail CI]
  Suppressions -->|Baseline matches| Docs[Check generated handbook table]
  Docs --> Pass[Pass guardrail gate]
Loading

Reviews (1): Last reviewed commit: "chore(playwright): set the ratchet's sta..." | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

Copilot AI review requested due to automatic review settings August 5, 2026 11:57
@github-actions

github-actions Bot commented Aug 5, 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 5, 2026
Comment thread .github/workflows/ui-checkstyle.yml Outdated
Comment on lines +301 to +309
if MATCHES=$(grep -rnE 'eslint-disable(-next-line|-line)?\s*(\*/|$)|eslint-disable[^\n]*om-playwright/justified-rule-disable' \
playwright/ --include='*.ts' --include='*.tsx'); then
echo "$MATCHES"
echo "::error::Found a blanket 'eslint-disable' (no rule list) or a disable of om-playwright/justified-rule-disable itself. Both bypass the Playwright lint guardrails entirely and are never allowed, justified or not. Disable individual rules instead, each with a justification, e.g. // eslint-disable-next-line om-playwright/no-positional-locator -- <why>."
echo "changed_files<<EOF" >> "$GITHUB_OUTPUT"
echo "$MATCHES" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
exit 1
fi

@gitar-bot gitar-bot Bot Aug 5, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Quality: CI grep guard can false-positive on prose mentioning eslint-disable

The blanket-disable guard in ui-checkstyle.yml uses grep -rnE 'eslint-disable(-next-line|-line)?\s*(\*/|$)|...' over all playwright/**/*.ts{,x}. Because the first alternative anchors only on */ or end-of-line, any .ts/.tsx line that merely ends with the literal token eslint-disable — e.g. a documentation comment or string that discusses the guardrails (exactly the kind of prose this PR itself introduces in justified-rule-disable.js, currently a .js file and thus excluded) — would match and hard-fail CI for an unrelated PR. Consider anchoring the pattern to real comment syntax (require a leading // or /* immediately before eslint-disable) to avoid tripping on non-directive text.

Require the directive to be preceded by comment-open syntax so prose ending in the word 'eslint-disable' is not matched.:

if MATCHES=$(grep -rnE '(//|/\*)\s*eslint-disable(-next-line|-line)?\s*(\*/|$)|(//|/\*)\s*eslint-disable[^
]*om-playwright/justified-rule-disable' \
     playwright/ --include='*.ts' --include='*.tsx'); then

Was this helpful? React with 👍 / 👎

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 adds CI-enforced Playwright test guardrails by promoting Playwright lint rules to error, introducing a suppressions “ratchet” baseline, and adding supporting tooling (rule-table generation + flake report aggregation) so test anti-patterns are blocked going forward without requiring immediate full remediation.

Changes:

  • Add Playwright lint “suppressions ratchet” plumbing (eslint-suppressions.json, new lint scripts, CI full-corpus step).
  • Introduce local om-playwright ESLint rules + RuleTester suites, and document the generated rule table in the handbook.
  • Fix multiple waitForResponse ordering races by registering listeners before the triggering action.

Reviewed changes

Copilot reviewed 43 out of 43 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
skills/writing-playwright-tests/SKILL.md Deprecates this skill in favor of consolidated guidance in playwright skill.
skills/test-enforcement/SKILL.md Updates required Playwright lint command to the suppressions ratchet gate.
skills/playwright/SKILL.md Updates Playwright authoring guidance + mandates lint:playwright:suppressions.
skills/playwright-validation/SKILL.md Updates validation checklist to use the suppressions ratchet lint gate.
openmetadata-ui/src/main/resources/ui/scripts/generate-playwright-rule-table.js Generates handbook rule table directly from eslint.config.mjs to prevent doc drift.
openmetadata-ui/src/main/resources/ui/scripts/aggregate-flake-report.js Aggregates Playwright JSON reporter output into a small flake summary JSON.
openmetadata-ui/src/main/resources/ui/scripts/aggregate-flake-report.test.js Adds unit tests for flake report aggregation logic.
openmetadata-ui/src/main/resources/ui/playwright/utils/waitHelpers.ts Adds clickAndWaitFor() helper to make listener-before-action ordering ergonomic.
openmetadata-ui/src/main/resources/ui/playwright/utils/scopedLocators.ts Adds helpers to avoid positional locators by scoping row selection by name.
openmetadata-ui/src/main/resources/ui/playwright/utils/user.ts Fixes a potential waitForResponse race by registering the listener before click.
openmetadata-ui/src/main/resources/ui/playwright/utils/glossary.ts Fixes a potential waitForResponse race by registering the listener before click.
openmetadata-ui/src/main/resources/ui/playwright/utils/explore.ts Removes/adjusts a waitForResponse usage to avoid the listener-after-action pattern.
openmetadata-ui/src/main/resources/ui/playwright/utils/customProperty.ts Fixes a potential waitForResponse race by registering the listener before fill.
openmetadata-ui/src/main/resources/ui/playwright/PLAYWRIGHT_DEVELOPER_HANDBOOK.md Switches to generated rule table + updates lint command and rule-level narrative.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/index.js Defines the local om-playwright ESLint plugin entry point.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/justified-rule-disable.js Adds rule requiring justifications for disabling Playwright rules and banning blanket disables.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/no-blanket-test-slow.js Adds rule banning test.slow() at file/describe/beforeEach scope.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/no-positional-locator.js Adds rule banning .first()/.last()/.nth() locator usage.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/require-assertion-per-test.js Adds rule flagging tests that only interact with the page and never assert.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/require-response-listener-before-action.js Adds rule intended to prevent listener-after-action response waits.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/tests/smoke.test.js Plugin smoke test to ensure rule exports are wired.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/tests/justified-rule-disable.test.js RuleTester coverage (plus pinned behavior) for disable-justification enforcement.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/tests/no-blanket-test-slow.test.js RuleTester coverage for blanket test.slow() detection.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/tests/no-positional-locator.test.js RuleTester coverage for positional-locator detection.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/tests/require-assertion-per-test.test.js RuleTester coverage for assertion-per-test enforcement.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/tests/require-response-listener-before-action.test.js RuleTester coverage for response-listener enforcement.
openmetadata-ui/src/main/resources/ui/playwright/eslint-rules/tests/corpus.test.js Pins suppression-total ceiling to ensure baseline only shrinks.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/UserDetails.spec.ts Fixes listener-after-action waitForResponse ordering.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/Lineage/PlatformLineage.spec.ts Fixes listener-after-action waitForResponse ordering (two sites).
openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/DomainAdvanced.spec.ts Fixes listener-after-action waitForResponse ordering.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/DataProductAndSubdomains.spec.ts Fixes listener-after-action waitForResponse ordering (two sites).
openmetadata-ui/src/main/resources/ui/playwright/e2e/Pages/DataInsight.spec.ts Fixes listener-after-action waitForResponse ordering.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Table.spec.ts Fixes listener-after-action waitForResponse ordering (two sites).
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/SSOConfiguration.spec.ts Fixes listener-after-action waitForResponse ordering.
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/Glossary/LargeGlossaryPerformance.spec.ts Fixes listener-after-action waitForResponse ordering (two sites).
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntitySummaryPanel.spec.ts Fixes listener-after-action waitForResponse ordering in setup.
openmetadata-ui/src/main/resources/ui/package.json Adds lint/test/generate/flake scripts for the guardrails system.
openmetadata-ui/src/main/resources/ui/eslint.config.mjs Wires om-playwright plugin + promotes Playwright rules to error (ratcheted by suppressions).
openmetadata-ui/src/main/resources/ui/eslint-suppressions.json Adds suppressions baseline to ratchet pre-existing violations.
openmetadata-ui/src/main/resources/ui/.prettierignore Prevents Prettier from reformatting eslint-suppressions.json (avoids tool churn).
.github/workflows/ui-checkstyle.yml Adds full-corpus guardrails step (rule tests + lint ratchet + rule-table drift check).
.github/workflows/playwright-postgresql-e2e.yml Uploads per-shard flake report artifact from existing Playwright JSON output.
.claude/rules/frontend-playwright.md Updates Playwright constraints doc to reflect the single enforced lint gate.

Comment thread .github/workflows/ui-checkstyle.yml Outdated
Comment on lines +301 to +305
if MATCHES=$(grep -rnE 'eslint-disable(-next-line|-line)?\s*(\*/|$)|eslint-disable[^\n]*om-playwright/justified-rule-disable' \
playwright/ --include='*.ts' --include='*.tsx'); then
echo "$MATCHES"
echo "::error::Found a blanket 'eslint-disable' (no rule list) or a disable of om-playwright/justified-rule-disable itself. Both bypass the Playwright lint guardrails entirely and are never allowed, justified or not. Disable individual rules instead, each with a justification, e.g. // eslint-disable-next-line om-playwright/no-positional-locator -- <why>."
echo "changed_files<<EOF" >> "$GITHUB_OUTPUT"
Comment on lines +19 to +27
docs: {
description:
'Require waitForResponse listeners to be registered before the action that triggers them',
},
schema: [],
messages: {
listenerAfterAction:
'Register the response listener before the action: `const res = page.waitForResponse(url); await locator.click(); await res;` — or use clickAndWaitFor() from playwright/utils/waitHelpers. Awaiting waitForResponse directly races the response that already fired.',
},
Comment on lines +104 to +114
// A source-text scan, not an AST walk for `expect(...)` calls:
// this deliberately also matches `expect` passed as a bare
// identifier (e.g. `await verifyRow(page, expect)`), so
// assertions delegated to a helper by reference are still seen.
const hasExpectReference = sourceCode
.getText(body)
.match(/\bexpect\b/);

if (hasExpectReference) {
continue;
}
@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 67%
67.07% (80432/119921) 51.46% (49259/95715) 52.44% (14708/28045)

@ShaileshParmar11 ShaileshParmar11 changed the title Playwright guardrails (1/N): enforce test anti-patterns in CI via ESLint + suppressions ratchet Fixes 31036: Playwright guardrails — enforce test anti-patterns in CI via ESLint + suppressions ratchet Aug 5, 2026
ShaileshParmar11 and others added 11 commits August 24, 2026 18:29
…e-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>
…ate 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.
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.
…wright 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.
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.
…load

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>
CI's changed-files checkstyle runs prettier, which the guardrail work did not.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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>
The Aug-5 baseline described a 352-spec corpus. 509 commits later the tree
has 366 specs, so the stale file failed CI twice over: 236 violations in
new files had no entry, and entries for since-fixed violations were flagged
unused.

Regenerated from scratch. Net +75 (1,446 -> 1,521): no-positional-locator
grew +88 while no-wait-for-timeout (-5), no-skipped-test (-4),
no-blanket-test-slow (-5) and no-force-option (-2) shrank organically.
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.
The ceiling was 1446, measured 2026-08-04 when this gate was authored. The
PR then sat closed from 08-13 until after the 2.0 release, and across those
509 commits of main nothing enforced these rules — the corpus gained 88
no-positional-locator sites while four other rules shrank, for +75 net.

Raise the notch to today's real number and document that this is the
ratchet's initialization, not a rise. The 'must never rise' rule binds every
PR after this one; it cannot have bound the commits that predate the gate's
existence. The burn-down PRs take it back down from here.
@gitar-bot

gitar-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 0 resolved / 2 findings

Enforces Playwright test guardrails and suppression ratchets in CI via ESLint, but requires addressing the CI grep false-positive and correcting the eslint-rules test glob pattern.

⚠️ Bug: test:eslint-rules glob misses all Playwright custom-rule tests

📄 openmetadata-ui/src/main/resources/ui/package.json:23

The new script "test:eslint-rules": "node --test eslint-rules/*.test.mjs" only matches the three top-level files in eslint-rules/ (eslint-config/openmetadata-imports/openmetadata-performance). The 7 suites this PR actually ships — corpus.test.js plus the 5 per-rule suites and smoke.test.js — live in playwright/eslint-rules/tests/*.test.js and are never executed by this command. As a result the guardrail rules' RuleTester coverage and the suppression-ceiling corpus.test.js pin never run under the documented command (the PR's "7/7 pass" claim can't come from this glob, which resolves to only 3 files), so regressions in the custom rules go undetected. Extend the glob to include the Playwright test directory and the .test.js extension.

Run both the top-level rule tests and the Playwright custom-rule test suites.
"test:eslint-rules": "node --test eslint-rules/*.test.mjs playwright/eslint-rules/tests/*.test.js",
💡 Quality: CI grep guard can false-positive on prose mentioning eslint-disable

📄 .github/workflows/ui-checkstyle.yml:301-309

The blanket-disable guard in ui-checkstyle.yml uses grep -rnE 'eslint-disable(-next-line|-line)?\s*(\*/|$)|...' over all playwright/**/*.ts{,x}. Because the first alternative anchors only on */ or end-of-line, any .ts/.tsx line that merely ends with the literal token eslint-disable — e.g. a documentation comment or string that discusses the guardrails (exactly the kind of prose this PR itself introduces in justified-rule-disable.js, currently a .js file and thus excluded) — would match and hard-fail CI for an unrelated PR. Consider anchoring the pattern to real comment syntax (require a leading // or /* immediately before eslint-disable) to avoid tripping on non-directive text.

Require the directive to be preceded by comment-open syntax so prose ending in the word 'eslint-disable' is not matched.
if MATCHES=$(grep -rnE '(//|/\*)\s*eslint-disable(-next-line|-line)?\s*(\*/|$)|(//|/\*)\s*eslint-disable[^
]*om-playwright/justified-rule-disable' \
     playwright/ --include='*.ts' --include='*.tsx'); then
🤖 Prompt for agents
Code Review: Enforces Playwright test guardrails and suppression ratchets in CI via ESLint, but requires addressing the CI grep false-positive and correcting the eslint-rules test glob pattern.

1. 💡 Quality: CI grep guard can false-positive on prose mentioning eslint-disable
   Files: .github/workflows/ui-checkstyle.yml:301-309

   The blanket-disable guard in ui-checkstyle.yml uses `grep -rnE 'eslint-disable(-next-line|-line)?\s*(\*/|$)|...'` over all `playwright/**/*.ts{,x}`. Because the first alternative anchors only on `*/` or end-of-line, any `.ts`/`.tsx` line that merely ends with the literal token `eslint-disable` — e.g. a documentation comment or string that discusses the guardrails (exactly the kind of prose this PR itself introduces in `justified-rule-disable.js`, currently a `.js` file and thus excluded) — would match and hard-fail CI for an unrelated PR. Consider anchoring the pattern to real comment syntax (require a leading `//` or `/*` immediately before `eslint-disable`) to avoid tripping on non-directive text.

   Fix (Require the directive to be preceded by comment-open syntax so prose ending in the word 'eslint-disable' is not matched.):
   if MATCHES=$(grep -rnE '(//|/\*)\s*eslint-disable(-next-line|-line)?\s*(\*/|$)|(//|/\*)\s*eslint-disable[^
   ]*om-playwright/justified-rule-disable' \
        playwright/ --include='*.ts' --include='*.tsx'); then

2. ⚠️ Bug: test:eslint-rules glob misses all Playwright custom-rule tests
   Files: openmetadata-ui/src/main/resources/ui/package.json:23

   The new script `"test:eslint-rules": "node --test eslint-rules/*.test.mjs"` only matches the three top-level files in `eslint-rules/` (eslint-config/openmetadata-imports/openmetadata-performance). The 7 suites this PR actually ships — corpus.test.js plus the 5 per-rule suites and smoke.test.js — live in `playwright/eslint-rules/tests/*.test.js` and are never executed by this command. As a result the guardrail rules' RuleTester coverage and the suppression-ceiling `corpus.test.js` pin never run under the documented command (the PR's "7/7 pass" claim can't come from this glob, which resolves to only 3 files), so regressions in the custom rules go undetected. Extend the glob to include the Playwright test directory and the `.test.js` extension.

   Fix (Run both the top-level rule tests and the Playwright custom-rule test suites.):
   "test:eslint-rules": "node --test eslint-rules/*.test.mjs playwright/eslint-rules/tests/*.test.js",

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

Comment on lines +165 to +180
const [method] = info.path;

if (method === 'describe') {
return 'blanket';
}

if (info.path.length === 1 && BLANKET_HOOK_NAMES.has(method)) {
return 'blanket';
}

if (info.path.length === 1 && OWN_SLOT_HOOK_NAMES.has(method)) {
return 'legal';
}

if (info.path.length === 1 && PER_TEST_MODIFIER_NAMES.has(method)) {
return 'legal';

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.

P1 Chained describe scopes evade detection

When a suite uses test.describe.serial(...), test.describe.parallel(...), or test.describe.only(...), the scope classifier does not reliably recognize the chained call as describe scope, allowing a blanket test.slow() to pass the CI guardrail.

Comment on lines +104 to +113
// A source-text scan, not an AST walk for `expect(...)` calls:
// this deliberately also matches `expect` passed as a bare
// identifier (e.g. `await verifyRow(page, expect)`), so
// assertions delegated to a helper by reference are still seen.
const hasExpectReference = sourceCode
.getText(body)
.match(/\bexpect\b/);

if (hasExpectReference) {
continue;

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.

P1 Text bypasses assertion detection

When an assertion-free test contains the word expect in a comment or string literal, the unrestricted source-text scan treats it as an assertion reference, causing the test to pass lint without verifying any outcome.

@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants