Skip to content

Deleted tests still check the files that list them, and Playwright fixture specs run under Playwright - #4702

Merged
capy-ai[bot] merged 6 commits into
mainfrom
fix/removed-test-namers-and-playwright-fixtures
Nov 22, 2026
Merged

capy-ai[bot] merged 6 commits into
mainfrom
fix/removed-test-namers-and-playwright-fixtures

Conversation

@garrytan

@garrytan garrytan commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Deleting or renaming a test now runs the tests of files that still list it even when another test already covers it, and Playwright specs that take test from a local fixtures file run under playwright test.
Why: a deleted test could pass the local checks while a stale curation list failed after merge (#3536), and fixture-based Playwright specs went to the unit runner and failed (#4347).
Nothing to do. A repo whose specs import @playwright/test directly sees no change.

What changed
  • lib/pregate/lane-selection.ts: the "files naming it" check for a removed test (deleted, or a rename's old name) now also runs when the removed test already maps to a test through a dependencies entry or a remaining test that names its path. Those files' tests run, and a naming file with no test fails closed. A mention does not count when it sits under another directory's path (packages/b/util.test.js for a deleted test/util.test.js), and .gstack/pregate.json does not count when its only mentions are dependencies keys, listed tests beside another test that still exists, or another directory's test. A mention spelling the test's own directory always counts.
  • lib/pregate/checks/lanes.ts: a JS/TS spec counts as a Playwright spec when it takes test from a repo module built on @playwright/test (base.extend(…), mergeTests(…)), directly, aliased, through named or export * re-exports, index modules or a .js specifier naming a .ts source, up to 8 modules deep. A module that takes test from vitest, @jest/globals, bun:test or node:test keeps the unit runner even when it also uses Playwright APIs, and nothing outside the repo is read.
  • docs/pregate.md describes both rules. Tests: pregate: a removed test that maps to a test skips the files-naming-it check (pre-existing on main) #3536 cases, fail-closed and control rows in test/pregate-removed-paths.test.ts, and Run Playwright specs that use a local fixtures file under playwright test, and let a repo send chosen tests to its own runner #4347 plan rows (fixtures, export *, mergeTests, vitest-fixture and outside-the-repo controls) in test/pregate-selection.test.ts.

Rebuilt on current main from #4158 by @szsunyuan and the detection half of #4347 by @vilano93, both credited as co-authors. The runners setting proposed in #4347 is new configuration and is not included. Closes #3536.

Known limits
  • When a dependencies list holds the deleted test next to an existing non-test file, .gstack/pregate.json is not treated as still naming the deleted test, so the deletion is not refused. A later edit to that source fails only if nothing else covers it. A one-line fix follows separately.
  • A vitest fixture that also imports a Playwright API and takes test from another local vitest module, or a barrel that re-exports vitest's test next to export * of a Playwright helper, can be planned under playwright test, which then fails loudly with no tests found.
  • export { appTest as test } is not followed, so that spec keeps the unit runner, as before this change.
  • Directory matching compares path suffixes: packages/b/test/x counts as a mention of test/x (fails closed), and an unnormalized a/src/../test/x mention is missed. A one-line fix follows separately.
Security read

The test-selection change reads the repo's own .gstack/pregate.json with a JSON parse in a try/catch and reuses the existing git grep; no new process starts. The Playwright detection reads repo files through readRepoFile, which refuses symlinks that leave the repo, follows only relative specifiers that stay inside it, and stops after 8 levels. No network, auth, CI, install script or dependency change. The outside diffs were read as text only; no outside branch was fetched or run.

Issues

Refs #3536
Refs #4158
Refs #4347

Agent notes

Lane GSTA-805 for GStack Minder (GSTA-36), issue GST-3487, PR C of three. Repro on c2b4f0d: a deleted test/util.test.js mapped by dependencies to test/retry.test.js while scripts/curation.js still listed it exited 0 running only retry.test.js; a spec importing test from ./fixture planned as npx vitest run. lib/pregate/checks/lanes.ts is at 800 lines, the module-size limit.

Documentation audit

Status: current. The branch's own docs changes are accurate; no edits needed.

Scope: 6 committed files from base 7530280 to head fb4fc55 (pregate lane selection and Playwright runner detection, their tests, one changelog.d fragment, docs/pregate.md). Nothing staged, unstaged or untracked. Searched docs/TESTING_INTERNALS.md, CONTRIBUTING.md, README.md, AGENTS.md and docs/ship-policy.md for related claims.

Documentation health:

Coverage debt: none. No new command, flag or setting; both changes are behavior fixes covered in the docs/pregate.md reference. No diagram drift.

Plan: exempt: bug fixes with a repro on current main

Review: 2 full rounds (ship-4702: 9 fixes) and one read-only final review of 36a9e80 (ship-4702b, R51) granted by GStack Minder; its four second-model blockers were ruled disclosed notes by GSTA-36. The owner-ref timestamp on the rulings reads 14:15Z; the relayed message arrived at about 13:40Z.
Ruled note: lib/pregate/lane-selection.ts:171:correctness at 36a9e80 ruled by GSTA-36 (relayed from GSTA-36:2026-11-22T14:15Z) at 2026-11-22T13:41:11.005Z: a non-test sibling exempts a stale only-test dependencies entry; narrow fail-open, isTestFile fix deferred to a follow-up (approval a-c57d8232ada7)
Ruled note: lib/pregate/checks/lanes.ts:219:correctness at 36a9e80 ruled by GSTA-36 (relayed from GSTA-36:2026-11-22T14:15Z) at 2026-11-22T13:41:11.198Z: a vitest fixture or barrel that also imports Playwright can route to playwright test: a loud false red in a rare layout (approval a-2babea53cc78)
Ruled note: lib/pregate/checks/lanes.ts:203:correctness at 36a9e80 ruled by GSTA-36 (relayed from GSTA-36:2026-11-22T14:15Z) at 2026-11-22T13:41:11.385Z: export { appTest as test } is not followed, so that spec keeps the unit runner exactly as on main (approval a-76d0f2346816)
Ruled note: lib/pregate/lane-selection.ts:177:correctness at 36a9e80 ruled by GSTA-36 (relayed from GSTA-36:2026-11-22T14:15Z) at 2026-11-22T13:41:11.578Z: directory suffixes are not path identity: fail closed, fail-open only for unnormalized .. mentions; fix deferred to a follow-up (approval a-f501e9d3fd5a)

{
  "schema_version": 1,
  "pr": 4702,
  "head": "fb4fc554267a3167881366743a0ad182613e0c88",
  "version": "1.102.2.0",
  "base": "main",
  "gate": {
    "free-suite": {
      "pass": 38992,
      "fail": 0,
      "skip": 111
    }
  },
  "session_kind": "unattended",
  "run": "ship-4702b",
  "head_tree": "be705f221ea7944fbc564d44cefd93bab92d8241",
  "product_patch_id": "4799f3354ffc41e281df115c8e865c04fd0aea3f",
  "gstack_version": "1.102.2.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 101,
    "rules": "33831f8248a814fd",
    "base": "45e33b5e7b13614cb89e7d6e155e349755dd1e8f",
    "registry": "45e33b5e7b13614cb89e7d6e155e349755dd1e8f",
    "gate_scan": {
      "tagged": 0,
      "head": "fb4fc554267a3167881366743a0ad182613e0c88"
    },
    "reasons": [
      "gate-class",
      "risk:security",
      "runtime=101"
    ],
    "risk": [
      "security"
    ],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @be705f221ea7 (8 checks, current for fb4fc554267a)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/45029634876/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/45029634927/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=be705f221ea7 tests=39103 skipped=67 runs=45030589038/1 profiles=ci-reuse/free-tests heads=fb4fc554267a verified=2026-11-22T14:07:22.874Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [
      3536,
      4158,
      4347
    ],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/ and README.md (docs/pregate.md checked against the code)"
  },
  "review_loop": {
    "passes": 3,
    "blocking_found": 6,
    "deferred": 0,
    "noted": 7,
    "fixed": 9,
    "scope": "frozen",
    "rounds": 3,
    "dispatches": {
      "specialist": 9,
      "red-team": 3
    }
  },
  "ruled_notes": [
    {
      "finding": "lib/pregate/lane-selection.ts:171:correctness",
      "head": "36a9e803c8ab7f286dbf3bc9802cb0fdb9bb5858",
      "by": "GSTA-36",
      "reason": "a non-test sibling exempts a stale only-test dependencies entry; narrow fail-open, isTestFile fix deferred to a follow-up",
      "at": "2026-11-22T13:41:11.005Z",
      "approval": "a-c57d8232ada7",
      "relayed": "GSTA-36:2026-11-22T14:15Z"
    },
    {
      "finding": "lib/pregate/checks/lanes.ts:219:correctness",
      "head": "36a9e803c8ab7f286dbf3bc9802cb0fdb9bb5858",
      "by": "GSTA-36",
      "reason": "a vitest fixture or barrel that also imports Playwright can route to playwright test: a loud false red in a rare layout",
      "at": "2026-11-22T13:41:11.198Z",
      "approval": "a-2babea53cc78",
      "relayed": "GSTA-36:2026-11-22T14:15Z"
    },
    {
      "finding": "lib/pregate/checks/lanes.ts:203:correctness",
      "head": "36a9e803c8ab7f286dbf3bc9802cb0fdb9bb5858",
      "by": "GSTA-36",
      "reason": "export { appTest as test } is not followed, so that spec keeps the unit runner exactly as on main",
      "at": "2026-11-22T13:41:11.385Z",
      "approval": "a-76d0f2346816",
      "relayed": "GSTA-36:2026-11-22T14:15Z"
    },
    {
      "finding": "lib/pregate/lane-selection.ts:177:correctness",
      "head": "36a9e803c8ab7f286dbf3bc9802cb0fdb9bb5858",
      "by": "GSTA-36",
      "reason": "directory suffixes are not path identity: fail closed, fail-open only for unnormalized .. mentions; fix deferred to a follow-up",
      "at": "2026-11-22T13:41:11.578Z",
      "approval": "a-f501e9d3fd5a",
      "relayed": "GSTA-36:2026-11-22T14:15Z"
    }
  ],
  "gate_dispositions": []
}
{"head":"ee376baa00a794b6248169e2a50667323d957d97","run":"ship-4702","status":"started","review_loop":{"passes":2,"blocking_found":6,"deferred":0,"noted":6,"fixed":9,"scope":"frozen","rounds":2,"dispatches":{"specialist":6,"red-team":2}}}
{"head":"fb4fc554267a3167881366743a0ad182613e0c88","version":"1.102.2.0","gstack_version":"1.102.2.0","run":"ship-4702b","review_loop":{"passes":3,"blocking_found":6,"deferred":0,"noted":7,"fixed":9,"scope":"frozen","rounds":3,"dispatches":{"specialist":9,"red-team":3}},"depth":"full"}

Open in Capy

…pecs

A removed test that another test already covers now still runs the tests
of the files that name it, so a stale curation list fails before merge
(#3536). A spec that takes test from a local Playwright fixtures module
now runs under playwright test instead of the unit runner (#4347).
Rebuilt from #4158 and the detection half of #4347.

Co-authored-by: Yuan S. <[email protected]>
Co-authored-by: marcode <[email protected]>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 5 commits November 22, 2026 12:39
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: review-p1/specialist-batched#1 reader=specialist-batched
Review-Finding: review-p1/specialist-batched#2 reader=specialist-batched
Review-Finding: review-p1/red-team#1 reader=red-team
Review-Finding: review-v1/outside-voice#1 reader=outside-voice
Review-Finding: review-v1/outside-voice#2 reader=outside-voice
Review-Finding: review-v1/outside-voice#3 reader=outside-voice
Review-Finding: review-v1/outside-voice#4 reader=outside-voice
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: review-p2/specialist-batched#1 reader=specialist-batched
Review-Finding: review-p2/red-team#1 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pregate: a removed test that maps to a test skips the files-naming-it check (pre-existing on main)

1 participant