Leave out of a task-bench fix a change Haiku makes to a PHP or JavaScript test that PHPUnit or node --test finds by its name #729
@@ -2,6 +2,7 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
- task-bench leaves out of a fix a change Haiku makes to a PHP test named `*Test.php` or a JavaScript or TypeScript test that `node --test` finds by a name such as `*-test.js`, and plants no bug in such a file.
|
||||
- `chunk-preflight` names the next release's items that have no `Touches:` list, where the release holds other items, and the worker of the next item's chunk has one subagent write the lists before its chunk, so other chunks can start beside it. `rank_todo.py --check` warns of such items, still exiting 0.
|
||||
- Technical principles: a function keeps a copy of an argument it retains, and a size limit counts every cell the code allocates, empty ones too.
|
||||
- larv-review's security pass and stability-reviewer now check that the doc beside a new secret or token names what the credential can reach, such as the other repositories its owning account can use, not only what the change uses it for.
|
||||
|
||||
@@ -7,9 +7,10 @@ import typing
|
||||
|
||||
from failure import Failure
|
||||
from task_bench.bugs import go_bugs, php_bugs, python_bugs, rust_bugs, typescript_bugs
|
||||
from mutate_changes.changed_lines import is_test, STRYKER
|
||||
from task_bench.framework_tests import is_test_file
|
||||
from task_bench.bugs.planted_mutant import Mutant
|
||||
from mutate_changes.tool_process import Run
|
||||
from mutate_changes.changed_lines import STRYKER
|
||||
|
||||
# A place as `larv-review places` prints it: `<path>:<line>` in backticks.
|
||||
PLACE = re.compile(r"`([^`\s:]+):\d+`")
|
||||
@@ -43,7 +44,7 @@ def language_of(path: str, languages: tuple[Language, ...] = LANGUAGES) -> Langu
|
||||
def place_files(places: str) -> list[str]:
|
||||
"""The files that hold a place in what `larv-review places` prints and are in a language of LANGUAGES, test files left out, in
|
||||
the order of their paths."""
|
||||
return sorted({path for path in PLACE.findall(places) if language_of(path) and not is_test(path)})
|
||||
return sorted({path for path in PLACE.findall(places) if language_of(path) and not is_test_file(path)})
|
||||
|
||||
|
||||
def killed_mutants(top: str, files: list[str], run: Run, jobs: int, languages: tuple[Language, ...] = LANGUAGES) -> list[Mutant] | Failure:
|
||||
|
||||
@@ -39,6 +39,9 @@ class PlaceFilesTest(unittest.TestCase):
|
||||
def test_names_none_where_the_places_name_only_test_files_or_another_suffix(self):
|
||||
self.assertEqual(place_files("- `tests/test_geo.py:3` `load`\n- `geo_test.py:3` `load`\n- `notes.pyc:1` `x`\n"), [])
|
||||
|
||||
def test_names_none_where_the_places_name_only_php_or_javascript_files_that_phpunit_or_node_test_finds(self):
|
||||
self.assertEqual(place_files("- `src/PickTest.php:3` `load`\n- `src/pick-test.js:3` `load`\n- `src/Pick.php:3` `load`\n"), ["src/Pick.php"])
|
||||
|
||||
|
||||
class DrawnTest(unittest.TestCase):
|
||||
MUTANTS = [mutant("a.go", line) for line in range(1, 40)]
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
"""Which files PHPUnit and `node --test` find as tests by their names, beyond the ones `mutate_changes.changed_lines.is_test` tells.
|
||||
`is_test` stays as it is: changing it would change what `mutate-changes` skips."""
|
||||
import posixpath
|
||||
import re
|
||||
|
||||
from mutate_changes.changed_lines import is_test
|
||||
|
||||
# The suffixes `node --test` runs: JavaScript, and TypeScript where Node strips the types; not `.jsx` or `.tsx`, which it doesn't find.
|
||||
NODE_SUFFIXES = (".cjs", ".cts", ".js", ".mjs", ".mts", ".ts")
|
||||
# PHPUnit's default suffix, wherever the file stands; node --test's `*-test`, `*_test`, `test-*` and `test` stems, in each of its
|
||||
# suffixes. node --test's `*.test.*` is `is_test`'s already.
|
||||
FRAMEWORK_NAME = re.compile(rf".*Test\.php|(?:.*[-_]test|test|test-.*)(?:{'|'.join(re.escape(suffix) for suffix in NODE_SUFFIXES)})")
|
||||
|
||||
|
||||
def is_test_file(path: str) -> bool:
|
||||
"""Whether path is a test by its name or folder alone, as `is_test`, PHPUnit or `node --test` tells it."""
|
||||
return is_test(path) or bool(FRAMEWORK_NAME.fullmatch(posixpath.basename(path)))
|
||||
@@ -37,8 +37,9 @@ No model judges anything: the bench runs programs, and reads Haiku's own stream.
|
||||
- Check. The test command runs over the planted tree with each file that is no test as Haiku left it; a fix passes where it exits 0.
|
||||
A test Haiku changed, removed or added doesn't count, and neither does a file under a `testdata` folder. The bench
|
||||
tells a test by its path: a folder named `test`, `tests` or `__tests__`, or a file named `test_*.py`, `*_test.py`,
|
||||
`*_test.go`, `*.test.*` or `*.spec.*`. A test of any other name counts as code, such as `src/PickTest.php` or
|
||||
`src/pick-test.js`, so Haiku's change to it stands. In a Rust file, each inline `#[cfg(test)]` module stands as the planted
|
||||
`conftest.py`, `*_test.go`, `*.test.*`, `*.spec.*` or `*Test.php`. A `.js`, `.cjs`, `.mjs`, `.ts`, `.cts` or `.mts` file
|
||||
named `*-test.*`, `*_test.*`, `test-*.*` or `test.*`, as `node --test` finds it, is a test too. A test of any other name counts
|
||||
as code, so Haiku's change to it stands. In a Rust file, each inline `#[cfg(test)]` module stands as the planted
|
||||
file has it, and the rest is as Haiku left it. So does each `#[cfg(test)] mod name;` the planted file declares, and the file it
|
||||
names: `name.rs` or `name/mod.rs`, in the declaring file's folder or in a folder named for that file without `.rs`. Where
|
||||
Haiku's file lacks a module of the planted file's or a declaration as written there, or the planted file has inline modules and Haiku's cannot be
|
||||
|
||||
@@ -11,7 +11,7 @@ import typing
|
||||
from task_bench.rust_test_modules import declared, homes, with_tests_of
|
||||
from mutate_changes.tool_process import failed, Ran
|
||||
from failure import Failure
|
||||
from mutate_changes.changed_lines import is_test
|
||||
from task_bench.framework_tests import is_test_file
|
||||
from task_bench.api_proxy import PORT
|
||||
|
||||
MODEL = "claude-haiku-5-5"
|
||||
@@ -206,7 +206,7 @@ def keep_rust_tests(planted_file: str, target: str) -> None:
|
||||
|
||||
def of_tests(path: str, rust_tests: typing.AbstractSet[str] = frozenset()) -> bool:
|
||||
"""Whether path is a test by its path alone, or one of rust_tests."""
|
||||
return is_test(path) or "testdata" in pathlib.PurePath(path).parts or path in rust_tests
|
||||
return is_test_file(path) or "testdata" in pathlib.PurePath(path).parts or path in rust_tests
|
||||
|
||||
|
||||
def rust_test_files(tree: str) -> set[str] | None:
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import unittest
|
||||
|
||||
from task_bench.framework_tests import is_test_file
|
||||
|
||||
|
||||
class IsTestFileTest(unittest.TestCase):
|
||||
def test_tells_a_php_file_ending_in_Test_wherever_it_stands(self):
|
||||
for path in ("src/PickTest.php", "PickTest.php", "app/Models/UserTest.php"):
|
||||
with self.subTest(path=path):
|
||||
self.assertTrue(is_test_file(path))
|
||||
|
||||
def test_tells_the_names_node_test_finds_in_each_suffix_it_runs(self):
|
||||
for path in ("src/pick-test.js", "pick_test.mjs", "src/test-pick.cjs", "src/test.ts", "a/b/pick-test.ts", "test.js", "x_test.mts", "test-x.cts"):
|
||||
with self.subTest(path=path):
|
||||
self.assertTrue(is_test_file(path))
|
||||
|
||||
def test_tells_what_is_test_tells(self):
|
||||
for path in ("src/pick.test.js", "src/pick.spec.ts", "tests/pick.php", "a/__tests__/pick.js", "pick_test.go", "test_pick.py"):
|
||||
with self.subTest(path=path):
|
||||
self.assertTrue(is_test_file(path))
|
||||
|
||||
def test_takes_other_code_as_code(self):
|
||||
for path in ("src/Pick.php", "src/Tester.php", "src/PickTest.phps", "src/pick.js", "src/latest.js", "src/pick-tests.js", "src/pickTest.js", "src/test-pick.json", "src/pick-test.jsx", "src/pick-test.tsx", "src/contest.ts", "src/Test.php.bak"):
|
||||
with self.subTest(path=path):
|
||||
self.assertFalse(is_test_file(path))
|
||||
@@ -775,6 +775,12 @@ class CheckedTreeTest(unittest.TestCase):
|
||||
checked_tree(planted, copy, str(self.root / "check"))
|
||||
self.assertEqual(self.held("check"), {".git/HEAD": "ref", "calc.go": "fixed", "calc_test.go": "tests", "sub/new.go": "new", "sub/old_test.go": "old tests"})
|
||||
|
||||
def test_takes_a_php_or_javascript_test_by_the_name_its_framework_finds_it_by_as_planted(self):
|
||||
planted = self.tree("planted", {"src/Pick.php": "bug", "src/PickTest.php": "tests", "src/pick.js": "bug", "src/pick-test.js": "tests", "src/gone-test.mjs": "old tests"})
|
||||
copy = self.tree("copy", {"src/Pick.php": "fixed", "src/PickTest.php": "rewritten", "src/pick.js": "fixed", "src/pick-test.js": "rewritten", "src/new_test.ts": "added"})
|
||||
checked_tree(planted, copy, str(self.root / "check"))
|
||||
self.assertEqual(self.held("check"), {"src/Pick.php": "fixed", "src/PickTest.php": "tests", "src/gone-test.mjs": "old tests", "src/pick-test.js": "tests", "src/pick.js": "fixed"})
|
||||
|
||||
def test_takes_the_files_under_testdata_as_planted_since_a_test_reads_what_it_expects_there(self):
|
||||
planted = self.tree("planted", {"calc.go": "bug", "testdata/want.golden": "3", "sub/testdata/gone.golden": "4", "testdata.go": "code"})
|
||||
copy = self.tree("copy", {"calc.go": "fixed", "testdata/want.golden": "-1", "testdata/added.golden": "5", "testdata.go": "fixed"})
|
||||
|
||||
@@ -3824,3 +3824,20 @@ Read most (opens and searches):
|
||||
|
||||
- `principles/technical-principles.md` 7
|
||||
- `agents/stability-reviewer.md` 1
|
||||
|
||||
## Reading cost, chunk 5820700697e2, finished 2026-11-27T20:51:07Z
|
||||
|
||||
109952 new input tokens before the first commit.
|
||||
|
||||
Read most (opens and searches):
|
||||
|
||||
- `bin/test_rank_todo.py` 12
|
||||
- `bin/chunk_preflight/test_chunk_preflight.py` 7
|
||||
- `README.md` 5
|
||||
- `bin/chunk_preflight/main.py` 5
|
||||
- `bin/rank_todo.py` 5
|
||||
- `CLAUDE.md` 4
|
||||
- `bin/chunk_preflight/facts.py` 4
|
||||
- `bin/plan/touches.py` 4
|
||||
- `bin/plan_store/todo_md.py` 4
|
||||
- `bin/loop_claude/loop/chunk_windows.py` 3
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||
| 477 | 0.17.0 | | question | **Rewrite `## Goals` and `## Audience` for a setup others install and run apart from their own `~/.claude`.** | 1 | 1 | 2 | 2 | 2 | | 0.0 |
|
||||
| 478 | 0.17.0 | | question | **Name the project, its repo and its two commands, today proposed as `do-release` and `do-epic`.** | 1 | 1 | 2 | 2 | 1 | | 0.0 |
|
||||
| 544 | 0.17.0 | | | **Leave out of a `task-bench` fix a change Haiku makes to a PHP or JavaScript test that PHPUnit or `node --test` finds by a name `is_test` does not know.** | 2 | 2 | 1 | 3 | 3 | 1.1 by 1 | 0.4 |
|
||||
| 480 | 0.18.0 | | owner | **Resolve every path the tools use in one module: the release root (the folder the running code ships in), the config folder, the state folder and the Claude home. Then only that module names `~/.claude`, and the loop still runs from `~/.claude`.** | 3 | 2 | 3 | 6 | 6 | 1.6 by 3, code health by 3 | 2.4 |
|
||||
| 481 | 0.18.0 | 480 | owner | **Put the release's tools on `PATH` for every session the loop starts and every hook it runs, name them bare in the prose in place of `~/.claude/bin/<tool>`, and refuse the old spelling in new prose.** | 3 | 2 | 3 | 6 | 6 | 1.4 by 2, code health by 2 | 1.6 |
|
||||
| 482 | 0.19.0 | 478, 481 | owner | **Install the setup with `uv tool install` from a release tag, with `do-release` and `do-epic` on `PATH`, and replace `deploy-release` with `do-release self-update`.** | 3 | 2 | 3 | 6 | 7 | 1.6 by 4, 1.3 by 3 | 1.3 |
|
||||
@@ -113,12 +112,6 @@ Part of the standalone-install plan lilleman approved on 2026-11-20. `do-release
|
||||
|
||||
Part of the standalone-install plan lilleman approved on 2026-11-20. Later items say `do-release` and `do-epic` for the names this item picks. The names set the install folders, such as `~/.config/do-release/`, so items 482, 485 and 496, and every item they block, wait for them.
|
||||
|
||||
### 544. Leave out of a `task-bench` fix a change Haiku makes to a PHP or JavaScript test that PHPUnit or `node --test` finds by a name `is_test` does not know.
|
||||
|
||||
PHPUnit finds a test by `*Test.php`, wherever it stands, and `node --test` also by `*-test.js`, `*_test.js`, `test-*.js` and `test.js`, with `.ts`, `.mjs` and `.cjs` alike. `mutate_changes.changed_lines.is_test` tells a test by a folder named `test`, `tests` or `__tests__`, or by a name such as `*.test.*`, so `src/PickTest.php` and `src/pick-test.js` count as code. `checked_tree` in `bin/task_bench/runs.py` then takes such a file as Haiku left it, so a fix that edits or deletes the failing test passes, at both sides alike, and `place_files` in `bin/task_bench/bugs/plant.py` may hand the file to the mutation tool as code. The help's Check paragraph says so.
|
||||
|
||||
Recommended: tell these names as tests inside task-bench, for a `.php` file and for the suffixes Stryker covers, and keep `is_test` as it is, since changing it would change what `mutate-changes` skips; item 539 does the same for Rust. A product-owner finding on item 527's chunk raised this.
|
||||
|
||||
### 480. Resolve every path the tools use in one module: the release root (the folder the running code ships in), the config folder, the state folder and the Claude home. Then only that module names `~/.claude`, and the loop still runs from `~/.claude`.
|
||||
|
||||
Part of the standalone-install plan lilleman approved on 2026-11-20. `do-release` and `do-epic` stand for the names item 478 picks. Today about 160 references in some 40 modules name `~/.claude`; `bin/loop_state/paths.py` holds a few. This item changes no behaviour.
|
||||
|
||||
Reference in New Issue
Block a user