diff --git a/CHANGELOG.md b/CHANGELOG.md index cab74fbc..6de37e6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- `larv-review ruling-base` now finds the last measured commit when run in a subfolder of a checkout. Before, it found no change to the comprehension history there and fell back to the merge base. - `score-outcomes` now counts each finished chunk's later fixes: the later chunks on the default branch that fixed code it shipped, each a defect that review let through. A later chunk counts where a change of it rewrites or removes lines that `git blame` traces to the earlier chunk: its whole change where it ships a `todo.md` item marked `defect` or `security`, or one of its round commits whose title counts both a 🔴 and a finding a reviewer marked `[misread]`. Each finished item shows the count beside its guessed scores, and a new list, after the misread findings, names the chunks that fixed each one, newest first. `routing-figures.md` shows the mean per rung, over the chunks whose later fixes are known, in a new column of the routed-chunks table. To find them, loop-claude now reads each archived project's checkout, and the figures name each project whose default branch it could not read. - `loop-claude` now opens every message it prints with the machine's local time, as in `2026-10-28 11:46:01`, so you can see when each happened, such as how long a question has waited. A message of several lines, such as a question, carries the time on its first line only. The `retrying at …` time of a usage-limit wait now also shows seconds, and no longer names the zone. - larv-review now gives each review pass at most two rounds per chunk, where it gave three and then asked for more, and no longer asks: the fixes answering a pass's second round merge once the gate passes. rule-hook's new `round-cap` rule refuses a round commit that would take a pass past round 2, such as `Answer stability round 3: …`, and takes no override. It counts the pass's earlier round commits on the branch, so a third commit titled round 2 is refused too. `larv-review round-count` marks a pass at two rounds as at the cap. diff --git a/bin/larv_review/history_changes.py b/bin/larv_review/history_changes.py index 782e9a3b..b39bc104 100644 --- a/bin/larv_review/history_changes.py +++ b/bin/larv_review/history_changes.py @@ -1,5 +1,5 @@ from failure import Failure -from git_repo import file_at, full_history, git +from git_repo import file_at, full_history, git, top from comprehension_history import HISTORY, HistoryChange @@ -7,24 +7,28 @@ def history_changes(default: str) -> list[HistoryChange] | Failure: """Each merged change on the default branch that touched the history, newest first.""" if partial := full_history(): return partial - commits = git("log", "--first-parent", "--format=%H", default, "--", HISTORY) + # HISTORY names the file from the checkout's top, and git reads a path from the directory it runs in. + root = top() + if isinstance(root, Failure): + return root + commits = git("log", "--first-parent", "--format=%H", default, "--", HISTORY, cwd=root) if isinstance(commits, Failure): return commits changes = [] for commit in commits.split(): - change = history_change(commit) + change = history_change(commit, root) if isinstance(change, Failure): return change changes.append(change) return changes -def history_change(commit: str) -> HistoryChange | Failure: - """The history before and after commit. A merge commit counts as one change, against its first parent.""" - before = file_at(f"{commit}^1", HISTORY) +def history_change(commit: str, root: str) -> HistoryChange | Failure: + """The history before and after commit, read in the checkout at root. A merge commit counts as one change, against its first parent.""" + before = file_at(f"{commit}^1", HISTORY, root) if isinstance(before, Failure): return before - after = file_at(commit, HISTORY) + after = file_at(commit, HISTORY, root) if isinstance(after, Failure): return after return HistoryChange(commit, before, after) diff --git a/bin/larv_review/test_larv_review.py b/bin/larv_review/test_larv_review.py index ccebdc6a..fd83d9f8 100644 --- a/bin/larv_review/test_larv_review.py +++ b/bin/larv_review/test_larv_review.py @@ -364,15 +364,15 @@ class LarvReviewTool(unittest.TestCase): self.git("add", name) self.git("commit", "-q", "--allow-empty", "-m", title) - def run_tool(self, *args): - return subprocess.run([sys.executable, str(TOOL), *args], capture_output=True, cwd=self.checkout, env=self.env, text=True) + def run_tool(self, *args, cwd=None): + return subprocess.run([sys.executable, str(TOOL), *args], capture_output=True, cwd=cwd or self.checkout, env=self.env, text=True) def seats_file(self, text, name="seats.md"): path = self.checkout.parent / name path.write_text(textwrap.dedent(text)) return str(path) - def test_takes_the_merge_base_until_a_merged_change_records_an_entry(self): + def test_takes_the_merge_base_until_a_merged_change_records_an_entry_and_finds_it_from_a_subfolder(self): start = self.git("rev-parse", "HEAD").strip() self.commit("work") ran = self.run_tool("ruling-base") @@ -381,8 +381,12 @@ class LarvReviewTool(unittest.TestCase): self.commit("Merge a scoring run", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING}) self.git("push", "-q", "origin", "HEAD:main") measured = self.git("rev-parse", "HEAD").strip() + self.commit("Fix a typo", {"docs/comprehension-history.md": "# Comprehension history\n\n" + SCORING + "\nA note.\n"}) + self.git("push", "-q", "origin", "HEAD:main") self.git("switch", "-q", "chunk") self.assertEqual(self.run_tool("ruling-base").stdout.splitlines()[0], measured) + (self.checkout / "docs").mkdir(exist_ok=True) + self.assertEqual(self.run_tool("ruling-base", cwd=self.checkout / "docs").stdout.splitlines()[0], measured) def test_counts_rounds_on_this_branch_alone(self): self.commit("Answer stability round 1: a") diff --git a/docs/reading-cost.md b/docs/reading-cost.md index 0f51e3c2..dbccf37e 100644 --- a/docs/reading-cost.md +++ b/docs/reading-cost.md @@ -911,3 +911,11 @@ Read most (opens and searches): ## Reading cost, chunk da9c1fcad7c3, finished 2026-10-28T17:55:08Z 139037 new input tokens before the first commit. + +## Reading cost, chunk 07c647e1636e, finished 2026-10-28T21:51:38Z + +105188 new input tokens before the first commit. + +Read most (opens and searches): + +- `rules/todo-items.md` 1 diff --git a/todo.md b/todo.md index 9cb3a628..19c1d9f0 100644 --- a/todo.md +++ b/todo.md @@ -12,7 +12,6 @@ | ID | Release | Blocked by | Exempt | Item | L | E | I | R | S | Moves | Score | |---|---|---|---|---|---|---|---|---|---|---|---| -| 251 | 0.4.0 | | defect | **Have larv-review read the comprehension history's changes from the checkout's top, so it still finds them when run in a subfolder of a checkout.** | 1 | 1 | 3 | 3 | 1 | 1.1 by 2 | 3.4 | | 243 | 0.4.0 | | owner | **Show every loop-claude on the machine that waits for the human in one terminal app, and let the human answer each one there, `/talk` included.** | 4 | 2 | 3 | 7 | 6 | 1.5 by 4 | 0.9 | | 226 | 0.5.0 | | question | **Answer whether rule-hook's `run-heavy` rule should also catch a mutation run or docker build behind `uv run`, `poetry run`, `python3 -m`, `sudo`, `docker image build` and `docker compose up --build`, or narrow the `machine load:` decision's wording.** | 2 | 2 | 3 | 5 | 3 | 1.2 by 2, 1.5 by 2 | 4.0 | | 248 | 0.5.0 | | question | **Answer whether the `rule-hook:` decision should name every rule that takes no override, `repeat-read`, `reviewer-report` and `reviewer-rung`, with each one's reason.** | 1 | 2 | 1 | 2 | 1 | 1.2 by 2 | 3.3 | @@ -78,10 +77,6 @@ ## Details -### 251. Have larv-review read the comprehension history's changes from the checkout's top, so it still finds them when run in a subfolder of a checkout. - -Found while building item 247, 2026-10-28. `history_changes` in `bin/larv_review/history_changes.py` names the history by its path from the checkout's top, but git reads that path from the current directory, twice: in its `git log -- `, and in `file_at` in `bin/git_repo.py`, which lists the path with `git ls-tree -- `. Run from `bin/`, larv-review finds no change to the history instead of failing. Running git in the checkout's top, as `score-outcomes` does since item 247, reads both paths from the top. - ### 243. Show every loop-claude on the machine that waits for the human in one terminal app, and let the human answer each one there, `/talk` included. lilleman's call, 2026-10-28: with several loops running, each asks on its own terminal, so the human jumps between terminals to find which wait. On 2026-10-28 three of five loops waited on round-cap questions at once. Today `put_question` in `bin/loop_claude/cycle/interrupt.py` reads the answer with `input()`, and nothing outside that terminal sees a question.