Repository navigation
feat(corrections): validator v2, migrate and new-record scripts, report for both forms - #240
Merged
Merged
Conversation
…rt for both forms Validator v2 checks the record folder .memory/corrections/ and the old .memory/corrections.jsonl, refuses a tree with both, and with --base enforces the cut-over rules of ADR-0081 (no removed, renamed or changed record; the old file does not come back; the move keeps every line). --file is removed. scripts/migrate-corrections.mjs moves the old file into the folder (--pr N for an open PR that still added lines). scripts/new-correction.mjs writes 1 record in canonical form. The corrections report reads both forms and adds source and records. Docs and shared skills name both forms until every repository moves.
…keep distinct records - check-corrections, migrate-corrections and new-correction refuse a symbolic link at .memory or .memory/corrections, so no record leaves its path unseen. - migrate-corrections writes each temp file with the exclusive flag and a random name, and decodes the old file with a fatal UTF-8 decoder; the move proof in check-corrections fails a base file that is not valid UTF-8. - corrections-report merges records by key and place, so 2 records with the same 4 fields stay 2, and it does not follow a .memory link in a checkout without the ref. The fixture tests compare the exact JSON text. Each fix has a test that fails without it; 1 corrections line records the lesson.
…2-tools # Conflicts: # .memory/corrections.jsonl
…s, keep a BOM - corrections-report merges the checkouts of 1 repository by the permanent identity of a record (legacy line number, or file name), so a promotion never moves to another record with the same fields. - migrate-corrections removes its own leftover temp files from a stopped run before it writes, and keeps a leading BOM so the line rules reject it; the restart test compares complete trees. Each fix has a test; 1 corrections line records the lesson.
… report A legacy line number names a record only within 1 history: 2 branches can append different records at the same line. The report's merge identity of a legacy record is now its line number with its 4 key fields, so 2 different records stay 2 and a promoted copy of 1 record still merges.
bketelsen
approved these changes
Nov 13, 2026
This was referenced Nov 13, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the tools and texts of ADR-0081: each correction record is 1 file in
.memory/corrections/, so 2 PRs that each add a record no longer conflict on.memory/corrections.jsonl. Core keeps its own old file in this PR; its move comes in a later PR.scripts/check-corrections.mjs(validator v2). Without--base: the folder form (name<date>-<slug>.json, slug at most 60 characters, the 5 string fields, name date =date, canonical bytesJSON.stringify(record, null, 2) + "\n", only regular files and an optional empty.gitkeep), the old form with the v1 line rules, a failure for both forms, andno recordsfor neither. With--base: folder → folder (no removed, renamed or changed record except a filled emptypromoted_to; no newlegacy-record), folder → old file (refused), old → old (the v1 append-only rule), old → folder (every base line N is<date>-legacy-<NNNN>.jsonwith the same record, no otherlegacy-file), folder → neither and old → neither (refused). A bad ref or an unreadable object stays fatal.--fileis removed; no caller uses it.scripts/migrate-corrections.mjs(new). Moves the old file into the folder. It checks every line first, plans every output before it writes, keeps an equal file, stops with no change on a clash, writes each file through a temp file and a rename, and then deletes the old file.--pr Nconverts the lines of an open PR after a merge ofmain: lines matchlegacy-records by their 4 key fields; the promotion table of ADR-0081 applies; unmatched lines become<date>-pr-<N>-<k>.json.scripts/new-correction.mjs(new). Writes 1 record in canonical form, refuses an existing name and a repository that still has the old file.scripts/corrections-report.mjs. Reads both forms at--refand in working trees. Each record and each unreadable entry getssource(the path in the repository); a folder record hasline: null;pathkeeps its meaning; a new top-levelrecordskey equalslines. Order: date, source, line..memory/README.md,docs/org-adrs.md, and text that names both forms inAGENTS.md, the quality loop, the review rubric, and thefrostyard-acmm-conformanceandfrostyard-repo-docsskills. The repo-docs skill no longer says to delete a correction entry: records are permanent (ADR-0018, ADR-0081).The 3 CLI scripts import only
node:modules, so another repository can take each one from core at 1 commit withgit show.Risk tier
Risk tier: 2 — validator and report code that other repositories copy, plus docs and shared skills. No path of
.github/risk-paths.jsonmatches.Docs housekeeping
Verification
make verifygreen locally at 043eb47: docs gate 1.000 / 1.000 / 1.000,ok corrections: 40 lines (legacy form: migrate to .memory/corrections/), 846 tests pass, 0 fail;node scripts/check-corrections.mjs --base origin/mainpassesnode --test test/check-corrections.test.mjs test/migrate-corrections.test.mjs test/new-correction.test.mjs test/corrections-report.test.mjs: 139 passmigrate-corrections.mjs --root .→migrated 37 records (37 new files, 0 unchanged, 0 promoted); thencheck-corrections.mjs --root . --base HEAD→ok corrections: 37 records, append-only vs HEAD; the report reads 37 records. The scratch worktree was removed; core's file is unchanged here.Cross-review
openai/gpt-6.1-sol; codersdeepseek/deepseek-flash(scripts, tests) andanthropic/claude-opus-5-5(docs, skills)..memorypassed--base; a predictable temp path in the migration followed a link; the writers followed a linked.memory/corrections; a lossy UTF-8 decode in the migration and the move proof; 2 report records with the same fields merged into 1; the report followed a.memorylink in a checkout without the ref. Fixed in 9d41622, each with a test..memory/corrections.jsonl(both sides appended 1 line; main's line first, then this PR's;check-corrections.mjs --base origin/mainpasses).git diff 9d41622 96132c7 -- scripts testis empty; the reviewer's compatibility check: Compatible..memory/corrections.jsonl(core's current form) record the lessons.scripts/check-corrections.mjsandscripts/corrections-report.mjsreset toorigin/main, tests kept:node --test test/check-corrections.test.mjs test/corrections-report.test.mjs→ 51 fail (for example "base folder: a removed record fails", "base old file: a move that drops a line fails", "the folder fixture is the exact report in the working tree and at a ref"). The coder reverted each later fix in a scratch copy and saw its new test fail. The scratch worktree was removed.