From 367a8fc1a3c089a3c2f973b2c3394f5e5f40dd2c Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 18:25:14 +0530 Subject: [PATCH 1/2] A package install, a prose-looking test fixture or a Codex shell call 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 Co-Authored-By: Claude Fable 5.2 --- docs/features/integrations/claude-code.md | 2 +- .../.claude-plugin/plugin.json | 2 +- integrations/claude-code-plugin/README.md | 2 +- .../claude-code-plugin/hooks/HOOKS.md | 5 +- .../claude-code-plugin/lib/test-gate.mjs | 40 +++++++----- .../tests/test-gate.test.mjs | 63 ++++++++++++++++--- .../codex-plugin/.codex-plugin/plugin.json | 2 +- integrations/codex-plugin/lib/test-gate.mjs | 40 +++++++----- 8 files changed, 114 insertions(+), 42 deletions(-) diff --git a/docs/features/integrations/claude-code.md b/docs/features/integrations/claude-code.md index f529f31b5b2..9f2518aabd4 100644 --- a/docs/features/integrations/claude-code.md +++ b/docs/features/integrations/claude-code.md @@ -639,7 +639,7 @@ Loom tests for src/app/router.py: .venv/bin/python -m pytest tests/test_router.p the index links no test to. A held stop costs the session one more model request, so any test run since that change lets the stop pass: a shell command that starts a test runner and finished no earlier than the newest write among the code files the session - changed. A documentation or prose file (`.md`, `.rst`, `.txt`, a changelog) written + changed. A documentation or prose file (`.md`, `.rst`, a changelog) written after the run holds nothing. The gate reads that command for a runner's name only. Which tests ran and how they went cannot be read reliably from shell commands, so that judgement stays with the agent and with CI. The plugin README lists the runners under **Stops that pass**. diff --git a/integrations/claude-code-plugin/.claude-plugin/plugin.json b/integrations/claude-code-plugin/.claude-plugin/plugin.json index 2c54f8fe797..2ba24accfef 100644 --- a/integrations/claude-code-plugin/.claude-plugin/plugin.json +++ b/integrations/claude-code-plugin/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "loom", "displayName": "ClickHouse Loom", - "version": "1.2.69", + "version": "1.2.71", "description": "Shared long-term memory and code intelligence for Claude Code, self-hosted on ClickHouse. MCP tools to save and recall decisions, preferences and corrections across sessions and teammates; lifecycle hooks that capture each session with no model call; a code index that answers where-is, who-calls and blast-radius questions with line-accurate units instead of whole-file reads.", "author": { "name": "ClickHouse" diff --git a/integrations/claude-code-plugin/README.md b/integrations/claude-code-plugin/README.md index 1ed41fb2295..25625fa9890 100644 --- a/integrations/claude-code-plugin/README.md +++ b/integrations/claude-code-plugin/README.md @@ -172,7 +172,7 @@ the duplicate, run `claude mcp remove -s user`. **Tests at edit time.** The test gate names a file's tests on the tool call that changes it, where the agent is still working on the file. For a source file they are the tests the index links to it through its name, the test map or the call graph, each of them present in the checkout, with the tests that have no known runner listed by path; for a test file, the file's own command. A file with no test to name in the checkout gets the changed functions the index links no test to instead (`the index links no test to Router::match`), worded as the index's view, because its call graph is a floor. A file is asked about once per session, at its first change, so a function changed later in the same file is not named; a file the server gave no answer for is asked about once more, at the next call that names it; at most four files are asked about per tool call. A test is named once per session, so the test you edit after its source file adds no second line. A test the tool call's own command runs is not named on the result of that run: its command stands there whole, in this checkout, so `pytest tests/test_a.py::test_one`, `docker exec app pytest tests/test_a.py` and `echo "pytest tests/test_a.py"` still get the line. -**Stops that pass.** By default the test gate holds the end of a session only when the session ran no test since its last code change. Whether a session ran the right tests, and how they went, cannot be read reliably from its shell commands: a session that runs the whole suite, compares against a stashed tree or pipes pytest through `grep` has run the tests in a way no fixed rule reads, and a gate that holds the stop on that reading holds sessions that did the work. So the stop passes, before anything is asked of the server, when the transcript holds a shell command that starts a test runner and finished no earlier than the newest write among the code files the session changed. A changed file that is documentation or prose by its name (`.md`, `.mdx`, `.rst`, `.adoc`, `.txt` other than `CMakeLists.txt` and a requirements file, or a `CHANGELOG`, `CHANGES`, `HISTORY` or `NEWS` file) is left out of that comparison, so a note written after the run holds nothing; so is a deleted file. A runner is `pytest`, `unittest`, `tox`, `nox`, `jest`, `vitest`, `mocha`, `nextest`, `rspec`, `phpunit`, `ctest` or `clickhouse-test`, or `go`, `cargo`, `npm`, `pnpm`, `yarn`, `bun`, `deno`, `make`, `mvn`, `gradle`, `dotnet`, `swift`, `bazel`, `mix`, `rake` or `node` with an argument in which `test` or `tests` follows no letter and no lower-case letter follows it (`make test-unit`, `node --test`, `gradle :app:test`, `gradlew testDebugUnitTest`, but not `npm install x@latest` or `npm install @testing-library/react`). The command's output is not read: a run that failed, ran other tests or ran in a container passes, and so does a command that only names a runner, such as `grep -rn pytest .`. A session that wrote a changed code file after its last such command, or that ran none, is held once per distinct change with the tests to run and the functions the index links no test to; a harness the list does not name is not seen, and that stop is held once too. A latest prompt that ends with "Do not run the tests" passes when the gate names tests the checkout has. With no transcript the stop is not held. A team that wants the stop held until the named tests ran on the final tree sets `LOOM_TEST_GATE=block` in the environment Claude Code starts in; the two paragraphs below describe that mode, which names nothing at edit time. +**Stops that pass.** By default the test gate holds the end of a session only when the session ran no test since its last code change. Whether a session ran the right tests, and how they went, cannot be read reliably from its shell commands: a session that runs the whole suite, compares against a stashed tree in one command or pipes pytest through `grep` has run the tests in a way no fixed rule reads, and a gate that holds the stop on that reading holds sessions that did the work. So the stop passes, before anything is asked of the server, when the transcript holds a shell command that starts a test runner and finished no earlier than the newest write among the code files the session changed. A changed file that is documentation or prose by its name (`.md`, `.mdx`, `.markdown`, `.rst`, `.adoc`, `.asciidoc`, or a `CHANGELOG`, `CHANGES`, `HISTORY` or `NEWS` file) is left out of that comparison, so a note written after the run holds nothing; so is a deleted file. A `git stash pop` in a later command than the run rewrites the changed files, so that stop is held. A runner is `pytest`, `unittest`, `tox`, `nox`, `jest`, `vitest`, `mocha`, `nextest`, `rspec`, `phpunit`, `ctest` or `clickhouse-test`, or `go`, `cargo`, `npm`, `pnpm`, `yarn`, `bun`, `deno`, `make`, `mvn`, `gradle`, `gradlew`, `dotnet`, `swift`, `bazel`, `mix`, `rake` or `node` with an argument in which `test` or `tests` follows no letter (`make test-unit`, `make testall`, `node --test`, `gradle :app:test`, `gradlew testDebugUnitTest`, but not `make latest`), or `gradle` or `gradlew` with a task in which `Test` follows a lower-case letter (`gradlew integrationTest`). A name after `install`, `uninstall`, `add`, `i`, `ci` or `get` in the same simple command is a package, not a run (`pip install -U pytest`, `npm i -D @types/jest`, `npm install @playwright/test`), and neither the task after `-x` (`gradle build -x test`) nor `test.skip` (`mvn package -Dmaven.test.skip=true`) is one. The command's output is not read: a run that failed, ran other tests or ran in a container passes, and so does a command that only names a runner, such as `grep -rn pytest .`. A session that wrote a changed code file after its last such command, or that ran none, is held once per distinct change with the tests to run and the functions the index links no test to; a harness the list does not name is not seen, and that stop is held once too. A latest prompt that ends with "Do not run the tests" passes when the gate names tests the checkout has. With no transcript the stop is not held. A team that wants the stop held until the named tests ran on the final tree sets `LOOM_TEST_GATE=block` in the environment Claude Code starts in; the two paragraphs below describe that mode, which names nothing at edit time. **Untested functions.** The index's call graph is a floor: a test may reach a function the graph holds no edge to, such as a constructor the test calls by building the object. Beside tests to run that the checkout has, the reason of a held stop therefore lists the functions as the index's view, `the index links no test to: … (the tests named here may still reach it)`. With no such test it reads `no test reaches: …` and asks for a test. diff --git a/integrations/claude-code-plugin/hooks/HOOKS.md b/integrations/claude-code-plugin/hooks/HOOKS.md index 73ac562d1cc..15e32efb9ff 100644 --- a/integrations/claude-code-plugin/hooks/HOOKS.md +++ b/integrations/claude-code-plugin/hooks/HOOKS.md @@ -358,8 +358,9 @@ detached (`lib/flush-job.mjs` holds its job shapes and delivery policy). (`testedSince`, `lastCodeChange`): the command's text is read for a runner's name only, not for which tests ran or how they went, so a run that failed, was piped or ran between `git stash` and `git stash pop` - passes, in a Claude Code transcript or a Codex rollout. With no - transcript the default holds no stop. + in the same command passes, in a Claude Code transcript or a Codex + rollout; a pop in a later command rewrites the changed files, and that + stop is held. With no transcript the default holds no stop. With LOOM_TEST_GATE=block nothing is printed at edit time, and a Claude Code stop passes only when its transcript already answers the ask to run the named tests (`runAnswered` in lib/test-gate.mjs); a Codex rollout diff --git a/integrations/claude-code-plugin/lib/test-gate.mjs b/integrations/claude-code-plugin/lib/test-gate.mjs index 8b1ea2ebe66..e1073962bc0 100644 --- a/integrations/claude-code-plugin/lib/test-gate.mjs +++ b/integrations/claude-code-plugin/lib/test-gate.mjs @@ -396,7 +396,7 @@ export function sessionScope(changed, objs, { root, cwd } = {}) { const call = o.payload || {}; if ( ["custom_tool_call", "function_call"].includes(call.type) && - ["exec", "exec_command", "shell", "apply_patch"].includes(call.name) + (rolloutShell(call.name) || call.name === "apply_patch") ) { const input = call.input ?? call.arguments; if (typeof input === "string") commands.push(input); @@ -631,14 +631,26 @@ function runsHere(command, run) { // A shell command that starts a test runner, wrapped or piped in any way: a // program `code.test_gate` names a run with or a common other one, or a // build tool with an argument in which `test` or `tests` follows no letter -// and no lower-case letter follows it (`make test-unit`, `npm run test`, -// `node --test`, `gradle :app:test`, `gradlew testDebugUnitTest`). `import -// pytest`, `pip install pytest`, `pytest.raises`, `npm install x@latest`, -// `npm install @testing-library/react` and `node scripts/attest.js` are not -// runs. A command that only mentions a runner counts: what is read is +// (`make test-unit`, `make testall`, `npm run test`, `node --test`, `gradle +// :app:test`, `gradlew testDebugUnitTest`), or Gradle with a task in which +// `Test` follows a lower-case letter (`gradlew integrationTest`). `import +// pytest`, `pytest.raises`, `make latest` and `node scripts/attest.js` are +// not runs. A command that only mentions a runner counts: what is read is // whether the session ran a test at all. -const RUNNER = - /(? CHANGELOG.test(file) || (PROSE.test(file) && !CODE_TXT.test(file)); +const isProse = (file) => CHANGELOG.test(file) || PROSE.test(file); /** The newest modification time, in epoch ms, among the code files of * `files` under `root`: a test run that finished since then saw each of diff --git a/integrations/claude-code-plugin/tests/test-gate.test.mjs b/integrations/claude-code-plugin/tests/test-gate.test.mjs index 27bedb39d70..cccc12cff89 100644 --- a/integrations/claude-code-plugin/tests/test-gate.test.mjs +++ b/integrations/claude-code-plugin/tests/test-gate.test.mjs @@ -337,6 +337,17 @@ test("Codex rollout tool calls scope the gate to paths named by this session", ( { type: "response_item", payload: { type: "message", content: "src/b.py" } }, ]; assert.deepEqual(sessionScope(DIRTY, rows, { root: ROOT }), ["src/a.py", "tests/test_a.py"]); + // The shell tool under each name the client gives it; another tool that names a path is no change. + const named = (name) => [ + { + type: "response_item", + payload: { type: "function_call", name, arguments: '{"command":["bash","-lc","sed -i s/x/y/ src/b.py"]}' }, + }, + ]; + for (const name of ["exec", "exec_command", "shell", "shell_command", "local_shell", "container.exec"]) { + assert.deepEqual(sessionScope(DIRTY, named(name), { root: ROOT }), ["src/b.py"], name); + } + assert.deepEqual(sessionScope(DIRTY, named("read_file"), { root: ROOT }), []); }); test("sidechain edits and non-assistant rows are not the session's change", () => { @@ -925,12 +936,24 @@ test("any test run that finished since the change counts, whatever it ran and ho "make unit-tests", "cargo nextest run", "tests/clickhouse-test 01234_x", + "make testacc", + "make testall", + "npm run testci", + "./gradlew integrationTest", + "gradle connectedAndroidTest", + // A run after an install, in its own simple command. + "npm ci && npm test", + "pip install -e . && pytest", + "yarn add -D jest; yarn jest", + "for i in 1 2 3; do pytest tests; done", + "npx --no-install jest", ]) { assert.equal(testedSince(bash(command, FAILED), since), true, command); assert.equal(testedSince(call("PowerShell", { command }), since), true, command); } - // A command that reads or writes a test, or installs a runner, runs none; - // neither does a build tool whose argument holds `test` inside a word. + // A command that reads or writes a test, or installs a package, runs none; + // neither does a build tool whose argument holds `test` inside a word, or + // one told to leave its tests out. for (const command of [ HEREDOC, "sed -n 1,40p tests/test_a.py", @@ -943,6 +966,19 @@ test("any test run that finished since the change counts, whatever it ran and ho "node scripts/attest.js", "npm install @testing-library/react", "go get github.com/stretchr/testify", + "npm 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/jest", + "npm uninstall jest", + "gradle build -x test", + "./gradlew build -x integrationTest", + "mvn package -Dmaven.test.skip=true", ]) { assert.equal(testedSince(bash(command, ""), since), false, command); } @@ -994,24 +1030,35 @@ test("the last code change is the most recently written code file that can be re for (const [file, at] of [ ["a.py", 1e12], ["b.py", 1e12 + 5000], - ["CMakeLists.txt", 1e12 + 6000], - ["dev-requirements.txt", 1e12 + 7000], + ["constraints.txt", 1e12 + 6000], + ["requirements/dev.txt", 1e12 + 6000], + ["tests/fixtures/expected.txt", 1e12 + 6000], + ["testdata/golden.txt", 1e12 + 6000], ["README.md", 1e12 + 9000], - ["notes.txt", 1e12 + 9000], + ["notes.markdown", 1e12 + 9000], ["guide.rst", 1e12 + 9000], + ["manual.asciidoc", 1e12 + 9000], ["CHANGELOG", 1e12 + 9000], ]) { + fs.mkdirSync(path.dirname(path.join(dir, file)), { recursive: true }); fs.writeFileSync(path.join(dir, file), "x\n"); fs.utimesSync(path.join(dir, file), new Date(at), new Date(at)); } assert.equal(lastCodeChange(dir, ["b.py", "a.py", "deleted.py"]), 1e12 + 5000); // Documentation and prose are left out, by extension or by a changelog's name. assert.equal( - lastCodeChange(dir, ["a.py", "b.py", "README.md", "notes.txt", "guide.rst", "CHANGELOG"]), + lastCodeChange(dir, ["a.py", "b.py", "README.md", "notes.markdown", "guide.rst", "manual.asciidoc", "CHANGELOG"]), 1e12 + 5000, ); - assert.equal(lastCodeChange(dir, ["a.py", "CMakeLists.txt"]), 1e12 + 6000); - assert.equal(lastCodeChange(dir, ["a.py", "dev-requirements.txt"]), 1e12 + 7000); + // A .txt file is code: a requirements file, a test fixture. + for (const file of [ + "constraints.txt", + "requirements/dev.txt", + "tests/fixtures/expected.txt", + "testdata/golden.txt", + ]) { + assert.equal(lastCodeChange(dir, ["a.py", file]), 1e12 + 6000, file); + } assert.equal(lastCodeChange(dir, ["README.md", "deleted.py"]), 0); } finally { fs.rmSync(dir, { recursive: true, force: true }); diff --git a/integrations/codex-plugin/.codex-plugin/plugin.json b/integrations/codex-plugin/.codex-plugin/plugin.json index a580f09f236..e5f3a213b07 100644 --- a/integrations/codex-plugin/.codex-plugin/plugin.json +++ b/integrations/codex-plugin/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "loom", - "version": "1.2.69", + "version": "1.2.71", "description": "Shared long-term memory and code intelligence for Codex, self-hosted on ClickHouse. MCP tools to save and recall decisions, preferences and corrections across sessions and teammates; lifecycle hooks that capture each session with no model call; a code index that answers where-is, who-calls and blast-radius questions with line-accurate units instead of whole-file reads.", "author": { "name": "ClickHouse" diff --git a/integrations/codex-plugin/lib/test-gate.mjs b/integrations/codex-plugin/lib/test-gate.mjs index 8b1ea2ebe66..e1073962bc0 100644 --- a/integrations/codex-plugin/lib/test-gate.mjs +++ b/integrations/codex-plugin/lib/test-gate.mjs @@ -396,7 +396,7 @@ export function sessionScope(changed, objs, { root, cwd } = {}) { const call = o.payload || {}; if ( ["custom_tool_call", "function_call"].includes(call.type) && - ["exec", "exec_command", "shell", "apply_patch"].includes(call.name) + (rolloutShell(call.name) || call.name === "apply_patch") ) { const input = call.input ?? call.arguments; if (typeof input === "string") commands.push(input); @@ -631,14 +631,26 @@ function runsHere(command, run) { // A shell command that starts a test runner, wrapped or piped in any way: a // program `code.test_gate` names a run with or a common other one, or a // build tool with an argument in which `test` or `tests` follows no letter -// and no lower-case letter follows it (`make test-unit`, `npm run test`, -// `node --test`, `gradle :app:test`, `gradlew testDebugUnitTest`). `import -// pytest`, `pip install pytest`, `pytest.raises`, `npm install x@latest`, -// `npm install @testing-library/react` and `node scripts/attest.js` are not -// runs. A command that only mentions a runner counts: what is read is +// (`make test-unit`, `make testall`, `npm run test`, `node --test`, `gradle +// :app:test`, `gradlew testDebugUnitTest`), or Gradle with a task in which +// `Test` follows a lower-case letter (`gradlew integrationTest`). `import +// pytest`, `pytest.raises`, `make latest` and `node scripts/attest.js` are +// not runs. A command that only mentions a runner counts: what is read is // whether the session ran a test at all. -const RUNNER = - /(? CHANGELOG.test(file) || (PROSE.test(file) && !CODE_TXT.test(file)); +const isProse = (file) => CHANGELOG.test(file) || PROSE.test(file); /** The newest modification time, in epoch ms, among the code files of * `files` under `root`: a test run that finished since then saw each of From 311bebda253826b78545353e4ed0a935b09993b9 Mon Sep 17 00:00:00 2001 From: Lareb Zafar Date: Sat, 28 Nov 2026 18:52:01 +0530 Subject: [PATCH 2/2] The test gate reads a build of the tests, a path that starts with `test` 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 Signed-off-by: Lareb Zafar --- docs/features/integrations/claude-code.md | 4 +- integrations/claude-code-plugin/README.md | 2 +- .../claude-code-plugin/hooks/HOOKS.md | 4 +- .../claude-code-plugin/lib/test-gate.mjs | 59 +++++++++----- .../tests/test-gate.test.mjs | 79 ++++++++++++++++--- integrations/codex-plugin/lib/test-gate.mjs | 59 +++++++++----- 6 files changed, 150 insertions(+), 57 deletions(-) diff --git a/docs/features/integrations/claude-code.md b/docs/features/integrations/claude-code.md index 9f2518aabd4..626b592fa67 100644 --- a/docs/features/integrations/claude-code.md +++ b/docs/features/integrations/claude-code.md @@ -639,8 +639,8 @@ Loom tests for src/app/router.py: .venv/bin/python -m pytest tests/test_router.p the index links no test to. A held stop costs the session one more model request, so any test run since that change lets the stop pass: a shell command that starts a test runner and finished no earlier than the newest write among the code files the session - changed. A documentation or prose file (`.md`, `.rst`, a changelog) written - after the run holds nothing. The gate reads that command for a runner's name only. Which tests ran and how they went cannot be read + changed. A documentation or prose file (`.md`, `.rst`, a changelog, a `.txt` file under `docs/`) + written after the run holds nothing. The gate reads that command for a runner's name only. Which tests ran and how they went cannot be read reliably from shell commands, so that judgement stays with the agent and with CI. The plugin README lists the runners under **Stops that pass**. diff --git a/integrations/claude-code-plugin/README.md b/integrations/claude-code-plugin/README.md index 25625fa9890..e2242c63915 100644 --- a/integrations/claude-code-plugin/README.md +++ b/integrations/claude-code-plugin/README.md @@ -172,7 +172,7 @@ the duplicate, run `claude mcp remove -s user`. **Tests at edit time.** The test gate names a file's tests on the tool call that changes it, where the agent is still working on the file. For a source file they are the tests the index links to it through its name, the test map or the call graph, each of them present in the checkout, with the tests that have no known runner listed by path; for a test file, the file's own command. A file with no test to name in the checkout gets the changed functions the index links no test to instead (`the index links no test to Router::match`), worded as the index's view, because its call graph is a floor. A file is asked about once per session, at its first change, so a function changed later in the same file is not named; a file the server gave no answer for is asked about once more, at the next call that names it; at most four files are asked about per tool call. A test is named once per session, so the test you edit after its source file adds no second line. A test the tool call's own command runs is not named on the result of that run: its command stands there whole, in this checkout, so `pytest tests/test_a.py::test_one`, `docker exec app pytest tests/test_a.py` and `echo "pytest tests/test_a.py"` still get the line. -**Stops that pass.** By default the test gate holds the end of a session only when the session ran no test since its last code change. Whether a session ran the right tests, and how they went, cannot be read reliably from its shell commands: a session that runs the whole suite, compares against a stashed tree in one command or pipes pytest through `grep` has run the tests in a way no fixed rule reads, and a gate that holds the stop on that reading holds sessions that did the work. So the stop passes, before anything is asked of the server, when the transcript holds a shell command that starts a test runner and finished no earlier than the newest write among the code files the session changed. A changed file that is documentation or prose by its name (`.md`, `.mdx`, `.markdown`, `.rst`, `.adoc`, `.asciidoc`, or a `CHANGELOG`, `CHANGES`, `HISTORY` or `NEWS` file) is left out of that comparison, so a note written after the run holds nothing; so is a deleted file. A `git stash pop` in a later command than the run rewrites the changed files, so that stop is held. A runner is `pytest`, `unittest`, `tox`, `nox`, `jest`, `vitest`, `mocha`, `nextest`, `rspec`, `phpunit`, `ctest` or `clickhouse-test`, or `go`, `cargo`, `npm`, `pnpm`, `yarn`, `bun`, `deno`, `make`, `mvn`, `gradle`, `gradlew`, `dotnet`, `swift`, `bazel`, `mix`, `rake` or `node` with an argument in which `test` or `tests` follows no letter (`make test-unit`, `make testall`, `node --test`, `gradle :app:test`, `gradlew testDebugUnitTest`, but not `make latest`), or `gradle` or `gradlew` with a task in which `Test` follows a lower-case letter (`gradlew integrationTest`). A name after `install`, `uninstall`, `add`, `i`, `ci` or `get` in the same simple command is a package, not a run (`pip install -U pytest`, `npm i -D @types/jest`, `npm install @playwright/test`), and neither the task after `-x` (`gradle build -x test`) nor `test.skip` (`mvn package -Dmaven.test.skip=true`) is one. The command's output is not read: a run that failed, ran other tests or ran in a container passes, and so does a command that only names a runner, such as `grep -rn pytest .`. A session that wrote a changed code file after its last such command, or that ran none, is held once per distinct change with the tests to run and the functions the index links no test to; a harness the list does not name is not seen, and that stop is held once too. A latest prompt that ends with "Do not run the tests" passes when the gate names tests the checkout has. With no transcript the stop is not held. A team that wants the stop held until the named tests ran on the final tree sets `LOOM_TEST_GATE=block` in the environment Claude Code starts in; the two paragraphs below describe that mode, which names nothing at edit time. +**Stops that pass.** By default the test gate holds the end of a session only when the session ran no test since its last code change. Whether a session ran the right tests, and how they went, cannot be read reliably from its shell commands: a session that runs the whole suite, compares against a stashed tree in one command or pipes pytest through `grep` has run the tests in a way no fixed rule reads, and a gate that holds the stop on that reading holds sessions that did the work. So the stop passes, before anything is asked of the server, when the transcript holds a shell command that starts a test runner and finished no earlier than the newest write among the code files the session changed. A changed file that is documentation or prose by its name is left out of that comparison, so a note written after the run holds nothing; so is a deleted file. Such a name ends in `.md`, `.mdx`, `.markdown`, `.rst`, `.adoc` or `.asciidoc`, or is `CHANGELOG`, `CHANGES`, `HISTORY` or `NEWS`. A `.txt` file is one when it has one of those four names or is `README.txt`, `LICENSE.txt`, `NOTICE.txt` or `AUTHORS.txt`, or lies under a `docs` or `doc` directory with no `requirements` or `constraints` in its path below it (`docs/releases/5.2.txt`); any other `.txt` file is code, as a requirements file or a test fixture is. A `git stash pop` in a later command than the run rewrites the changed files, so that stop is held. A runner is `pytest`, `unittest`, `tox`, `nox`, `jest`, `vitest`, `mocha`, `nextest`, `rspec`, `phpunit`, `ctest` or `clickhouse-test`, or `go`, `cargo`, `npm`, `pnpm`, `yarn`, `bun`, `deno`, `make`, `mvn`, `gradle`, `gradlew`, `dotnet`, `swift`, `bazel`, `mix`, `rake` or `node` with an argument in which `test` or `tests` follows no letter and no lower-case letter follows it (`make test-unit`, `node --test`, `gradle :app:test`, `gradlew testDebugUnitTest`, but not `make latest`, `go vet ./internal/testutil/...` or `cargo build -p testcontainers`); or `make`, `npm`, `pnpm`, `yarn`, `bun` or `rake` with a target or a script whose name starts with `test` (`make testall`, `npm run testci`); or `gradle` or `gradlew` with a task that ends in `Test` after a lower-case letter (`gradlew integrationTest`, but not `gradlew compileTestJava`). A name after `install`, `uninstall`, `add`, `i`, `ci`, `get`, `remove`, `rm`, `update`, `upgrade`, `download` or `require` in the same simple command is a package, not a run (`pip install -U pytest`, `npm i -D @types/jest`, `yarn remove jest`), and neither the word after `-x` (`gradle build -x test`) nor `test.skip` (`mvn package -Dmaven.test.skip=true`) is one. A backslash at a line's end joins the next line to the command. Two shapes are misread: a build tool's target that has a verb's name hides the run after it, so `make install test` and `mvn clean install test` are taken for no run and that stop is held once; and a target that only builds counts when its name reads as a run (`gradlew assembleAndroidTest`, `make testdata`). The command's output is not read: a run that failed, ran other tests or ran in a container passes, and so does a command that only names a runner, such as `grep -rn pytest .`. A session that wrote a changed code file after its last such command, or that ran none, is held once per distinct change with the tests to run and the functions the index links no test to; a harness the list does not name is not seen, and that stop is held once too. A latest prompt that ends with "Do not run the tests" passes when the gate names tests the checkout has. With no transcript the stop is not held. In a Codex rollout the session's changes are read from `apply_patch` and from the shell tool under each of its names (`exec`, `exec_command`, `shell`, `shell_command`, `container.exec`), so a rollout that changed a file through any of them is held, with `LOOM_TEST_GATE=block` too. A team that wants the stop held until the named tests ran on the final tree sets `LOOM_TEST_GATE=block` in the environment Claude Code starts in; the two paragraphs below describe that mode, which names nothing at edit time. **Untested functions.** The index's call graph is a floor: a test may reach a function the graph holds no edge to, such as a constructor the test calls by building the object. Beside tests to run that the checkout has, the reason of a held stop therefore lists the functions as the index's view, `the index links no test to: … (the tests named here may still reach it)`. With no such test it reads `no test reaches: …` and asks for a test. diff --git a/integrations/claude-code-plugin/hooks/HOOKS.md b/integrations/claude-code-plugin/hooks/HOOKS.md index 15e32efb9ff..d2316599c28 100644 --- a/integrations/claude-code-plugin/hooks/HOOKS.md +++ b/integrations/claude-code-plugin/hooks/HOOKS.md @@ -348,7 +348,9 @@ detached (`lib/flush-job.mjs` holds its job shapes and delivery policy). At Stop, with uncommitted changes this session made in a loom-indexed repo (dirty paths the transcript shows an edit tool targeted or a shell command named, written since the session's first row; a tree left dirty - before the session gates nothing), it sends the change's paths, hunk + before the session gates nothing; in a Codex rollout the calls read are + `apply_patch` and the shell tool under each name `rolloutShell` takes, + in either mode), it sends the change's paths, hunk ranges and function names only (`diffHeaders`) to code.test_gate for its obligations and blocks the stop once per distinct change with a reason naming them. By default a stop passes, and asks the server nothing, when diff --git a/integrations/claude-code-plugin/lib/test-gate.mjs b/integrations/claude-code-plugin/lib/test-gate.mjs index e1073962bc0..5457eb9f899 100644 --- a/integrations/claude-code-plugin/lib/test-gate.mjs +++ b/integrations/claude-code-plugin/lib/test-gate.mjs @@ -629,29 +629,41 @@ function runsHere(command, run) { } // A shell command that starts a test runner, wrapped or piped in any way: a -// program `code.test_gate` names a run with or a common other one, or a -// build tool with an argument in which `test` or `tests` follows no letter -// (`make test-unit`, `make testall`, `npm run test`, `node --test`, `gradle -// :app:test`, `gradlew testDebugUnitTest`), or Gradle with a task in which -// `Test` follows a lower-case letter (`gradlew integrationTest`). `import -// pytest`, `pytest.raises`, `make latest` and `node scripts/attest.js` are -// not runs. A command that only mentions a runner counts: what is read is +// program `code.test_gate` names a run with or a common other one; a build +// tool with an argument in which `test` or `tests` follows no letter and no +// lower-case letter follows it (`make test-unit`, `npm run test`, `node +// --test`, `gradle :app:test`, `gradlew testDebugUnitTest`); a tool that runs +// a target or a script by its name, with a name that starts with `test` +// (`make testall`, `npm run testci`); or Gradle with a task that ends in +// `Test` after a lower-case letter (`gradlew integrationTest`). `import +// pytest`, `pytest.raises`, `make latest`, `go vet ./internal/testutil/...`, +// `cargo build -p testcontainers` and `gradlew compileTestJava` are not +// runs. A command that only mentions a runner counts: what is read is // whether the session ran a test at all. // -// After a package manager's verb earlier in the simple command the name is a -// package: `pip install -U pytest`, `npm i -D @types/jest`, `uv add --dev -// pytest`, `go get github.com/stretchr/testify`. A flag is no verb: `npx -// --no-install jest` runs. -const FETCHED = String.raw`\s(?:(?:un)?install|add|i|ci|get)\s[^\n;|&]*`; -// The task after Gradle's `-x` is left out of the build: `gradle build -x -// test`. Maven's `-Dmaven.test.skip=true` runs none either (`(?!\.skip)`). +// After one of these verbs earlier in the simple command the name is a +// package: `pip install -U pytest`, `npm i -D @types/jest`, `yarn remove +// jest`, `go get github.com/stretchr/testify`. A flag is no verb: `npx +// --no-install jest` and `docker run --rm app pytest` run. A build tool's +// target of a verb's name hides the run after it: `make install test` is +// read as none. +const FETCHED = String.raw`\s(?:(?:un)?install|add|i|ci|get|remove|rm|update|upgrade|download|require)\s[^\n;|&]*`; +// What a build tool is told to leave out is no run, for every tool of the +// list: the word after `-x`, where Gradle takes a task to exclude (`gradle +// build -x test`), and `test.skip`, Maven's property (`mvn package +// -Dmaven.test.skip=true`). const LEFT_OUT = String.raw`\s-x\s+\S*`; const RUNNER = new RegExp( String.raw`(? RUNNER.test(command.replace(/\\\n/g, "")); + /** True for the name of a Codex rollout's shell tool, under any of the names * `normalizeToolName` folds onto Bash. */ const rolloutShell = (name) => name === "exec" || normalizeToolName(name) === "Bash"; @@ -686,7 +698,7 @@ export function testedSince(objs, since) { if (o?.type === "response_item") { const call = o.payload || {}; if (/_output$/.test(call.type)) done.set(call.call_id, at); - else if (rolloutShell(call.name) && RUNNER.test(rolloutCommand(call))) { + else if (rolloutShell(call.name) && startsRunner(rolloutCommand(call))) { runs.push(call.call_id); } continue; @@ -698,7 +710,7 @@ export function testedSince(objs, since) { o.type === "assistant" && b?.type === "tool_use" && ["Bash", "PowerShell"].includes(normalizeToolName(b.name)) && - RUNNER.test(commandText(b.input)) + startsRunner(commandText(b.input)) ) { runs.push(b.id); } @@ -707,11 +719,16 @@ export function testedSince(objs, since) { return runs.some((id) => !(done.get(id) < since)); } -// Documentation and prose by name: a test run answers no change to one. -// A `.txt` file is code: a requirements file, a build list, a test fixture. +// Documentation and prose by name: a test run answers no change to one. A +// `.txt` file is code (a requirements file, a build list, a test fixture) +// unless its name or a `docs` directory above it says prose: `CHANGES.txt`, +// `docs/releases/5.2.txt`. A requirements or a constraints file under `docs` +// stays code. const PROSE = /\.(?:md|mdx|markdown|rst|adoc|asciidoc)$/i; const CHANGELOG = /(?:^|\/)(?:CHANGELOG|CHANGES|HISTORY|NEWS)$/; -const isProse = (file) => CHANGELOG.test(file) || PROSE.test(file); +const PROSE_TXT = + /(?:^|\/)(?:changelog|changes|history|news|readme|license|notice|authors|docs?\/(?!.*(?:requirements|constraints)).*)\.txt$/i; +const isProse = (file) => CHANGELOG.test(file) || PROSE.test(file) || PROSE_TXT.test(file); /** The newest modification time, in epoch ms, among the code files of * `files` under `root`: a test run that finished since then saw each of diff --git a/integrations/claude-code-plugin/tests/test-gate.test.mjs b/integrations/claude-code-plugin/tests/test-gate.test.mjs index cccc12cff89..9a90c8395a9 100644 --- a/integrations/claude-code-plugin/tests/test-gate.test.mjs +++ b/integrations/claude-code-plugin/tests/test-gate.test.mjs @@ -337,14 +337,15 @@ test("Codex rollout tool calls scope the gate to paths named by this session", ( { type: "response_item", payload: { type: "message", content: "src/b.py" } }, ]; assert.deepEqual(sessionScope(DIRTY, rows, { root: ROOT }), ["src/a.py", "tests/test_a.py"]); - // The shell tool under each name the client gives it; another tool that names a path is no change. + // The shell tool under each name `normalizeToolName` folds onto Bash for a function call; another tool that + // names a path is no change. const named = (name) => [ { type: "response_item", payload: { type: "function_call", name, arguments: '{"command":["bash","-lc","sed -i s/x/y/ src/b.py"]}' }, }, ]; - for (const name of ["exec", "exec_command", "shell", "shell_command", "local_shell", "container.exec"]) { + for (const name of ["exec", "exec_command", "shell", "shell_command", "container.exec"]) { assert.deepEqual(sessionScope(DIRTY, named(name), { root: ROOT }), ["src/b.py"], name); } assert.deepEqual(sessionScope(DIRTY, named("read_file"), { root: ROOT }), []); @@ -947,13 +948,18 @@ test("any test run that finished since the change counts, whatever it ran and ho "yarn add -D jest; yarn jest", "for i in 1 2 3; do pytest tests; done", "npx --no-install jest", + "docker run --rm app pytest", + "pip install -e . \\\n && pytest", + // A line continuation joins the run to its tool. + "make \\\n test", ]) { assert.equal(testedSince(bash(command, FAILED), since), true, command); assert.equal(testedSince(call("PowerShell", { command }), since), true, command); } - // A command that reads or writes a test, or installs a package, runs none; - // neither does a build tool whose argument holds `test` inside a word, or - // one told to leave its tests out. + // A command that reads or writes a test, or installs, removes or updates a + // package, runs none; neither does a build tool whose argument holds `test` + // inside a word or at the start of a path's or a package's name, one that + // builds the tests, or one told to leave them out. for (const command of [ HEREDOC, "sed -n 1,40p tests/test_a.py", @@ -976,9 +982,35 @@ test("any test run that finished since the change counts, whatever it ran and ho "uv add --dev pytest", "npm i -D @types/jest", "npm uninstall jest", + "npm 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 \\\n pytest", + "npm install --save-dev \\\n jest \\\n vitest", + "go 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", "gradle build -x test", "./gradlew build -x integrationTest", + "./gradlew compileTestJava", + "./gradlew :app:compileDebugUnitTestKotlin", + "./gradlew processTestResources", + "gradle build -PskipTests", + "gradle assemble -DskipTests", "mvn package -Dmaven.test.skip=true", + // A build tool's target of a verb's name hides the run after it. + "make install test", + "make ci test", + "mvn clean install test", ]) { assert.equal(testedSince(bash(command, ""), since), false, command); } @@ -1034,6 +1066,10 @@ test("the last code change is the most recently written code file that can be re ["requirements/dev.txt", 1e12 + 6000], ["tests/fixtures/expected.txt", 1e12 + 6000], ["testdata/golden.txt", 1e12 + 6000], + ["docs/requirements.txt", 1e12 + 6000], + ["docs/releases/5.2.txt", 1e12 + 9000], + ["CHANGES.txt", 1e12 + 9000], + ["README.txt", 1e12 + 9000], ["README.md", 1e12 + 9000], ["notes.markdown", 1e12 + 9000], ["guide.rst", 1e12 + 9000], @@ -1045,17 +1081,27 @@ test("the last code change is the most recently written code file that can be re fs.utimesSync(path.join(dir, file), new Date(at), new Date(at)); } assert.equal(lastCodeChange(dir, ["b.py", "a.py", "deleted.py"]), 1e12 + 5000); - // Documentation and prose are left out, by extension or by a changelog's name. - assert.equal( - lastCodeChange(dir, ["a.py", "b.py", "README.md", "notes.markdown", "guide.rst", "manual.asciidoc", "CHANGELOG"]), - 1e12 + 5000, - ); - // A .txt file is code: a requirements file, a test fixture. + // Documentation and prose are left out: by extension, by a changelog's name, and a .txt file by a note's + // name or under a docs directory. + for (const file of [ + "README.md", + "notes.markdown", + "guide.rst", + "manual.asciidoc", + "CHANGELOG", + "docs/releases/5.2.txt", + "CHANGES.txt", + "README.txt", + ]) { + assert.equal(lastCodeChange(dir, ["a.py", "b.py", file]), 1e12 + 5000, file); + } + // Any other .txt file is code: a requirements file, also under docs, a test fixture. for (const file of [ "constraints.txt", "requirements/dev.txt", "tests/fixtures/expected.txt", "testdata/golden.txt", + "docs/requirements.txt", ]) { assert.equal(lastCodeChange(dir, ["a.py", file]), 1e12 + 6000, file); } @@ -1151,6 +1197,17 @@ test("the hook holds the stop of a session that ran no test since its last code assert.equal(await stop("d-ruled-out", no, ""), ""); assert.match(await stop("never-ran", [change]), /"decision":"block".*pytest tests\/test_a\.py/); assert.equal(await stop("never-ran", [change]), ""); + // A Codex rollout that changed the file through its shell tool is held in either mode, under each name of + // that tool; a call of another tool that names the file is no change. + const rollout = (name) => [ + { + type: "response_item", + payload: { type: "function_call", name, arguments: '{"command":"sed -i s/1/2/ src/a.py"}' }, + }, + ]; + assert.match(await stop("codex-block", rollout("shell_command")), /"decision":"block"/); + assert.match(await stop("codex-default", rollout("shell_command"), ""), /"decision":"block"/); + assert.equal(await stop("codex-other-tool", rollout("read_file")), ""); // An untracked file whose name git would quote or a trim would cut does not hide the tree's age. const odd = process.platform === "win32" ? " naïve.txt" : ' na"ï\tve.txt'; fs.writeFileSync(path.join(dir, odd), "x\n"); diff --git a/integrations/codex-plugin/lib/test-gate.mjs b/integrations/codex-plugin/lib/test-gate.mjs index e1073962bc0..5457eb9f899 100644 --- a/integrations/codex-plugin/lib/test-gate.mjs +++ b/integrations/codex-plugin/lib/test-gate.mjs @@ -629,29 +629,41 @@ function runsHere(command, run) { } // A shell command that starts a test runner, wrapped or piped in any way: a -// program `code.test_gate` names a run with or a common other one, or a -// build tool with an argument in which `test` or `tests` follows no letter -// (`make test-unit`, `make testall`, `npm run test`, `node --test`, `gradle -// :app:test`, `gradlew testDebugUnitTest`), or Gradle with a task in which -// `Test` follows a lower-case letter (`gradlew integrationTest`). `import -// pytest`, `pytest.raises`, `make latest` and `node scripts/attest.js` are -// not runs. A command that only mentions a runner counts: what is read is +// program `code.test_gate` names a run with or a common other one; a build +// tool with an argument in which `test` or `tests` follows no letter and no +// lower-case letter follows it (`make test-unit`, `npm run test`, `node +// --test`, `gradle :app:test`, `gradlew testDebugUnitTest`); a tool that runs +// a target or a script by its name, with a name that starts with `test` +// (`make testall`, `npm run testci`); or Gradle with a task that ends in +// `Test` after a lower-case letter (`gradlew integrationTest`). `import +// pytest`, `pytest.raises`, `make latest`, `go vet ./internal/testutil/...`, +// `cargo build -p testcontainers` and `gradlew compileTestJava` are not +// runs. A command that only mentions a runner counts: what is read is // whether the session ran a test at all. // -// After a package manager's verb earlier in the simple command the name is a -// package: `pip install -U pytest`, `npm i -D @types/jest`, `uv add --dev -// pytest`, `go get github.com/stretchr/testify`. A flag is no verb: `npx -// --no-install jest` runs. -const FETCHED = String.raw`\s(?:(?:un)?install|add|i|ci|get)\s[^\n;|&]*`; -// The task after Gradle's `-x` is left out of the build: `gradle build -x -// test`. Maven's `-Dmaven.test.skip=true` runs none either (`(?!\.skip)`). +// After one of these verbs earlier in the simple command the name is a +// package: `pip install -U pytest`, `npm i -D @types/jest`, `yarn remove +// jest`, `go get github.com/stretchr/testify`. A flag is no verb: `npx +// --no-install jest` and `docker run --rm app pytest` run. A build tool's +// target of a verb's name hides the run after it: `make install test` is +// read as none. +const FETCHED = String.raw`\s(?:(?:un)?install|add|i|ci|get|remove|rm|update|upgrade|download|require)\s[^\n;|&]*`; +// What a build tool is told to leave out is no run, for every tool of the +// list: the word after `-x`, where Gradle takes a task to exclude (`gradle +// build -x test`), and `test.skip`, Maven's property (`mvn package +// -Dmaven.test.skip=true`). const LEFT_OUT = String.raw`\s-x\s+\S*`; const RUNNER = new RegExp( String.raw`(? RUNNER.test(command.replace(/\\\n/g, "")); + /** True for the name of a Codex rollout's shell tool, under any of the names * `normalizeToolName` folds onto Bash. */ const rolloutShell = (name) => name === "exec" || normalizeToolName(name) === "Bash"; @@ -686,7 +698,7 @@ export function testedSince(objs, since) { if (o?.type === "response_item") { const call = o.payload || {}; if (/_output$/.test(call.type)) done.set(call.call_id, at); - else if (rolloutShell(call.name) && RUNNER.test(rolloutCommand(call))) { + else if (rolloutShell(call.name) && startsRunner(rolloutCommand(call))) { runs.push(call.call_id); } continue; @@ -698,7 +710,7 @@ export function testedSince(objs, since) { o.type === "assistant" && b?.type === "tool_use" && ["Bash", "PowerShell"].includes(normalizeToolName(b.name)) && - RUNNER.test(commandText(b.input)) + startsRunner(commandText(b.input)) ) { runs.push(b.id); } @@ -707,11 +719,16 @@ export function testedSince(objs, since) { return runs.some((id) => !(done.get(id) < since)); } -// Documentation and prose by name: a test run answers no change to one. -// A `.txt` file is code: a requirements file, a build list, a test fixture. +// Documentation and prose by name: a test run answers no change to one. A +// `.txt` file is code (a requirements file, a build list, a test fixture) +// unless its name or a `docs` directory above it says prose: `CHANGES.txt`, +// `docs/releases/5.2.txt`. A requirements or a constraints file under `docs` +// stays code. const PROSE = /\.(?:md|mdx|markdown|rst|adoc|asciidoc)$/i; const CHANGELOG = /(?:^|\/)(?:CHANGELOG|CHANGES|HISTORY|NEWS)$/; -const isProse = (file) => CHANGELOG.test(file) || PROSE.test(file); +const PROSE_TXT = + /(?:^|\/)(?:changelog|changes|history|news|readme|license|notice|authors|docs?\/(?!.*(?:requirements|constraints)).*)\.txt$/i; +const isProse = (file) => CHANGELOG.test(file) || PROSE.test(file) || PROSE_TXT.test(file); /** The newest modification time, in epoch ms, among the code files of * `files` under `root`: a test run that finished since then saw each of