Repository navigation
refactor(core): drop unused session_pending table and pin the history compaction bound - #59020
Open
kitlangton wants to merge 1 commit into
Open
kitlangton wants to merge 1 commit into
kitlangton wants to merge 1 commit into
Conversation
… compaction bound History already reads session_message from the latest completed compaction (seq >= boundary) in SQL. Add a parity test against the full transcript cut at that compaction (none, one, several, failed) and a guard test that makes earlier rows undecodable, so a regression to reading them fails. Drop session_pending, which nothing reads or writes since session_inbox replaced it.
Contributor
There was a problem hiding this comment.
No problems found; the change is sound. The migration tests and compaction tests pass (49 tests), and tsc -b on core is clean (the typecheck script needs a newer Bun than this environment has). With the seq >= compaction.seq bound removed from SessionHistory, the two new tests fail, so the bound is pinned as described. No code outside historical migrations references session_pending, and the IF EXISTS drops are safe for fresh databases, which no longer create the table.
Public API is unchanged: this only touches the internal SQLite schema and its drizzle snapshot.
This branch has not been deployed
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.
What it does
Adds tests that keep each step's history load bounded at the latest completed compaction, and drops the unused
session_pendingtable. No runtime code changes.Why
The history load already filters in SQL (
seq >= <latest completed compaction>, on the(session_id, seq)index), but no test covered that bound. If it regressed to reading everything and filtering in memory, the cost per step would grow with the whole session (in-memory SQLite, 20 rows after the compaction, mean of 20 loads):session_pendinghas had no reader or writer sincesession_inboxreplaced it in August.How it works
SessionHistory.loadmatches the full transcript cut at the latest completed compaction, for no compaction, one, several, and a failed compaction after a completed one.session_pendingand its three indexes (IF EXISTS).Risk
Low. Dropping
session_pendingdeletes stale rows left from beforesession_inbox; nothing reads them ondevorbeta.Proof
session-compaction.test.tsanddatabase-migration.test.tspass (48 tests). Core typecheck and oxlint are clean.