Repository navigation
fix(corrections-report): keep old-file records in line order - #248
Merged
Merged
Conversation
The report sorted every record by date first. In an old .memory/corrections.jsonl the line order is the order the records came in, and a later line can carry an earlier date, so the pending list and the repeated-scope groups showed legacy records out of line order. Order records of the old file by line number, then record files by file name in byte order, as the corrections design states. The date, the checkout path and the text only break ties between 2 different records at 1 line in 2 checkouts. The legacy JSON fixture now has decreasing dates, and 2 new tests pin the line order and the file-name order in working trees and at a ref.
Contributor
Author
|
Cross-review: reviewer Revert test: in a scratch worktree at the head, |
bketelsen
approved these changes
Nov 14, 2026
5 tasks done
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
scripts/corrections-report.mjssorted every record by date first. In an old.memory/corrections.jsonlthe line order is the order the records came in (the file is append-only), and a later line can carry an earlier date. So the pending list, the repeated-scope groups and the text output showed legacy records out of line order.This PR orders records of the old file by line number, then record files by file name in byte order (ADR-0081 names each record file
<date>-<slug>.json, so the file-name order already follows the date for the folder form). The date, the checkout path and the text only break ties between 2 different records at 1 line in 2 checkouts. The JSON schema does not change.scripts/corrections-report.mjs:compareLineskeys on form, line, source, then the tie-breakers.test/corrections-report.test.mjsandtest/fixtures/corrections-report/legacy.json: the legacy fixture now has decreasing dates; 2 new tests pin the line order (pending and repeated-scope lists, text output) and the file-name order, in working trees and at--ref. Both the fixture test and the line-order test fail without the fix.docs/design/quality-loop.md(Weekly promotion): states the order..memory/corrections/: 1 record for this finding.Risk tier
Risk tier: 1 — a read-only report script, its tests and 1 design-doc line; no gate, workflow or risk path changes.
Docs housekeeping
Verification
make verifygreen locally (854 tests).node --test test/corrections-report.test.mjs: 39 pass; with the oldcompareLines, 2 fail (the legacy fixture and the line-order test).