Skip to content

v1.93.15.0 fix(pregate): pytest, Playwright and mixed-language runners; literals stops flagging stray digits (#3598, #3492) - #3741

Merged
capy-ai[bot] merged 9 commits into
mainfrom
gsta-212-pregate-runners
Nov 2, 2026
Merged

capy-ai[bot] merged 9 commits into
mainfrom
gsta-212-pregate-runners

Conversation

@garrytan

@garrytan garrytan commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3741,
  "head": "1f9a792d3e97106fc874822613fa9bcf0b86df29",
  "version": "1.93.7.0",
  "base": "main",
  "gate": {
    "pregate-local": {
      "pass": 383,
      "fail": 0,
      "skip": 0
    }
  },
  "session_kind": "unattended",
  "head_tree": "2ccaa36d25f8736333fafb6b80c6b07edf2e48d9",
  "product_patch_id": "5b1d11699091ce2c9b0716b4be710d5ddeeffdcd",
  "gstack_version": "1.93.7.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 141,
    "rules": "b2272efd321ce7cb",
    "base": "fc292e22f5708da2e33f3edeaf641374d0144a9e",
    "registry": "fc292e22f5708da2e33f3edeaf641374d0144a9e",
    "gate_scan": {
      "tagged": 0,
      "head": "1f9a792d3e97106fc874822613fa9bcf0b86df29"
    },
    "reasons": [
      "gate-class",
      "risk:security",
      "runtime=141"
    ],
    "risk": [
      "security"
    ]
  },
  "pregate": "requires-remote cleared @2ccaa36d25f8 (1 checks, current for 1f9a792d3e97)",
  "requires_remote": [
    "pregate.json/remote_gate: remote-gate tree=2ccaa36d25f8 tests=2217"
  ],
  "issues": {
    "fixes": [
      3492,
      3598
    ],
    "refs": [
      3600,
      3629
    ],
    "flakes": [],
    "related": [
      {
        "pr": 3639,
        "author": "vilano93",
        "closes": [
          3598
        ]
      }
    ]
  },
  "docs": {
    "status": "updated",
    "scope": "docs/, README.md, AGENTS.md, CLAUDE.md, CONTRIBUTING.md (pregate chapter of docs/troubleshooting.md read in full)"
  },
  "review_loop": {
    "passes": 3,
    "blocking_found": 0,
    "deferred": 0,
    "noted": 10,
    "fixed": 3,
    "scope": "frozen",
    "fix_checks": 5,
    "dispatches": {
      "specialist": 3,
      "red-team": 2
    }
  }
}

What changed

literals (#3492): bumping a one-character constant flagged 5 unrelated lines on main; now only the constant's own line and the test that names it

literals (#3492): bumping a one-character constant flagged 5 unrelated lines on main (a comment and stray 3s in other tests). Now it flags only the constant's own line and the test that names it.

Before/after as text: literals (#3492): bumping a one-character constant flagged 5 unrelated lines on main (a comment and stray 3s in other tests); now only the constant's own line and the test that names it
--- Before · before.txt · captured output
+++ After · after.txt · captured output
+$ the same question on this branch
+2 lines flagged:
+capy/skill/gstack/scripts/install.sh:32 | set -u || GSTACK_CAPY_WRAPPER=3
+test/pregate-selection.test.ts:221 |     // A one-character value: only the file that names the constant counts; the path fragment alone  ||     expect(consumersOf(root, all, { name: 'GSTACK_CAPY_WRAP
-$ literals: who consumes GSTACK_CAPY_WRAPPER if it moves 3 -> 4? (main 3bfe566)
-5 lines flagged:
-capy/skill/gstack/scripts/install.sh:15 | #      it just cloned (GSTACK_CAPY_CLONED, the installer's `cloned` line). || #   From revision 3, `--for none` (this session runs no gstack workflow on this
-test/capy-skill-wrapper.test.ts:143 |     expect(install.last).toBe('gstack: ok 1.0.1 for=autoplan'); ||     expect(f.calls()).toEqual([`installer --root ${f.root} --for autoplan lock=1 rev=3 min=1.0.
-test/gstack-doctor.test.ts:262 |  ||     syncOn(f, { status: 'ok', message: 'pushed 3 file(s)', drainable: 0, last_drain_at: iso(60), last_push_at: iso(60) });
-test/gstack-upgrade-bin.test.ts:4 |  * names. Pinned on its machine lines (`gstack-upgrade: current|behind|upgraded`), ||  * exit codes (0 ok, 1 behind on --check, 3 refused with nothing changed) and
-test/pregate-selection.test.ts:199 |   test('exported constants with literal values are extracted; a changed one pairs old and new; funct ||     expect([...constantsIn("export const MAX = 3;\nexport c
 

Why

#3598: "pregate blamed my branch because this machine has no pytest." Pregate also sent Playwright specs to vitest, which found no tests and failed (#3629), and it gave root tests in two languages no runner at all (#3600). #3492 and gstack-evals#97 show the literals check failing clean branches over a stray 2 or 1 in an unrelated file. On gstack-evals#97 it was 11 false hits. After this change a machine gap is reported as the machine's problem, each spec runs under its own runner, and literals only flags lines that name the constant.

Blast radius

The change touches lanes runner detection, literals consumer matching and one note in gstack-pregate init. A repo that sets runner in .gstack/pregate.json keeps that runner for every file, so only repos that rely on detection see a different plan. The negative-control tests pin today's plan for a root vitest repo, a nested package with no test runner, and a declared runner (test/pregate-selection.test.ts, script ran). Literals values of two or more characters behave exactly as before.

Approvals

Approvals

Date Asked Exact words Outcome Covers Still pending
2026-10-31 Approve the plan "Pregate runner and literals fixes (GSTA-212: #3598, #3639, #3629, #3600, #3492, gstack-evals#97)" (autoplan run autoplan-20261031175645, 3 decisions) “Do it: A1, B1, C1 plus your four fold-ins (rec_hash 2592f8063bfc).” (GStack Minder, relayed by agent:jam_01M69H8P1GHZ9PV3M660EGPS8E) approved the reviewed plan (sha256 a41cf7a91228), every recommendation taken none

Source: gstack-approvals record for gsta-212-pregate-runners (display only; not an approval citation).

Summary

These are rewrites, written on current main from text-only reads of the outside diffs. No outside branch was checked out or run.

Proof each bug is real

  • Red-first tests. Before any fix, six of the new tests failed on main 5ba425a and 47 passed (decision trail row 2). They cover each bug: "a machine without pytest is PREGATE_ENVIRONMENT naming pytest, never PREGATE_LANE_FAILED", "plans pytest when python3 imports it…", "a spec importing @playwright/test runs through playwright test…", "root tests in two languages plan one group per language…", and the two consumersOf one-character tests.
  • pregate literals: false positives on incidental "2" (comments, $2, fixtures) with no allowlist route #3492 on this repo. Moving GSTACK_CAPY_WRAPPER 3 → 4 flagged 5 unrelated lines on main 3bfe566. On this branch it flags 2: the constant's own line and the test that names it (image above).
  • gstack-evals#97. attempts 1 → 3 on 9b29f6c..fb3b859 flagged 11 lines on main and flags 0 here. That repo is private, so its lines are left out.
  • Backtracking regex. The review found catastrophic backtracking in this PR's own Playwright import regex. The added import + 5,000 spaces case took 21.5 s and failed the old regex; the new one passes it in 119 ms.

Security read

  • New process spawn. pytestMissing runs python3 -c "…find_spec('pytest')…" with the lane's existing env, stdio: 'ignore' and a 10 s timeout, from the repo root. It is needed to tell "pytest missing" from "the diff failed". Pregate already runs the repo's own tests, so this adds no new trust boundary.
  • Playwright runs through npx, pnpm exec, yarn or bun x, the same route nested vitest and jest already use.
  • Nothing else. The change makes no network calls and reads no secrets or new env vars. It adds no dependency and does not touch .github/workflows, setup, install or upgrade scripts. No outside code was carried over.

Follow-ups (not in this PR)

GST-545 (--remote per-group commands), GST-546 (Playwright fixture-module detection and config grouping), GST-547 (regex escaping; mostly done here), GST-548 (two-character literal values), GST-549 (pytest via uv, poetry or a venv), GST-577 (clear --run newer-run veto, on main's code).

Credit: the pytest and mixed-root ideas came from #3639 and #3600 by @vilano93, and the Playwright idea from #3629 by @nfitzsimmons. The code here is a rewrite, so the credit is in the changelog, not in Co-authored-by trailers.

Test Coverage

Every changed code path has a new test. The added tests are pytest probe planning, pytest missing → PREGATE_ENVIRONMENT end to end, Playwright missing browsers vs a real assertion failure, Playwright summary parsing (interrupted, flaky, skipped), the one-character literals binding with a call-site rule and a true-positive control, mixed-language root split, repo-wide runner JS/TS-only, Playwright routing (nested package, commented and no-space imports, type-only imports skipped, long-whitespace input), and negative controls for unchanged plans.
Tests ran: pregate-local 383
Tests ran: remote gate (Ubicloud, us-east-a2) 2217, 0 failed, tree 2ccaa36d25f8 (merged head 1f9a792), $0.11

Pre-Landing Review

No blocking issues open. Fixed during review: Playwright file arguments were read as regexes, so a passing a1.spec could stand in for a failing a[1].spec (outside voice, blocking). Also fixed: type-only imports, probe exit codes, reading the summary's last count lines, and the backtracking import regex.
REVIEW_LOOP: passes=3 blocking_found=0 deferred=0 noted=10 fixed=3 scope=frozen fix_checks=5 dispatches=5
After main was merged in (3e499b9, one docs/pregate.md conflict between two neighboring table rows), one reviewer read feeb6a4..3e499b9. No blocking findings. A second merge of main (fc292e2, v1.93.7.0, at 1f9a792) hit one conflict in the runner row of docs/pregate.md. The fix keeps this PR's detection text and takes main's runner example, bun test --timeout=30000 {files}. One fix-check read that row and found nothing. Every other changed line is identical to the reviewed diff.
Gate edits: 1 listed, 1 read, 0 tagged (gstack-gate-diff). test/pregate-non-js.test.ts now asserts the removed "needs runner set" init note is absent. The approved plan removed that note.
Outside review: a cross-family voice (GPT) ran in Step 11 on the full diff and on the final docs range; both raised nothing blocking.

Review notes

Informational findings, noted and not fixed (below the blocking floor):

  • The no-policy starter still asks detectRunner for one runner covering the whole selection, so a mixed .ts + .py selection prints runner null. For a bun repo with Playwright specs it suggests bun test {files}, which would send those specs back to bun if copied into a policy. This is advisory text only and changes no verdict.
  • The Playwright import scan is still quadratic on a file with thousands of quote-free import lines. The comment stripper ignores strings, so a /* inside a string above the import can hide the import. Either case sends the spec to the unit runner, where it fails loudly. Neither case lets a test pass when it should fail.
  • Playwright file filters match case-insensitively by path suffix, so a same-named spec in another directory can also run (over-selection, never a skip).
  • A test that prints N failed when the summary has no failed line can miscount. This was true before this PR.
  • Docs wording: in docs/pregate.md, "or an operator" should list the exact continuation characters. In docs/troubleshooting.md, the proof: "output" definition and the Playwright condition should match docs/pregate.md. The consumersOf JSDoc lists the old continuation sets.

Plan Completion

Plan approved as autoplan run autoplan-20261031175645 (A1 one PR, B1 --remote deferred to GST-545, C1, plus four fold-ins). Every plan item shipped; the deferred items are the issues above.

Issues

Fixes #3492
Fixes #3598
Refs #3600
Refs #3629
Related: #3639 (@vilano93)

Documentation

Status: updated. Four factual corrections in two docs; no blockers.

Scope: base 3bfe566 to HEAD ae35fff (5 commits, 9 files: lib/pregate/checks/lanes.ts, lib/pregate/checks/literals.ts, lib/pregate/init-draft.ts, three pregate tests, docs/pregate.md, docs/state-root.md, the changelog.d fragment) plus the unstaged fragment edit. Audited docs/pregate.md, docs/state-root.md, the Pre-gate chapter of docs/troubleshooting.md, ARCHITECTURE.md, README.md, AGENTS.md and CLAUDE.md. No banned-terms list.

Documentation health:

  • docs/pregate.md: Updated. The missing-binary row now names python3, pytest (when python3 cannot import it) and Playwright's browsers not being installed. The classifier paragraph now names the exception for an all-failed Playwright run that reports missing browsers (missing-binary, proof output). The literals continuation rule now matches the code (previous line may end with [ or {; a continuation line may start with } or an operator).
  • docs/troubleshooting.md: Updated. The PREGATE_ENVIRONMENT entry now names the same Playwright missing-browsers exception.
  • docs/state-root.md: Current (pregate/runs// and pruning match lib/pregate/run-scratch.ts).
  • changelog.d/gsta-212-pregate-runners.md: Current (claims match the code; left for the parent).
  • README.md, ARCHITECTURE.md, AGENTS.md, CLAUDE.md: Current (nothing about runner detection).

Documentation debt (reference only, no how-to):

  • pytest import probe and the PREGATE_ENVIRONMENT fix: reference in docs/pregate.md; no how-to.
  • Playwright routing (playwright test --reporter=list, regex file filters, the missing-browsers rule): reference in docs/pregate.md and troubleshooting; no how-to for a repo mixing Playwright with vitest or jest.
  • Mixed-language root split: reference only.
  • literals one-character binding: reference in docs/pregate.md; the troubleshooting PREGATE_LITERALS entry stays generic.

Diagram drift: none; ARCHITECTURE.md does not mention pregate.

Test plan

  • pregate-local (bun test of every test/pregate-*.test.ts except regate, plus module-size-ratchet, spawnsync tripwire, bun-entry-isolation, ship-receipt-carry-pregate): 383 pass, 0 fail at 1f9a792
  • Remote gate UBI_OWNER=gsta212 gstack-pregate --stage tests --remote --spend-cap 2: 2103 tests, 0 failed, tree 160d86b94f3a
  • bun run typecheck: clean
  • windows-free-tests at 3e499b9: green (run 41327857497), cleared with gstack-pregate clear

garrytan and others added 6 commits October 31, 2026 18:19
…age roots; literals binds one-character values

A missing pytest is PREGATE_ENVIRONMENT, not the diff's failure (#3598).
Playwright specs run under playwright test, with missing browsers reported
as the machine's gap (#3629). Root tests in two languages each get their
runner, and a repo's bun/vitest/jest claims only JS/TS (#3600). literals
counts a one-character old value only in a statement naming the constant,
and a call-site name also needs the module (#3492, gstack-evals#97).

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>
…kips

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…s; pytest probe and summary read hardening

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ports detected

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…tinuation rule

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

trunk-io Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@github-actions

Copy link
Copy Markdown
Contributor

E2E Evals: ✅ PASS

[test:paid] VERDICT GREEN — lane gate/pr, attempt 1
  rule 0/0 · behavior 0/0 · judge 0/0 · quarantined 0 (0 failing the lane)
  SKIPPED 0 · INFRA 0 · INCOMPLETE 0 · unattributed 0 · ACTION REQUIRED 0
  wall 0m00s · cost $0.00

0 executed, 0 reused rule/judge records | 0 manual accepted (unscored; no score-cache credit) | $0 rule/judge cost | reconcile exit: 0

Profile: pr / mode pr; selected behaviors: 0, judges: 0. Deferred to scheduled/release coverage: 0 behaviors and 0 changed prompt files. Deferred checks did not run and receive no PR-pass credit.

Rule and judge shards
Shard Automated result Manual/unscored Executed Reused Status Cost
Fail-closed reconciliation
[test:paid] report: 1/1 slices, 0 planned shards, tier=gate, attempt 1
[test:paid] coverage: profile=pr mode=pr; selected E2E=0, judges=0
[test:paid] deferred: 0 broad behaviors, 0 changed prompts without quick live coverage; these are not PR passes
[test:paid] collector final outcomes: 0 executed, 0 reused; 0 passed, 0 failed, 0 manual accepted (unscored; no score-cache credit) (0 attempt records from 0 collectors; every record counts)
[test:paid] VERDICT GREEN — lane gate/pr, attempt 1
  rule 0/0 · behavior 0/0 · judge 0/0 · quarantined 0 (0 failing the lane)
  SKIPPED 0 · INFRA 0 · INCOMPLETE 0 · unattributed 0 · ACTION REQUIRED 0
  wall 0m00s · cost $0.00
[test:paid] exercised-path map (shadow, non-blocking): 0 MAP_GAP line(s) over 0 executed case(s) with recorded commands
[test:paid] report: every planned shard accounted and passed

Sliced lane: planner → duration-packed executors → fail-closed report. Behavior cases run a pre-registered 3-trial panel (PASS at 2/3 with no contract violation); a PASS 2/3 is shown with its failed trial, never as a clean pass. Reused results retain their original provenance and expiry.

Dispatched narrow screen (gstack-ship-queue ready --screen) of merge commit af80df19b17dea696fb53a6f2e26479f67c6a79f.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

# Conflicts:
#	docs/pregate.md
…-pregate-runners

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

# Conflicts:
#	docs/pregate.md
@github-actions github-actions Bot changed the title fix(pregate): pytest, Playwright and mixed-language runners; literals stops flagging stray digits (#3598, #3492) v1.93.15.0 fix(pregate): pytest, Playwright and mixed-language runners; literals stops flagging stray digits (#3598, #3492) Nov 2, 2026
@capy-ai
capy-ai Bot merged commit 90ccf30 into main Nov 2, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant