Skip to content

feat(corrections): validate corrections.jsonl; blocker-to-guard rule; fleet acceptance note - #189

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

bketelsen merged 3 commits into
mainfrom
lucilla/corrections-validator

Conversation

@frostyard-machines

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

Copy link
Copy Markdown
Contributor

Summary

Plan T801, task t7 (section "Gap 4: corrections in the repository", decision T801c).

  • scripts/check-corrections.mjs (new, npm run check:corrections, now in make verify): validates every line of .memory/corrections.jsonl — valid JSON, a plain object, exactly the 5 ADR-0018 fields, all strings, date a real YYYY-MM-DD calendar date, non-empty scope, correction and evidence. Blank lines and duplicate member names (also escaped ones) fail. A missing file passes (no file).
    With --base <ref> it also checks append-only: each base line must be unchanged at the same position, except an empty promoted_to that is filled. A removed line, a changed line, or a removed file fails. Every git failure other than "the base has no such path" fails closed (bad ref, unreadable object, output limit). --root and --file let an owner run it on another checkout; --file must stay inside --root, and the same root-relative path is read from disk and from git.
  • docs/design/quality-loop.md, Learn station: the blocker-to-guard rule (a blocking review point gets a test that fails without the fix, else an AGENTS.md rule, plus 1 corrections line in the same PR) and the "lessons live in the repository" rule of T801c.
  • docs/specs/pr-review-rubric.md: new row "Blocker has a guard".
  • docs/specs/pr-acceptance-metric.md: subsection "Fleet variant: decided acceptance" — the daily audit's Q1 number beside core's own, with the differences (scope, window, denominator).
  • .memory/README.md: names the validator and the rule.

Not changed: policies/agent-governance.json. The new script is not in the quality-gates boundary paths (its tests are, through test/**). Adding it is a policy change and needs its own ADR/design change.

Risk tier

Risk tier: high — test/** is in the quality-gates protected boundary of policies/agent-governance.json (minimum_risk_tier: high), and the PR adds a new gate to make verify. No workflow, authority, skill or template change.

Docs housekeeping

  • No new docs (edits of existing living docs/specs only); nothing to index
  • Cross-links: quality-loop ↔ rubric ↔ metric spec; ADR-0018 added to the quality-loop rationale and the rubric references
  • No ADR (ADR-0018 already decides the store; this is how the loop runs)
  • Conformance aliases untouched

Verification

  • make ci: docs gate 1.000/1.000/1.000 (89 docs, 895 links, 10 symlinks), bash_syntax: 6/6, ok corrections: 3 lines, tests 97/97.
  • node scripts/check-corrections.mjs --base origin/main → ok corrections: 3 lines, append-only vs origin/main (core's 2 existing lines unchanged, 1 appended).
  • Manual run on snosi (read only, snosi 9b0b1539ae547e45ad32bfb4f581444e9bc0734c):
    node scripts/check-corrections.mjs --root ~/projects/frostyard/snosi → ok corrections: 43 lines;
    with --base HEAD → ok corrections: 43 lines, append-only vs HEAD.
  • test/check-corrections.test.mjs: 23 tests, including a 6th field fails, 3 bad dates fail (2026-8-11, 2026-13-01, 2026-02-30), a removed line fails against --base, a changed line fails, a filled promoted_to passes, a re-filled promoted_to fails, a removed file fails against --base, a duplicate key fails, an absolute in-root --file is compared, an unreadable base object fails, a path with spaces works.

Revert test

Scratch worktree at the PR head (git worktree add ../core-revert-t7 HEAD), scripts/check-corrections.mjs replaced by a stub that prints ok corrections: 0 lines and exits 0 (no validation), tests unchanged:

node --test test/check-corrections.test.mjs   # exit 1, pass 0, fail 23

Second revert test, for the cross-review fixes (head ea7cc6d): scripts/check-corrections.mjs restored to the first commit cfd7b4f, tests of the head kept → pass 17, fail 6: a duplicate key fails, also when one copy is escaped, base: an absolute --file inside the root is compared, not skipped, a --file outside the root exits 2, base: an unreadable base object fails instead of passing, base: a missing file with a bad ref fails, the default root works from a path with spaces.

Failing on assertions, for example: a sixth field fails and names it (Missing expected rejection), 2026-13-01 fails as an invalid date, base removal of line 1 or last line fails, base: a removed file fails, base promotion from empty promoted_to passes (stdout has no append-only vs HEAD). The scratch worktree was restored and removed.

Coder: github-copilot/mai-code-2-flash (script, tests, package.json); docs, the removed-file fix and the cross-review fixes by Lucilla (Claude). Cross-review: openai/gpt-6.1-sol.

.memory/corrections.jsonl gets 1 line for the cross-review findings that this PR fixed (the PR follows its own blocker-to-guard rule; promoted_to is the test file).

Cross-review

Reviewer openai/gpt-6.1-sol; coders github-copilot/mai-code-2-flash and Claude (Lucilla). Initial review at cfd7b4f: 2 blocking (base read errors skipped the comparison; --file path mismatch between disk and git), 2 low (duplicate JSON keys; percent-encoded default root). All 4 fixed with targeted tests in ea7cc6d. Re-review 1: 1 blocking (no corrections line for these fixes), fixed in a279863. Re-review 2 at a279863: Ready, Blocking: none.

@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 bd0295d into main Nov 4, 2026
3 checks passed
@bketelsen
bketelsen deleted the lucilla/corrections-validator branch November 4, 2026 14:30
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