Repository navigation
A package install, a prose-looking test fixture or a Codex shell call under another name does not let a session end untested - #1709
Merged
Conversation
… under another name does not let a session end untested The stop check of the test gate asks whether a shell command that starts a test runner finished since the session's last code change. Four of its readings were wrong. A package install counted as a test run unless `install` stood right before the runner's name: `npm install --save-dev jest`, `pip install -U pytest`, `npm install @playwright/test`, `uv add --dev pytest`. A runner's name or a `test` argument after `install`, `uninstall`, `add`, `i`, `ci` or `get` in the same simple command is a package. That verb replaces the lookahead that rejected `testify` by its suffix and with it `make testall` and `npm run testci`, which count again. Gradle's camel-case tasks (`integrationTest`, `connectedAndroidTest`) count as runs. The task after `-x` and Maven's `test.skip` do not. A changed `.txt` file is code: a requirements or constraints file or a test fixture written after the last run holds the stop. `.markdown` and `.asciidoc` are prose. A Codex rollout's file change through `shell_command`, `local_shell` or `container.exec` is the session's change, as one through `exec`, `exec_command` or `shell` is: the scope reads the names the run check reads. The docs say that a run between `git stash` and `git stash pop` counts only when the three are one command. Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…st` and a docs `.txt` file as what they are The previous commit of this branch widened three readings of the stop check past what it meant to fix. A build tool's argument counted as a test run wherever `test` followed no letter, so `go vet ./internal/testutil/...`, `bazel build //testing/...` and `cargo build -p testcontainers` let a session end untested. The lower-case suffix is read again only for a tool that runs a target or a script by its name (`make testall`, `npm run testci`), where the name starts a word. A Gradle task counted wherever `Test` followed a lower-case letter, so `compileTestJava`, `processTestResources` and `-PskipTests` counted. The task has to end in `Test`. Every `.txt` file was code, so a release note written after the run (`docs/releases/5.2.txt`, `CHANGES.txt`) held a session that had run its tests. A `.txt` file named as a changelog, README, LICENSE, NOTICE or AUTHORS file is prose, and so is one under a `docs` or `doc` directory unless its path there holds `requirements` or `constraints`. A name after `remove`, `rm`, `update`, `upgrade`, `download` or `require` is a package too, and a backslash at a line's end joins the next line before the command is read, so `pip install \` with `pytest` on the next line is no run and `make \` with `test` on the next line is one. With `LOOM_TEST_GATE=block` a Codex rollout that changed a file through `shell_command` or `container.exec` is now held, as in the default mode: the hook test shows both. Recorded rollouts name the shell tool `exec` and `exec_command` only, so the test no longer builds a `local_shell` function call, a shape no rollout holds. The README lists the two shapes still misread: a build tool's target with a verb's name hides the run after it (`make install test`), and a target that only builds counts when its name reads as a run (`gradlew assembleAndroidTest`). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com>
Brings the branch up to main; no file of this change conflicts. Signed-off-by: Lareb Zafar <lareb.zafar@clickhouse.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This was referenced Nov 28, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #1696
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
The Claude Code and Codex plugins' test gate no longer takes a package install, removal or update (
npm install --save-dev jest,pip install -U pytest,yarn remove jest) or an excluded task (gradle build -x test) for a test run, and it countsmake testall,npm run testciand Gradle tasks such asintegrationTestas runs. A changed.txtfile is code unless it is a changelog, README or licence file or lies underdocs/, so a requirements file or a test fixture written after the last run holds the stop, and a Codex session that changed files throughshell_commandorcontainer.execis held like any other.Why
The default test gate holds the end of a session only when the session ran no test since its last code change (#1696). It reads three things for that: which shell commands start a test runner (
RUNNER), which changed files are code (isProse), and which files the session changed (sessionScope). A review of #1696 after it merged listed inputs each reading gets wrong. I ran every one through the gate's functions onmainbefore editing.Failing cases (
testedSince,lastCodeChangeandsessionScopeonmain):mainmainnpm install @playwright/test,npm install -D node-test,npm install --save-dev jest,yarn add -D jest,pnpm add -D vitest,pip install -U pytest,pip install 'pytest>=8',uv add --dev pytest,npm i -D @types/jestnpm rm jest,yarn remove jest,pnpm remove vitest,npm update jest,yarn upgrade jest,poetry update pytest,pip download pytest,composer require --dev phpunit/phpunit,pip install \withpyteston the next linegradle build -x test,mvn package -Dmaven.test.skip=truemake testacc,make testall,npm run testci,./gradlew integrationTest,gradle connectedAndroidTestrequirements/dev.txt,constraints.txt,tests/fixtures/expected.txt,testdata/golden.txtwritten after the last runguide.markdown,manual.asciidocwritten after the last runsrc/b.pywith a function call namedshell_commandorcontainer.execsrc/b.pyin scopePattern. Each rule reads one neighbouring word or one name where the fact lies elsewhere.
installis the word right before the runner's name, and never in the build-tool branch. A flag, a scope or another verb between them gets through.(?![a-z])stood in for the missing verb: it rejectsgo get …/testifyandnpm install @testing-library/reactby the letters aftertest, and with them every target whose name goes on aftertest..txtis prose by extension, with a two-name exception list for the.txtfiles that are code.Hypothesis. Read the fact where it lies.
testargument that followsinstall,uninstall,add,i,ci,get,remove,rm,update,upgrade,downloadorrequirein the same simple command is a package, in every branch ofRUNNER. The verb is a word after whitespace, sosed -i,npx --no-install jest,docker run --rm app pytestandgit config --gethold none. A backslash at a line's end is removed before the command is read, as the shell removes it.testis part of a path or a package (./internal/testutil,//pkg:testlib,-p testcontainers) and is lifted only formake,npm,pnpm,yarn,bunandrake, which run a target or a script by its name, whereteststarts a word.gradleandgradlew, a task that ends inTestafter a lower-case letter is a run. The word after-xis not, and neither istest.skip..txtfile is code unless it is named as a changelog, README, LICENSE, NOTICE or AUTHORS file, or lies under adocsordocdirectory with norequirementsorconstraintsin its path below it..markdownand.asciidocjoinPROSE.sessionScopeusesrolloutShell, the function the run check uses, plusapply_patch.Predicted before running: every input of the table flips, the tests added for them fail on
main's library and pass on this branch's, and the replay of the 29 recorded sessions does not move, because none of their 95 shell commands holds one of the verbs before a runner, a Gradle task or a.txtfile. All three held; the numbers are under Tests.What the second commit takes back. The first commit of this pull request widened three of these readings past the table, and a review of it found the inputs. On that commit, and not on
main:maingo vet ./internal/testutil/...,go build ./cmd/testserver,go generate ./testdata/...,bazel build //testing/...,bazel build //pkg:testlib,node scripts/testbed.js,cargo build -p testcontainers./gradlew compileTestJava,./gradlew :app:compileDebugUnitTestKotlin,./gradlew processTestResources,gradle build -PskipTests,gradle assemble -DskipTestsdocs/releases/5.2.txt,CHANGES.txt,CHANGELOG.txt,NEWS.txt,README.txt,LICENSE.txt,doc/guide.txtwritten after the last runThe lifted lookahead applied to every build tool and to a path as well as to a target; the Gradle rule read
Testanywhere in a task; every.txtfile was code. Each is now bound to the place the table's inputs have in common: a target of a tool that runs targets by name, the end of a task, a.txtfile outside the documentation.The wording fix: a test run between
git stashandgit stash popcounts only when the three are one command. A pop in a later command rewrites the changed files after the run, so that stop is held.HOOKS.md, the README and the docstring oftestedSincesay so. The README's runner list namesgradlew, which the pattern already held.Scope and risk
lib/test-gate.mjs(theRUNNERpattern, a one-linestartsRunnerthat removes line continuations,isProse, one condition ofsessionScope, comments), its test file, the README,HOOKS.md, the docs page, both manifests and the Codex copy of the library. No hook script, no wiring, no server code.LOOM_TEST_GATE=block.RUNNERandisProseare read only in the default mode.sessionScopeis shared: withblock, a Codex rollout that changes a file through a function call namedshell_commandorcontainer.execis now in scope and held, as one throughexec,exec_commandorshellalready is. The hook test shows that stop held in both modes and not held onmain's library; the README andHOOKS.mdsay it. Claude Code sessions are unchanged in that mode: the replay's 29 are byte-identical.exec(193,551custom_tool_callrows) orexec_command(2,053function_callrows), and the patch tool isapply_patch; both shell names are in scope onmainalready. No row is namedshell,shell_command,local_shellorcontainer.exec, and none has the typelocal_shell_call.shell_commandandcontainer.execare the namesnormalizeToolNamefolds onto Bash, built by hand in the test. Alocal_shell_callrow, which carries no name, is read by neither function, as onmain; the test no longer builds a function call of that name.make install test,make ci test,mvn clean install test,make update test), whichmaincounts; a.txtnote outsidedocs/under another name (notes.txt,TODO.txt), and a document underdocs/whose path holdsrequirementsorconstraints(docs/ref/models/constraints.txt); a Gradle task named in the plural (integrationTests), as onmain. The first is pinned by the test and listed in the README.gradlew assembleAndroidTest,make testdata,yarn workspace testbed build), listed in the README; Gradle's long form--exclude-task test;mvn test -Dmaven.test.skip=true, whose firsttestcounts. The last two are as onmain.pip install -t C:\lib\followed by a line that starts a runner reads as no run.pip installline with one runner name, 0.07 ms; a 2 KB line with 300 runner names, 0.20 ms; 200 KB ofpytestwords after onepip install, 2.0 s, the same as the first commit; 200 KB oftestawords afternpm install, 2.0 s. Reading a line continuation inside the pattern doubled that worst case, so the continuation is removed from the command first, which costs 2.9 ms on 200 KB of continued lines. No recorded command has that shape, andmain's pattern has no such case.Compatibility, rollout and rollback
mainholds 1.2.69. At this push the other open pull requests that touch the manifest hold 1.2.72 (File memory arrives with the first local read of a file #1712), 1.2.70 (The test gate touches only the edited definitions and labels every test with its evidence #1707), 1.2.69 (The format, unit and statement-shape regression checks pass #1706,main's own), 1.2.55 (Loom traces record invocation origin, outcome and benchmark context #1112), 1.2.47 (Automatic hooks retain bound session privacy #948) and 1.2.46 (Claude Code plugin hooks use the configured complete MCP endpoint #770); none holds 1.2.71.main's readings. Nothing is stored.Tests
The table's inputs, before and after. A script that calls
testedSince,lastCodeChangeandsessionScopewith every input of the first table as The test gate names an edited file's tests when it is edited, and holds the end of a session only when the session ran no test since its last code change #1696's review listed them: onmainall 25 answer as its column says, on this head all 25 answer as they should.The reviewed inputs, on three libraries. A second script with 40 commands and 16 files, the ones the review of the first commit named and the neighbours I checked them against, with the answer each should have:
mainanswers 21 of the 56 wrongly, the first commit 29, this head none. The 29 are the inputs of the second table plus the eight verbs and the two continued installs, whichmaingets wrong too.node --test integrations/claude-code-plugin/tests/test-gate.test.mjs: 48 tests, 47 pass, 1 skipped (Windows only), 0 fail. Every input of both tables is in the test's list of runs or of non-runs, withnpm ci && npm test,pip install -e . && pytest,yarn add -D jest; yarn jest,docker run --rm app pytestandmake \continued bytestas runs, andmake install test,make ci testandmvn clean install testas none. The prose test holdsdocs/releases/5.2.txt,CHANGES.txtandREADME.txtas prose anddocs/requirements.txtas code. The rollout test asserts the scope for each of five shell tool names and none for another tool; the hook test holds a rollout'sshell_commandchange in the default mode and withblock.The same test file on the earlier libraries. On
main's: four tests fail (shell_commandout of scope,make testaccnot a run,notes.markdowntaken for code, the rollout's stop not held). On the first commit's: two fail (make \continued bytestnot a run,docs/releases/5.2.txttaken for code); the run list stops at its first wrong answer, so the script above is the count.Every recorded shell command. The 95 Bash commands of the 29 recorded sessions through both libraries'
testedSince: 46 are runs onmainand the same 46 on this head.Replay of the 29 recorded sessions (two recorded benchmark runs of one coding task, the sessions with the plugin installed), with the driver and method of The test gate names an edited file's tests when it is edited, and holds the end of a session only when the session ran no test since its last code change #1696 unchanged: each recorded tool call's file changes applied to a fresh checkout, one call after another, with the recorded times, the plugin's own hook scripts started as the client starts them, a local stub for
code.test_gate, the Stop gate on the transcript as it stood at the first Stop.mainis f863640, whose plugin files equal those of today'smain; the branch is this pull request's head, replayed again after the second commit.mainLOOM_TEST_GATE=blockIn all three modes the Stop output and the edit-time lines are byte-identical per session between
mainand the head, the replayed source file equals the file the run kept in all 29 sessions, no session was replayed twice and no Stop needed a third trial. The replay shows that the change moves no recorded session. It does not exercise the fixed inputs: every recorded session ranpytestunder Claude Code, installed nothing, and changed.pyfiles and one.rstfile.Gates.
ruff format --check .,ruff check, the function-length gate,check_no_secrets.pyand every generator's--check(agent_plugin_syncincluded) pass. Biome's format check passes onintegrations/and Prettier's on the three changed Markdown files.node --checkpasses on the library, its Codex copy and the test file.claude plugin validate integrations/claude-code-plugin --profile directory --strictpasses. The mypy gate reports 5 errors, all inserver/llm/vertex_auth.py, from type stubs missing in the local environment; this change holds no Python.Not run locally. No pytest suite. I called the 24 argument-free test functions of
tests/unit/test_codex_plugin.py,test_public_copy.py,test_doc_links.pyandtest_published_links.pydirectly and none failed; the 4 that take arguments were not called. Of the other plugin test files onlyhooks-doc.test.mjswas run. Nothing was run under Codex: the survey above read recorded rollouts for their row types and tool names, and the rollout rows of the tests are built by hand.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. I ran each reported input through the functions before and after the edit, ran the changed test file against the three libraries, replayed the recorded sessions in three modes against
main, and ran the gates listed above.I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make test-unitand applicable integration results are reported by CI; a full local run is not required before pushing.docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).main; no merged migration is edited.hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version.npm --prefix frontend run build) and its tests pass, iffrontend/changed.docs/describe the system as it now is, and this description names any operator steps and wire changes.tests/unit/test_public_copy.py).git commit -s), as CONTRIBUTING.md asks.🤖 Generated with Claude Code
Note
Medium Risk
Changes default Stop-hook behavior for which shell commands count as test runs and which file edits matter; Codex rollouts using alternate shell tool names are newly subject to holds.
Overview
Tightens the default Loom test gate so package installs/removals/updates and excluded build tasks no longer count as “ran tests,” while targets like
make testall,npm run testci, and Gradle*Testtasks do. Runner detection uses a richerRUNNERregex,startsRunner(line continuations), and ignores verbs likeinstall/add/removeand-x/test.skipshapes.Prose vs code:
.txtis treated as code unless it’s a changelog/README-style name or lives underdocs/(requirements/constraints paths still count as code), with.markdownand.asciidoccounted as prose—so doc-only edits after a run don’t block the stop when real code files would.Codex:
sessionScopefollows the same shell-tool naming as run detection (rolloutShell), so edits viashell_command,container.exec, etc. enter the changed-file set and can trigger holds (includingLOOM_TEST_GATE=block). Agit stash popafter a test command (not in the same command) no longer lets the stop pass.Docs (
README,HOOKS.md, Claude Code integration page) and both plugin manifests are bumped to 1.2.71, with matching logic synced to the Codex plugin copy and expandedtest-gatetests.Reviewed by Cursor Bugbot for commit 8479adb. Bugbot is set up for automated code reviews on this repo. Configure here.