Ask the repository that owns the path, and pin the wirings that had no test

Round four of the independent review found seven record and coverage
defects. The functional side it verified by running; these are the fixes.

- `_tracked` asked the current checkout's index, so a reviewer in a worktree
  pointing at the main checkout's committed report was told it was untracked.
  It now asks the repository that owns the path, and the guard no longer
  compares directories: any tracked file is committed evidence.
- `retrieval.py` claimed the dense index "catches up inside search". It does
  not: `_stale` is only used by `sync()` and `stats()`, so a store upgraded
  from v11 ranks an empty dense leg until `ely-eye build-dense-index` runs.
  The docstring now states that, and `doctor` already names it.
- Four wirings had no discriminating test, each proven by mutation:
  a stubbed `_tracked` (now a test uses the real git index), `copy_store`
  claiming the scratch (now a live holder blocks the copy before a byte is
  copied), `_stale` reading the atoms table (now a closed memory that loses
  its vector is owed one), and the v10/v11 to v12 `DROP VIEW` gate (now a
  hand-made v11 store is upgraded and its view body re-checked).
- The record corrected against the reviewer's measurements: the five
  mutations did not each turn one test red (M1 turned two, M3 turned two,
  `_stale` alone turned none), the pyright/mypy file set was wrong, and the
  round added seven tests rather than three.

Gates: 422 passed; ruff clean; filesize clean; audit clean; mypy 24 errors in
9 files repo-wide, equal to the 9cb46c1 baseline; pyright 0 on the nine
touched files; zero whole-line comment blocks over 157 tracked files.
This commit is contained in:
ZacharyZhang-NY committed 2026-10-10 01:59:43 -04:00
1 parent e81923f62e
commit f8a9428f5a
7 files changed
+99 -19

No files matched your search

+10 -5
View File
@@ -272,10 +272,17 @@ def write_markdown(report: dict[str, Any], destination: Path) -> None:
def _tracked(path: Path) -> bool:
"""Only committed evidence is frozen; a harness's own untracked output is fair game."""
"""Only committed evidence is frozen; a harness's own untracked output is fair game.
The question goes to the repository that owns the path, so a reviewer working in a worktree
cannot point at another checkout's committed report and be told it is untracked.
"""
owner = path.resolve().parent
return (
subprocess.run(
["git", "ls-files", "--error-unmatch", str(path)], capture_output=True, check=False
["git", "-C", str(owner), "ls-files", "--error-unmatch", path.resolve().name],
capture_output=True,
check=False,
).returncode
== 0
)
@@ -283,9 +290,7 @@ def _tracked(path: Path) -> bool:
def refuse_frozen_overwrite(destination: Path) -> None:
"""A reviewer running this in a worktree of its own must not overwrite the committed evidence."""
if destination.exists() and destination.resolve().parent == PAYLOAD.resolve().parent and _tracked(
destination
):
if destination.exists() and _tracked(destination):
raise SystemExit(
f"{destination} is a frozen report; point --report and --payload somewhere else, or "
"delete the frozen copy on purpose rather than under a harness"