fix: ledger merge dedupe + L4 quarterly archive rotation - #1418
Conversation
Replace stock merge=union with a custom ledger driver that unions concurrent appends and drops byte-identical twins, add ledger:dedupe for checkouts without the driver, tighten Run PR babysit append policy, and close#88 now that the residual exact-dupe class is gated.
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in:51 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (16)
Comment |
Add ledger:rotate to move older dated rows into docs/archive/branch-review-ledger-<yyyy-qN>.md, teach lookup/sweep/check to read the archive corpus, bootstrap by archiving pre-2026-07-29 rows, and mark maturity backlog L4 done. Also fix the CLI entry guard so check-branch-review-ledger no longer falsely matches as the ledger CLI.
check-branch-review-ledger.mjs ends with branch-review-ledger.mjs, so a bare endsWith guard can execute the wrong CLI when modules import each other. Match on a path segment instead.
Single PR ships merge=ledger + ledger:dedupe, Run PR anti-churn policy, #88 closeout, and quarterly ledger:rotate with live/archive corpus lookup (80 live + 1206 archived).
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #6744 (success). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
TypeScript inferred calendarQuarterStart(value = new Date()) as Date-only and dropped `before` from rotateLedgerMarkdown's options object, which failed Static PR typecheck on the hygiene tests.
💡 Codex ReviewDatabase/scripts/merge-branch-review-ledger.mjs Lines 69 to 70 in 60ffc9a When either merge tip still contains the pre-rotation ledger, ignoring AGENTS.md reference: AGENTS.md:L145-L147 https://github.com/BigSimmo/Database/blob/60ffc9a8bba5c8d3f1f8f10daf2a5919a08ea746/docs/archive/branch-review-ledger-2026-q3.md#L691 When the generated archive is compared cell-for-cell with the parent ledger, three historical records have changed rather than merely moved. For example, this row changes AGENTS.md reference: AGENTS.md:L145-L145 Database/scripts/branch-review-ledger.mjs Lines 189 to 191 in 60ffc9a When an operator mistypes a structurally valid but impossible cutoff such as ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…edupe-ad64 Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…edupe-ad64 Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
L4 shipped in #1418. Track a quarterly ledger:rotate reminder so the live table does not grow unbounded again.
Progress summary table still said OPEN after L4 shipped. Document exact-only dedupe, install-required merge driver, and quarterly rotate practice.
Uh oh!
There was an error while loading. Please reload this page.
PR #1418 landed its own `#126` (quarterly ledger rotation) on main while this branch was carrying one — the same unprotected read-modify-write race archived as #112, hit for the second time in an hour. Main holds first claim, so its row keeps #126, the phone-scroll CI capture moves to #127, and the marker advances to 128. Both rows are kept. check:outstanding-issues: 125 rows (62 open, 63 archived), unique ids, next-id=128 above the highest. check:branch-review-ledger: 90 live + 1206 archived, ledger merge active. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XrPbbfU9yWuEjEVypCr4ZQ
main's #1418 (ledger merge dedupe + L4 quarterly archive rotation) and #1413 both edited docs/outstanding-issues.md, so this was a real content conflict rather than staleness: git merge-tree --write-tree confirmed CONFLICT before any resolution was attempted. Resolved by taking main's version of the ledger wholesale and re-applying this branch's five-row archive move on top, so neither side's work is lost: - from main: #88 and #97 archived, new open row #126 (quarterly ledger rotation) with queue order 35, the #23 "When" update (release-browser-matrix no longer blocked by pr-required), the #86 detail update, and the issues:next-id bump to 127. - from this branch: #95, #96, #104, #109 and #115 moved from Open items to Resolved / archive. No row from either side was dropped, and no id appears in both tables. Verified: 121 rows (52 open, 69 archived), marker next-id=127 above the highest; each of #88, #97, #95, #96, #104, #109, #115 resolves to exactly one archive row and #126 to one open row; zero conflict markers remain. npm run verify:cheap -> EXIT=0; "Gate-manifest OK: all 29 verify:cheap gates are enforced in CI"; "Test Files 431 passed (431)"; "Tests 4496 passed | 4 skipped (4500)". npx prettier --check . -> "All matched files use Prettier code style!" Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011YdPS2KhKqz2buzsUgmX3c
GitHub reported this PR dirty, but `git merge-tree --write-tree origin/main HEAD` exited 0: clean. That is the anti-churn case, not a content fight — GitHub's server-side merge does not read custom merge drivers, which is already recorded as ledger #127. So the documented remedy applied: merge locally and push. `git merge origin/main` then produced a CORRUPT tree and it must not be pushed as-is. `.gitattributes` sets `merge=union` for this file (added by #1418), and union keeps both sides of every differing line. Prettier pads these tables to the widest cell, so a single row's edit re-pads every other row — both sides' copies of all 128 rows are textually distinct, and union kept both. Result: every row duplicated, both table headers duplicated, 133 insertions. `npm run check:outstanding-issues` caught it, failing with 128 duplicate-id errors, both separator rows reported as non-canonical ids, and all five archived rows "in BOTH the open and archive tables". The gate #112 added is what stopped a silently doubled ledger from reaching the PR — it failed closed exactly as designed. This is the outcome ledger #127 predicted: it records that `merge=union` is the wrong fix for this file, with evidence, "so nobody re-proposes it". #1418 enabled it anyway. Union is safe for append-only single-line records like docs/branch-review-ledger.md; it is actively destructive on a width-padded table, because padding turns every unrelated row into a conflicting line. Recovered without a destructive reset: the merge commit and both parents are kept, only its tree was rebuilt — take origin/main's ledger, re-apply the five-row archive move, reformat. Proven lossless against origin/main rather than assumed: origin/main : 63 open + 65 archived = 128, 0 duplicates rebuilt : 58 open + 70 archived = 128, 0 duplicates IDs lost from main: NONE IDs invented: NONE open == main's open minus the five moved: True Verified: npm run verify:cheap -> EXIT=0; "Test Files 434 passed (434)"; "Tests 4563 passed | 4 skipped (4567)"; "Outstanding-issues guard passed: 128 rows (58 open, 70 archived), unique ids, next-id=131 above the highest, union merge active". npx prettier --check . -> "All matched files use Prettier code style!" Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011YdPS2KhKqz2buzsUgmX3c
Summary
Combines the former #1418 + #1419 work into one PR:
merge=unionwith custommerge=ledger(union + exact-row dedupe); install viapostinstall/hooks:install.npm run ledger:dedupefor checkouts without the driver.--supersedeon later sweeps).#088(union-driver duplication watch).npm run ledger:rotate; bootstrap archives 1206 pre-2026-07-29 rows intodocs/archive/branch-review-ledger-2026-q3.md.ledger:lookup/sweep:branch-ledger/check:branch-review-ledgerread and validate the live + archive corpus.endsWith("branch-review-ledger.mjs")false-matches.calendarQuarterStart/rotateLedgerMarkdown.#086Remaining; capture#126quarterly rotate reminder; document exact-only dedupe / install-required driver / quarterly rotate practice on the ledger README. Deleted stalecursor/ledger-l4-rotation-ad64(feat: rotate branch-review ledger into quarterly archives (L4) #1419).Verification
npm run check:branch-review-ledger→ ledger merge active; live + archive corpus validatednpm run check:outstanding-issues→58 open / 63 archived;#088closed;#126present; next-id=127npx vitest run tests/repo-hygiene.test.ts→ 42 passed (prior tip)npm run typecheck→ clean (JSDoc fix on prior tip)npx prettier --checkon touched docsnpm run verify:pr-local(docs/scripts/process scope; gates above cover the change)Risk and rollout
package.jsonscripts, large historical ledger move into archive. Content is preserved, not deleted..gitattributesreturns tomerge=union; restore single-file ledger from git history if needed.Clinical Governance Preflight
Not applicable — docs/scripts/process only; no clinical, RAG, ingestion, privacy, or Supabase behavior change.
Notes
Supersedes #1419 (same L4 commits folded in here). Branch is synced with
main(merge-tree clean).