diff --git a/bin/git_repo.py b/bin/git_repo.py index 63bf9301..42e4232a 100644 --- a/bin/git_repo.py +++ b/bin/git_repo.py @@ -5,8 +5,18 @@ import subprocess from failure import Failure -# A -c given here outranks the checkout's own config, which may allow one transport by name; GIT_NO_LAZY_FETCH needs git 2.44. -GUARDS = [option for setting in ["core.fsmonitor=false", "log.showSignature=false", "protocol.allow=never", *(f"protocol.{name}.allow=never" for name in ("ext", "file", "git", "http", "https", "ssh"))] for option in ("-c", setting)] +# The settings a guarded call gives git as -c options. A -c outranks the checkout's own config, which may allow one transport by name. +GUARD_SETTINGS = [ + "core.fsmonitor=false", + "log.showSignature=false", + "protocol.allow=never", + "protocol.ext.allow=never", + "protocol.file.allow=never", + "protocol.git.allow=never", + "protocol.http.allow=never", + "protocol.https.allow=never", + "protocol.ssh.allow=never", +] def git(*args: str, cwd: str | None = None, timeout: float | None = None, guarded: bool = False) -> str | Failure: @@ -16,7 +26,9 @@ def git(*args: str, cwd: str | None = None, timeout: float | None = None, guarde guarded is for a checkout whose config may name a program, such as one rule-hook has not yet allowed a call to touch: no fsmonitor, no signature check, and no transport, so no fetch of a partial clone's missing objects either. """ command = " ".join(args) - guards, env = (GUARDS, {**os.environ, "GIT_NO_LAZY_FETCH": "1"}) if guarded else ([], None) + guards = [option for setting in GUARD_SETTINGS for option in ("-c", setting)] if guarded else [] + # GIT_NO_LAZY_FETCH needs git 2.44. + env = {**os.environ, "GIT_NO_LAZY_FETCH": "1"} if guarded else None try: ran = subprocess.run(["git", *guards, *args], capture_output=True, cwd=cwd, encoding="utf-8", env=env, timeout=timeout) except UnicodeDecodeError as failure: diff --git a/bin/loop_claude/effects.py b/bin/loop_claude/effects.py index 6663cb5c..ab6cfad3 100644 --- a/bin/loop_claude/effects.py +++ b/bin/loop_claude/effects.py @@ -13,6 +13,12 @@ import git_repo PYTHON_TIMEOUT = 600 +class Git(typing.Protocol): + """Runs git in cwd, as git_repo.git does.""" + + def __call__(self, *args: str, cwd: str) -> str | Failure: ... + + class Streaming(typing.Protocol): """A started claude whose stream-json lines arrive as it works.""" @@ -28,8 +34,7 @@ class Effects: # Drops what was typed on the terminal and not yet read. discard_typed: typing.Callable[[], None] execv: typing.Callable[[str, list[str]], None] - # Runs git as git_repo.git does. - git: typing.Callable[..., str | Failure] + git: Git input: typing.Callable[[str], str] local_time: typing.Callable[[float], str] now: typing.Callable[[], float] diff --git a/bin/metric_bench/main.py b/bin/metric_bench/main.py index 1bce2a41..b7087276 100644 --- a/bin/metric_bench/main.py +++ b/bin/metric_bench/main.py @@ -25,8 +25,8 @@ single tracked file. Below the table it names: - each run it skipped because its commit is not in the checkout; - each run it could not score because its places name no measured unit, or every one; -- each file left out of its run because git cannot show it as UTF-8 or it does not parse on this - Python. +- each file left out of its run because git cannot show it, such as a file that is not UTF-8, or + it does not parse on this Python. Exit 1, saying why, on unknown arguments, or when git cannot start or finds no checkout, the history cannot be read, or no scoring run could be scored. diff --git a/bin/review_replay/main.py b/bin/review_replay/main.py index 20797909..93d62230 100644 --- a/bin/review_replay/main.py +++ b/bin/review_replay/main.py @@ -147,7 +147,7 @@ def chunk_rounds(reviewer: str, checkout: str, chunk: pathlib.Path) -> list[Roun def code_of(found: Round, effects: Effects) -> Code | Failure: - """Where, and at which commits, found's reviewer read the code, as the archive lets it be found again: the prompt's removed worktree, and the commits authored by then. + """Where, and at which commits, found's reviewer read the code, as the archive lets it be found again: the one directory the prompt names, beside the checkout or inside it, that no longer exists, as a removed worktree, else the checkout where the prompt names it; and the commits authored by then. Recording the reviewed commit at review time would need no such reading, but then no round archived before that change could be replayed. A wrong guess costs no rung: the reference reviewer, replayed on that code, finds fewer findings on record, and no rung is held to those. """ diff --git a/docs/decisions.md b/docs/decisions.md index 50f7245c..b3cecbb5 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -4,7 +4,7 @@ 2026-09-20, lilleman. Serves goal 1. Across six projects scored with the four seats, Locality or Self-sufficiency was the lowest dimension at every seat and Navigation at none, so a layout fix would not lift a project under the floor. Valid while the scoring run keeps those four seats. -2026-10-15, lilleman: an item that lifts the lowest dimension scores G 9, since the lowest dimension caps the overall and lifting it is worth the most to the floor. PR #257's scoring run found Shape lowest, at 6.25. The Shape items are `todo.md` items 124 and 125; a third, which ran every tool's git through `git_repo.py`, has shipped. When PR #283 replaces G, the chunk that ships it carries this rule into the new score. +2026-10-15, lilleman: an item that lifts the lowest dimension scores G 9, since the lowest dimension caps the overall and lifting it is worth the most to the floor. PR #257's scoring run found Shape lowest, at 6.25. The Shape items are `todo.md` items 124 and 125; a third, which ran five tools' git through `git_repo.py`, has shipped. When PR #283 replaces G, the chunk that ships it carries this rule into the new score. 2026-10-16, PR #283: such an item moves each goal it cites by 9, in place of G 9. lilleman, answering that PR's review: such items compete with the others like any item, so they no longer rank first.