Skip to content

feat(scripts): weekly corrections report (T801 t8) - #193

Merged
bketelsen merged 3 commits into
mainfrom
lucilla/corrections-report
Nov 4, 2026
Merged

bketelsen merged 3 commits into
mainfrom
lucilla/corrections-report

Conversation

@frostyard-machines

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

Copy link
Copy Markdown
Contributor

Summary

Plan T801, task t8 (section "Gap 4: corrections in the repository"). Builds on #189 (t7, the corrections validator).

  • scripts/corrections-report.mjs --root DIR [--depth N] [--json] [--out FILE]: finds local git checkouts under DIR (a .git folder or file; stops at a repository root; skips node_modules and symlinks; default depth 3), reads each .memory/corrections.jsonl, and reports:
    • per repository, the lines with an empty promoted_to;
    • repeated scopes: 2 or more lines with 1 scope in 1 repository, or 1 scope in 2 or more repositories (scope key: trimmed, lower case). A group is shown only when it has at least 1 pending line; promoted lines are counted, never listed.
  • Checkouts of 1 repository (worktrees such as core--lucilla-…) merge by remote.origin.url into 1 repository; the identity keeps the host, a non-default port and the full path (a github.com remote shows as owner/name, any other host keeps its host), so SSH and HTTPS forms of 1 repository merge and 2 hosts never do. Lines merge by (date, scope, correction, evidence), and a filled promoted_to in any checkout wins. Without a parsable remote, the name is local:<path relative to the root>.
  • A symbolic link at .memory or corrections.jsonl is not followed, and an access error other than a missing path (for example EACCES) is listed under unreadable lines: a checkout is never left out without a trace.
  • Read only: the only subprocess is git -C DIR config --get remote.origin.url; output goes to stdout or --out FILE (no folder is created). Unreadable lines are listed, not fatal; the validator stays the gate. Text output replaces control characters from correction text.
  • docs/design/quality-loop.md (Learn station) names the weekly run (Friday hygiene line); .memory/README.md links it; npm run report:corrections (not in verify).

Risk tier

Risk tier: high — test/** and scripts/** sit in the quality-gates protected boundary of policies/agent-governance.json (minimum_risk_tier: high). The script is not added to any gate; no workflow, authority, skill or template change.

Docs housekeeping

  • No new doc; edits to docs/design/quality-loop.md and .memory/README.md keep their links
  • Conformance aliases (ADR-0029) untouched

Verification

  • npm run verify (= make ci): 112/112 tests, docs gate green
  • node --test test/corrections-report.test.mjs: 15/15
  • Revert test, in a scratch worktree (git worktree add --detach, removed after): groupScopes made to return no groups → tests 1 (repeat in 1 repository), 2 (scope in 2 repositories) and 5 (JSON groups) fail; 8 pass. Restored code: 11/11.
  • Revert test of the review fixes (139df4a), in a scratch worktree: git checkout 38fe955 -- scripts/corrections-report.mjs with the new tests kept → tests 13 (2 hosts do not merge), 14 (.memory link not followed) and 15 (denied .memory listed) fail on assertions; 12 fails because parseRemoteUrl is not exported; 10 pass.
  • Revert test of the port fix (6860b61): git checkout 139df4a -- scripts/corrections-report.mjs → test 12 fails on the assertion git.example.net:8443/team/core; 14 pass.
  • Read-only test: a fixture tree snapshot (every path, size, mtime) is equal before and after a --json run.
  • Manual run node scripts/corrections-report.mjs --root ~/projects --depth 3: exit 0; 69 repositories scanned, 7 with corrections, 62 lines, 0 pending (every line on this machine is promoted). frostyard/core (5 checkouts) and frostyard/snosi (3 checkouts) each appear once.

Cross-review

Reviewer openai/gpt-6.1-sol, coder github-copilot/mai-code-2-flash (small edits by claude-opus-5.5). Initial review of 38fe955: Not ready, 3 blocking findings (remote identity collision across hosts, .memory symbolic link followed, access errors silently dropped). All 3 accepted and fixed in 139df4a, each with a targeted test. Re-review 1 of 139df4a: findings 1-3 fixed; 1 new blocker (a non-default port dropped from the identity), fixed in 6860b61 with a test.

scripts/corrections-report.mjs --root DIR finds local checkouts, reads each
.memory/corrections.jsonl, and lists per repository the lines with an empty
promoted_to and the scopes that repeat (2 or more lines in 1 repository, or
1 scope in 2 or more repositories). It reads only: stdout or --out FILE.
Checkouts of 1 repository (worktrees) merge by origin remote.

docs/design/quality-loop.md names the weekly run (Learn station).
…ccess errors

Cross-review of 38fe955 (openai/gpt-6.1-sol), findings 1-3:
- the repository identity keeps the host and the full path, so 2 remotes
  with the same owner/name on different hosts do not merge;
- a .memory or corrections.jsonl symbolic link is not followed; it is
  listed as unreadable;
- only a missing path means no corrections: other errors (EACCES) are
  listed as unreadable.
Cross-review re-review 1 of 139df4a: 2 ports on 1 host are 2 servers.
Default ports (80, 443, ssh 22) still give the plain host.
@frostyard-machines frostyard-machines added the ready-for-human Reviewed, CI green: ready for Brian to review and merge label Nov 4, 2026
@bketelsen
bketelsen merged commit 4f4e5d5 into main Nov 4, 2026
3 checks passed
@bketelsen
bketelsen deleted the lucilla/corrections-report branch November 4, 2026 14:51
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