Skip to content

docs(plans): file the aggregate follow-up from the bigint fix - #370

Merged
prisis merged 5 commits into
alphafrom
plans/bigint-followups
Aug 8, 2026
Merged

prisis merged 5 commits into
alphafrom
plans/bigint-followups

Conversation

@prisis

@prisis prisis commented Aug 8, 2026 •

Copy link
Copy Markdown
Member

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 doctor should surface countLegacyRows so 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:

  • A soft-delete table can never reach the aggregate companion. aggScope is always truthy for such a table (ctx-db.ts:2451), so the fast-path predicate at :2467 always 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.
  • Declaring aggregateIndex on 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 for v.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

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
@netlify

netlify Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for lunorash ready!

Name Link
🔨 Latest commit 2b2b189
🔍 Latest deploy log https://app.netlify.com/projects/lunorash/deploys/6a7763e0c00b360008ac3a2d
😎 Deploy Preview https://deploy-preview-370--lunorash.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (2)
  • plans/312-bigint-aggregate-gaps.md is excluded by none and included by none
  • plans/README.md is excluded by none and included by none

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c0aab569-1f23-470c-94cc-fc9d575ffcad

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Thank you for confirming the Contributor License Agreement! 🙏

prisis and others added 3 commits August 8, 2026 17:31
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
@prisis prisis changed the title docs(plans): file the two follow-ups from the bigint fix docs(plans): file the aggregate follow-up from the bigint fix Aug 8, 2026
@prisis
prisis merged commit 1ca3f16 into alpha Aug 8, 2026
11 of 13 checks passed
@prisis
prisis deleted the plans/bigint-followups branch August 8, 2026 17:14
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

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.
Please note this issue tracker is not a help forum. We recommend using our GitHub Discussions tab for questions.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant