Repository navigation
docs(plans): file the aggregate follow-up from the bigint fix - #370
Conversation
311 is the data the defect left behind: rows written between ab0afaf and #365 hold the bigint tagged in place, so they read correctly but no json_extract comparison matches them. #365 heals a row on any write and migrates nothing, which leaves exactly the rows nobody rewrites - for paymentSessions, the settled sessions. runDataMigration already gives resumability, idempotence and cursor stability, so the work is a transform and a detector, not a runner. 312 is the price #365 paid. A soft-delete table can never reach the aggregate companion, and declaring aggregateIndex on a bigint column caps that column's writes at 2^53. Both throw rather than return a wrong answer, and closing either by rounding is a STOP condition. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP
✅ Deploy Preview for lunorash ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (2)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Thank you for following the naming conventions! 🙏 |
|
Thank you for confirming the Contributor License Agreement! 🙏 |
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP
Completed plans do not stay in this directory - the record is the README row and git history. 311 shipped inside #365, so its file would have been born and deleted in a day. Its one live thread, wiring countLegacyRows into doctor, moves into the row so it does not vanish with the file. 312 stays: its design decisions need a measurement first. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What
One new plan — 312, the only open follow-up from #365 — plus the README rows recording both.
311 is deliberately not a file here. It shipped inside #365 (
bb398f461), and this directory's rule is that completed plans are removed once shipped, with the record living in the README table and git history. Writing the file and deleting it a day later is churn, so the row is the record. Its one genuinely live thread is folded into that row rather than lost with the file:lunora doctorshould surfacecountLegacyRowsso an operator discovers legacy rows without being told to look — the exports exist, the per-shard fan-out decision does not.312 — the price #365 paid (P2)
The bigint fix stores columns as a fixed-width order-preserving decimal key, which is exactly comparable but not something SQLite can add up. Two guards followed, each correct alone, which together leave a
v.bigint()column unaggregatable in two shapes:aggScopeis always truthy for such a table (ctx-db.ts:2451), so the fast-path predicate at:2467always fails and every aggregate falls to the SQL scan — which now refuses a bigint field rather than coerce padded text into the ~1.5e40 that falls out of it. Net: no aggregate over a bigint column on that table at any magnitude, not just large ones.aggregateIndexon a bigint column caps that column's writes at 2^53 (aggregate-tally.ts:62), because the companion's__value__is a REAL column. The refusal fires on the write, so one index declaration makes the column unusable for large values — the opposite of why anyone reaches forv.bigint().Neither is a regression: before #365 the scan answer was garbage and the write threw for a different reason. Both are loud — they throw, they do not return wrong answers — and that is the bar the plan protects. Closing either by rounding is an explicit STOP condition, and "keep throwing" is recorded as a legitimate outcome rather than a failure.
The plan does not pick an approach, on purpose. Its §4 is titled "Design decisions to make (not yet made)" and WS1 is to decide with a measurement: whether the companion can be keyed per soft-delete state — which would also remove a pre-existing performance cliff nobody has measured on every aggregate over such a table — or whether the scan path should decode and reduce in JS, which is correct but O(rows).
Verification
prettier --check plans/clean, run from inside the worktree. Docs only.🤖 Generated with Claude Code
https://claude.ai/code/session_011sk9BLaUZDkPVAZ1sKhuDP