Skip to content

chore(corrections): store each correction in a file of its own - #227

Merged
bketelsen merged 2 commits into
mainfrom
chore/corrections-folder
Nov 13, 2026
Merged

bketelsen merged 2 commits into
mainfrom
chore/corrections-folder

Conversation

@frostyard-machines

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

Copy link
Copy Markdown
Contributor

Summary

Every PR that fixes a blocking review point appends 1 line to the end of .memory/corrections.jsonl, so parallel PRs conflict on each merge. GitHub's server merge ignores merge=union. core ADR-0081 moves the inbox to 1 file per record in .memory/corrections/. 2 PRs that add 2 different files do not conflict.

  • .memory/corrections.jsonl (65 lines) moved to 65 files .memory/corrections/<date>-legacy-NNNN.json, with core's scripts/migrate-corrections.mjs at CORE_SHA=c8962829f1f34d900e0632e63f690f81630702f1 (core#240):
    node "$T/migrate-corrections.mjs" --root .
    migrated 65 records (65 new files, 0 unchanged, 0 promoted)
    
    Old line count: 65. New record count: 65.
  • internal/workflowcheck (row B2) reads the folder by core's v2 rules, without a base: each file's name (<date>-<slug>.json, slug at most 60 characters), the 5 fields and their content rules (unchanged correctionProblems), the name date equal to date, and the canonical form (JSON.stringify(record, null, 2) and a newline). It refuses a missing or empty folder, a subfolder, a symbolic link, a non-empty .gitkeep, and the old file. New file corrections_test.go; the old TestCorrectionsInbox leaves baseline_test.go. It reads only the working tree, so it does not refuse a removed, renamed or changed record (as before, where append-only had no test).
  • Text: AGENTS.md (B2 bullet), docs/org-adrs.md (inbox line and a new ADR-0081 line), .github/pull_request_template.md.

Open PRs that change the old file: none when this PR opened. Since then: #231 (adds 1 line). PRs that move their records after this PR: #231. If this PR merges first, #231 merges main and runs core's migrate-corrections.mjs --root . --pr 231; if #231 merges first, this PR merges main and runs the migration again on main's old file.

Risk tier

Risk tier: 3 — risk:high: the PR touches internal/workflowcheck/ (glob internal/{workflowcheck,repocheck}/**, L2, governance: the baseline tests). Why it is safe: the change is test code only; it replaces the B2 test of the old file with a test of the folder, and keeps the content rules unchanged. No product code, workflow or gate command changes.

Verification

  • make check green (host).
  • node "$T/check-corrections.mjs" --root . --base origin/main (core's validator v2 at CORE_SHA): ok corrections: 65 records, append-only vs origin/main at dcf773b, and ok corrections: 67 records, append-only vs origin/main at d5fbdea (the 65 legacy- records and the 2 records of the review fixes). This proves that every old line is its legacy- record.
  • Differential check against core (after the review fixes, not committed): Node wrote 87130 record files (each UTF-16 code unit from 0 to 0xFFFF as a whole field, random strings with lone surrogates and astral characters in canonical, compact and re-escaped forms, the years 0000 to 0220, leap days). core's check-corrections.mjs refused 7047 of them; recordFileProblems gave the same verdict on all 87130.
  • Canonical form: canonicalRecord gave the same text as Node's JSON.stringify(record, null, 2) + "\n" for 5779 records (every code point from U+0000 to U+02FF, U+2028, U+2029, U+FEFF, astral characters, and 5000 random strings); a throwaway cross-check, not committed.
  • Revert test: in a scratch worktree of this head, with .memory/corrections/ removed and .memory/corrections.jsonl restored from origin/main, go test -run TestCorrectionsInbox ./internal/workflowcheck/ fails: .memory/corrections.jsonl: is retired in this repository and .memory/corrections: missing.
  • git grep -n 'corrections\.jsonl' -- . ':!docs/adr' ':!docs/plans' ':!CHANGELOG*' ':!.memory/README.md' ':!scripts/check-corrections.mjs' ':!scripts/check-template.mjs' ':!test' ':!tests' ':!*.test.*' ':!*_test.go' ':!.github/scripts/test_baseline.py': no output.

Cross-review

Every PR that fixes a blocking review point appended 1 line to the end of
.memory/corrections.jsonl, so parallel PRs conflicted on each merge, and
GitHub's server merge ignores merge=union. core ADR-0081 moves the inbox
to 1 file per record in .memory/corrections/.

core's scripts/migrate-corrections.mjs (core c8962829) wrote the 65 lines
as <date>-legacy-NNNN.json records. internal/workflowcheck now reads the
folder by the v2 rules: name, content, name date and canonical form, and
it fails while the old file exists.
@github-actions github-actions Bot added level:L2 Read the diff risk:high Touches a path in .github/risk-paths.json labels Nov 13, 2026
The Go port refused a canonical record with an escaped lone UTF-16
surrogate, which JSON.parse keeps and JSON.stringify writes back as a
lowercase escape; it accepted the years 0000 to 0099, which core's
Date.UTC reads as 19YY; and it trimmed fields with Go's white space,
which differs from JavaScript's on U+0085 and U+FEFF. The port now reads
each string literal 1 escape at a time and follows core on dates and
white space. New test cases cover each rule, and 2 records note it.
@bketelsen
bketelsen merged commit 73ce9e9 into main Nov 13, 2026
13 checks passed
@bketelsen
bketelsen deleted the chore/corrections-folder branch November 13, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:L2 Read the diff ready-for-human Reviewed, CI green: ready for Brian to review and merge risk:high Touches a path in .github/risk-paths.json

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants