Skip to content

feat(corrections-report): --ref reads each file at a ref, once per clone (T879a) - #198

Merged
bketelsen merged 3 commits into
mainfrom
lucilla/corrections-ref
Nov 5, 2026
Merged

bketelsen merged 3 commits into
mainfrom
lucilla/corrections-ref

Conversation

@frostyard-machines

@frostyard-machines frostyard-machines commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

ACMM scorecard (T879a, 2026-11-04), missing instrument 2: the baseline (B6) could not use scripts/corrections-report.mjs, because it reads working trees. A line on an unmerged branch or an uncommitted edit in any worktree counts as if it were on main.

  • scripts/corrections-report.mjs: new --ref REF (for example --ref origin/main). For each checkout it reads .memory/corrections.jsonl at that ref with git rev-parse, git ls-tree and git cat-file (no checkout change, no fetch). The worktrees of 1 clone share their git folder (--git-common-dir), so the file is read once per clone; the other worktrees are listed as paths only. A committed symbolic link is not followed (as in working-tree mode). A checkout that has the file in its working tree but not the ref is listed as unreadable (ref not found: REF), so a repository is never left out without a trace; one with neither is skipped. The ref must look like a ref or revision (^[A-Za-z0-9][A-Za-z0-9._/@{}~^-]*$, no ..), so git never reads it as an option, and rev-parse runs with --end-of-options. The report gets a ref field (null without --ref) and the text header says (at REF) or (working trees). Without --ref, behaviour is unchanged.
  • Review fixes (see Verification): every git call sets GIT_NO_LAZY_FETCH=1, so a partial clone never fetches a missing blob (it is listed as cannot read file at REF); the ref is resolved per worktree (HEAD differs per worktree) and the file is read once per clone and commit; a clone's identity is the first remote any of its worktrees names; a worktree without the ref is listed when it has the file, and when its .memory cannot be read (only ENOENT/ENOTDIR mean absent).
  • .memory/corrections.jsonl: 2 lines (blocker to guard).
  • test/corrections-report.test.mjs: 8 new tests; and the after hook restores denied folders before it removes fixtures (it threw ENOENT once a fixture was made after the denied-folder test).
  • docs/design/quality-loop.md (weekly promotion) and .memory/README.md: run it with --ref origin/main after a git fetch.

Risk tier

Risk tier: 1 — a read-only local report, its tests and docs. No workflow, authority, policy or risk path; the report is not in verify/check.

Verification

  • node --test test/corrections-report.test.mjs: 23/23 pass. make ci: 284 tests pass, docs gate green (head 8cb94c2).
  • New tests: --ref reads only the file at the ref, once per clone (a clone with origin/main holding 1 line, a feature worktree with a branch-only line, an uncommitted line in the main worktree: working trees give 3 lines, --ref origin/main gives 1, with both worktrees as paths); --ref lists a checkout with the file but without the ref, and skips one without both; --ref does not follow a committed symbolic link and reports bad lines at the ref; --ref refuses a value that git could read as an option.
  • Later tests: --ref checks each worktree for a file when the clone has no such ref; --ref names a clone by the remote of any of its worktrees (extensions.worktreeConfig); --ref never fetches a blob that a partial clone does not hold (a --filter=blob:none clone of a local file:// source; the blob is still missing after the run); --ref lists a checkout without the ref whose .memory folder is denied.
  • Revert test (scratch worktrees from the PR head, removed after): with scripts/corrections-report.mjs from the base 408ec56 and the tests kept, 3 tests fail on assertions (--ref reads only the file at the ref, once per clone, --ref lists a checkout with the file but without the ref, …, --ref does not follow a committed symbolic link …). With the script from ecfa1a5 (before the review fixes), the 3 tests for findings 1-3 fail; with the script from cdfde7c, the denied-folder test fails.
  • Cross-review (reviewer openai/gpt-6.1-sol, coder github-copilot/claude-opus-5.5, base 408ec56): initial review at ecfa1a5: Not ready, 3 blocking (lazy fetch in a partial clone; a missing-ref result of 1 worktree hid another worktree's file; the first worktree fixed the clone's identity), all accepted and fixed in cdfde7c. Re-review 1 at cdfde7c: Not ready, 1 blocking (a denied folder without the ref was skipped), accepted and fixed in 8cb94c2. Re-review 2 at 8cb94c2: Ready, Blocking: none. Budget used: 1 review + 2 re-reviews.
  • Real run, read-only: node scripts/corrections-report.mjs --root ~/projects --ref origin/main --json: 70 checkouts, 15 repositories, 118 lines, plus 1 unreadable line (chairlift line 15, promoted_to not a string) = 119, the same as baseline B6 (15 repositories, 119 lines, snosi 47). Working-tree mode on the same root gives 13 repositories and 114 lines.

Docs housekeeping

  • Design doc and .memory/README.md updated; no new doc.

@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 5, 2026
@bketelsen
bketelsen merged commit 99d37ee into main Nov 5, 2026
5 checks passed
@bketelsen
bketelsen deleted the lucilla/corrections-ref branch November 5, 2026 04:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Reviewed, CI green: ready for Brian to review and merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants