Skip to content

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

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

bketelsen merged 3 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 (3 lines at the first head, 4 lines after porter#45 merged into main) moved to 4 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 3 records (3 new files, 0 unchanged, 0 promoted)
    
    Old line count: 3. New record count: 3.
  • 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. The old correctionsLines and TestCorrectionsLines go too: they read lines of the old file. 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 (gh pr list --state open with the old path filter, at the time of this PR).

Risk tier

Risk tier: 3 — risk:high: the PR touches internal/workflowcheck/ (glob internal/{workflowcheck,packagecheck}/**, 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) on the second run. The first run failed 1 test outside this change, cmd/porterd TestAThreadOverTheSession (it fails about 10 times in 100 with go test -count=100; this PR does not touch cmd/porterd).
  • node "$T/check-corrections.mjs" --root . --base origin/main (core's validator v2 at CORE_SHA): ok corrections: 3 records, append-only vs origin/main at 9295183, and ok corrections: 5 records, append-only vs origin/main at dfcc9f7 (the 3 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

Merge of main (unchanged update)

  • porter#45 merged into main and added line 4 to .memory/corrections.jsonl, so this PR had a modify/delete conflict on that file. Reviewed head dfcc9f71300806b671933c8c966be3ea43fad921, old base 8b1fe6df1e06f7add076868adf7eaf74a15511cd, new base 09fd0fd7fe995f84f7997201ac6875ddcbd92af5, new head 372535a64aca9de2ef3726684ac1c914417b3470 (merge commit).
  • Resolution: main's version of the old file, then core's migrate-corrections.mjs --root . at c8962829: migrated 4 records (1 new files, 3 unchanged, 0 promoted); it wrote .memory/corrections/2026-11-13-legacy-0004.json and deleted the old file. node "$T/check-corrections.mjs" --root . --base origin/main: ok corrections: 6 records, append-only vs origin/main (4 legacy- records and the 2 review records). make verify passes.
  • Comparison: diff <(git diff 8b1fe6d dfcc9f7 -- . ':!.memory/corrections.jsonl') <(git diff 09fd0fd 372535a -- . ':!.memory/corrections.jsonl' ':!.memory/corrections/2026-11-13-legacy-0004.json') shows only the index line of AGENTS.md (main changed other parts of AGENTS.md). The PR's own changes are unchanged.
  • Compatibility check (openai/gpt-6.1-sol, the same reviewer): Compatible. main changed neither internal/workflowcheck/ nor the B2 text; legacy-0004 keeps all 5 fields of line 4; the merge resolves only that conflict.

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 3 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.
origin/main added line 4 to .memory/corrections.jsonl (porter#45). The
conflict (modify/delete) is resolved by running core's
migrate-corrections.mjs (c8962829) on main's version of the old file:
line 4 becomes .memory/corrections/2026-11-13-legacy-0004.json, and
lines 1 to 3 stay as they were.
@bketelsen
bketelsen merged commit 988fe28 into main Nov 13, 2026
8 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