Answer stability round 1: 1 🔴, 4 🟡 (0 misread); run the stranded held_at test, and test a blocked row, an edit without a detail and an ID that prefixes another

This commit is contained in:
2026-11-14 16:01:53 +01:00
parent 0cb2cbabcd
commit d6e8b7b105
4 changed files with 25 additions and 8 deletions
+3 -3
View File
@@ -160,10 +160,10 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a
- `settings_filter.py` is git's clean filter for `settings.json`: it drops `"model"` and sorts the keys. `.gitattributes` sets the filter `settings` on `settings.json`, and Install's `git config` line makes this script that filter.
- `statusline.py` renders Claude Code's status line; `settings.json` → `statusLine` runs it.
- `subagent-rung [--plan] <model> <L>` prints the Agent tool's model and effort for a subagent's task, picked by its L from the project's model, and with `--plan` never below the project's rung; `subagent-rung --help` states the rule.
- `todo-item` reads and changes a project's plan, whatever holds it: `list` prints the items in the plan's order and `show <ID>` one item's row and detail; `add …` files an item under the next free ID, `edit <ID> …` sets its cells or detail, and `move <ID> --release <version>` sets its release; `finish <ID>` removes a finished item and adds the bullet passed with `--changelog` to `CHANGELOG.md`. Each change ranks a markdown plan. `todo-item --help` states the flags.
- `todo-item` reads and changes a project's plan, whatever holds it: `list` prints the items in the plan's order and `show <ID>` one item's row and detail; `add …` files an item under the next free ID, `edit <ID> …` sets an item's cells or detail, and `move <ID> --release <version>` sets an item's release; `finish <ID>` removes a finished item and adds the bullet passed with `--changelog` to `CHANGELOG.md`. Each change ranks a markdown plan. `todo-item --help` states the flags.
- `wait-for <file> [<pattern>] [--timeout <seconds>]` waits until a file a background job writes holds a line matching the pattern, and prints it.
`bin/` is the import root: each launcher puts it on `sys.path`, so a module imports another by its path under `bin/`, such as `from claude_code.entries import parse_entry`. Each tool's package holds its tests. Beside the packages, `bin/`'s root holds only the launchers, the tools of one file with their tests, `test_env.py`, `failure.py` and `setup.cfg`. `failure.py`'s `Failure`, which modules across `bin/` return for a failed step, belongs to no single package. `branch_chunks/`, `claude_code/`, `command_lines/`, `git_cli/`, `loop_effects/`, `loop_state/`, `machine_load/`, `mattermost_dm/`, `model_routing/`, `record_store/`, `release_plan/`, `review_rules/`, `rung_replay/`, `text_files/` and `transcript_archive/` serve more than one tool.
`bin/` is the import root: each launcher puts it on `sys.path`, so a module imports another by its path under `bin/`, such as `from claude_code.entries import parse_entry`. Each tool's package holds its tests. Beside the packages, `bin/`'s root holds only the launchers, the tools of one file with their tests, `test_env.py`, `failure.py` and `setup.cfg`. `failure.py`'s `Failure`, which modules across `bin/` return for a failed step, belongs to no single package. `branch_chunks/`, `claude_code/`, `command_lines/`, `git_cli/`, `loop_effects/`, `loop_state/`, `machine_load/`, `mattermost_dm/`, `model_routing/`, `plan_store/`, `record_store/`, `release_plan/`, `review_rules/`, `rung_replay/`, `text_files/` and `transcript_archive/` serve more than one tool.
- `branch_chunks/` cuts a default branch into chunks and finds, for each, the items it shipped and the later chunks that fixed its code, for `score_outcomes` and `routing_figures`. It imports `reading_cost`'s record path.
- `command_lines/` reads a shell command: its simple commands, and a docker call's subcommand and memory limits, for `command_patterns`, `reading_cost`, `routing_figures`, `rule_hook` and `run_heavy`.
@@ -180,7 +180,7 @@ Install puts only `loop-claude` on `PATH`; call the others by their path, such a
- `plan_store/` reads and writes a project's plan through the store the project's config names (`stores.py`), with the markdown file's edits in `markdown_edits.py`. `contract.py` holds the tests every backend must pass, and `fakes.py` a plan in memory.
- `rank_todo.py`, `settings_filter.py` and `statusline.py` are tools of one file each, tested beside them.
- `record_store/` reads and writes a project's records, each through the store the project's config names (`stores.py`). `contract.py` holds the tests every backend must pass, and `fakes.py` a store in memory that the tests of other tools use.
- `release_plan/` reads `todo.md`'s items table and release versions, says which release is next and whether it is ready to cut (`release_standing.py`), and ranks the plan (`ranking.py`, with its score formula in `formula.py` and its blocker order in `blockers.py`). `goals_file.py` reads the goals file's sections, goals and goal weights, for the ranking and for `loop_claude`'s premises, and `citations.py` holds `todo.md` and `docs/decisions.md` to each other. `plan_file.py` reads, ranks, checks and writes a `todo.md`, for `larv_review`, `rank_todo.py`, `rule_hook` and `todo_item`.
- `release_plan/` reads `todo.md`'s items table and release versions, says which release is next and whether it is ready to cut (`release_standing.py`), and ranks the plan (`ranking.py`, with its score formula in `formula.py` and its blocker order in `blockers.py`). `goals_file.py` reads the goals file's sections, goals and goal weights, for the ranking and for `loop_claude`'s premises, and `citations.py` holds `todo.md` and `docs/decisions.md` to each other. `plan_file.py` ranks, checks and writes a `todo.md`, for `larv_review`, `rank_todo.py` and `rule_hook`.
- `repo_checks/` tests the repo itself.
- `review_rules/` holds the larv-review rules that several tools apply: its passes, its review folder, its round commit titles and the comprehension history's format.
- `routing_figures/` measures loop-claude's archive, and each of its projects' default branches, for loop-claude's routing calls.
+1 -1
View File
@@ -109,7 +109,7 @@ def same_origin(clone: str, checkout: str) -> Failure | None:
def clone_plan(clone: str) -> FilePlan:
"""The clone's plan, with each file ranking reads, at the paths this repo keeps them."""
"""The clone's plan, at the path this repo keeps it. ready_release only reads it; FilePlan also takes the files a write would rank it against."""
decisions, history = (FileStore(pathlib.Path(clone, path), path) for path in ("docs/decisions.md", "docs/comprehension-history.md"))
return FilePlan(pathlib.Path(clone, "todo.md"), "todo.md", pathlib.Path(clone, "README.md"), decisions, history)
+2 -1
View File
@@ -11,7 +11,7 @@ SECOND = {"Release": "0.2.0", TAGLINE: "Ship the later thing.", "L": "2", "E": "
class PlanStoreContract:
"""Runs against the store new_store returns: a plan that holds no item yet, and whose goals number a goal 1."""
"""Runs against the store new_store returns: a plan that holds no item yet. The project's goals file must hold a goal numbered 1, which the test items move."""
assertEqual: typing.Callable[..., None]
assertIsInstance: typing.Callable[..., None]
assertNotEqual: typing.Callable[..., None]
@@ -70,6 +70,7 @@ class PlanStoreContract:
id_ = self.filed(store, FIRST)
store.edit(id_, {"Release": "0.3.0"}, None)
self.assertEqual(self.items(store)[id_].release, release_of("0.3.0"))
self.assertEqual(self.items(store)[id_].detail, "")
def test_finish_removes_the_item_and_keeps_the_others(self) -> None:
store = self.new_store()
+19 -3
View File
@@ -1,4 +1,5 @@
import dataclasses
import os
import pathlib
import sys
import tempfile
@@ -71,6 +72,17 @@ class FilePlan(FilePlanContract):
self.assertEqual([note.split(": ")[0] for note in written.notes], [str(self.folder / "todo.md")])
self.assertIn("item 1 ", written.notes[0])
def test_only_the_item_written_refuses_the_write(self):
store = self.new_store()
first = self.filed(store, FIRST)
todo = self.folder / "todo.md"
todo.write_text(todo.read_text().replace("`Next ID = 2`", "`Next ID = 10`"))
self.assertEqual(self.filed(store, FIRST), 10)
todo.write_text("".join(line.replace("| 4 | 1 | 1 by 9 |", "| 4 | 10 | 1 by 9 |") if line.startswith("| 10 ") else line for line in todo.read_text().splitlines(keepends=True)))
written = store.edit(first, {"E": "2"}, None)
assert isinstance(written, stores.Written), written
self.assertIn("item 10 ", written.notes[0])
def test_a_missing_file_fails_naming_it(self):
store = self.new_store()
(self.folder / "todo.md").unlink()
@@ -104,6 +116,7 @@ class FilePlan(FilePlanContract):
self.assertEqual(store.edit(id_, {}, "### Why\n"), Failure(split))
self.assertEqual((self.folder / "todo.md").read_text(), before)
@unittest.skipIf(os.geteuid() == 0, "root writes into a read-only directory")
def test_a_file_it_cannot_write_fails_naming_it(self):
store = self.new_store()
self.folder.chmod(0o555)
@@ -140,9 +153,12 @@ class HeldAt(unittest.TestCase):
self.assertEqual(stores.held_at("origin/main", held, "/checkout", run), held.read())
def test_fails_where_the_revision_cannot_be_read(self):
def run(*args, cwd):
return Failure("no git") if args[0] == "ls-tree" else "a commit\n"
self.assertEqual(stores.held_at("origin/main", MemoryPlan(tracked="todo.md"), "/checkout", run), Failure("no git"))
if __name__ == "__main__":
unittest.main()
def test_fails_where_the_revision_cannot_be_read(self):
self.assertEqual(stores.held_at("origin/main", MemoryPlan(tracked="todo.md"), "/checkout", lambda *args, cwd: Failure("no git")), Failure("no git"))