Repository navigation
v1.93.15.0 fix(pregate): pytest, Playwright and mixed-language runners; literals stops flagging stray digits (#3598, #3492) - #3741
Conversation
…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>
|
😎 This pull request was merged. |
E2E Evals: ✅ PASS0 executed, 0 reused rule/judge records | 0 manual accepted (unscored; no score-cache credit) | $0 rule/judge cost | reconcile exit: 0 Profile: pr / mode Rule and judge shards
Fail-closed reconciliationSliced 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 |
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
What changed
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
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
2or1in 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
lanesrunner detection,literalsconsumer matching and one note ingstack-pregate init. A repo that setsrunnerin.gstack/pregate.jsonkeeps 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
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.
python3 -m pytest,lanesasks python3 whether it can import pytest. The probe runs with a 10 s timeout from the repo root, and only exit 3 means "missing". When pytest is missing the lane isPREGATE_ENVIRONMENTnamingpytest, notPREGATE_LANE_FAILED.@playwright/testat the start of a line runs as<pm> playwright test --reporter=listfrom its nearest package. Type-only imports don't count. File arguments are passed as escaped regexes anchored to a path segment, because Playwright reads them as case-insensitive regexes. A run where every test failed and Playwright says its browsers are not installed isPREGATE_ENVIRONMENT..pygets pytest and.mjsgetsnode --test. Parts that share a runner run together.MAX_RETRIES3 → 4 control keepsPREGATE_LITERALS.Proof each bug is real
consumersOfone-character tests.GSTACK_CAPY_WRAPPER3 → 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).attempts1 → 3 on 9b29f6c..fb3b859 flagged 11 lines on main and flags 0 here. That repo is private, so its lines are left out.import+ 5,000 spaces case took 21.5 s and failed the old regex; the new one passes it in 119 ms.Security read
pytestMissingrunspython3 -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.npx,pnpm exec,yarnorbun x, the same route nested vitest and jest already use..github/workflows, setup, install or upgrade scripts. No outside code was carried over.Follow-ups (not in this PR)
GST-545 (
--remoteper-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 --runnewer-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_ENVIRONMENTend 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.speccould stand in for a failinga[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.mdconflict 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 therunnerrow ofdocs/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.tsnow 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):
detectRunnerfor one runner covering the whole selection, so a mixed.ts+.pyselection printsrunner null. For a bun repo with Playwright specs it suggestsbun test {files}, which would send those specs back to bun if copied into a policy. This is advisory text only and changes no verdict.importlines. 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.N failedwhen the summary has no failed line can miscount. This was true before this PR.docs/pregate.md, "or an operator" should list the exact continuation characters. Indocs/troubleshooting.md, theproof: "output"definition and the Playwright condition should matchdocs/pregate.md. TheconsumersOfJSDoc lists the old continuation sets.Plan Completion
Plan approved as autoplan run autoplan-20261031175645 (A1 one PR, B1
--remotedeferred 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:
Documentation debt (reference only, no how-to):
Diagram drift: none; ARCHITECTURE.md does not mention pregate.
Test plan
bun testof everytest/pregate-*.test.tsexcept regate, plus module-size-ratchet, spawnsync tripwire, bun-entry-isolation, ship-receipt-carry-pregate): 383 pass, 0 fail at 1f9a792UBI_OWNER=gsta212 gstack-pregate --stage tests --remote --spend-cap 2: 2103 tests, 0 failed, tree 160d86b94f3abun run typecheck: cleangstack-pregate clear