Repository navigation
Page SQL message pruning by id, matching Ruby after #113 - #111
Merged
Merged
Conversation
Message pruning ran the full candidate query again after each batch. Each query read again the protected rows at the start of the table. A short last page also caused one more query that found nothing. Now each message batch starts after the last candidate id of the previous page. A page with fewer than pruneBatchSize ids ends the run. The stop uses the page length, not the delete count, because the rechecked delete can remove fewer rows than the page held. This matches the Ruby message pruner after solid-objects-ruby#113. The retention predicate, the per-batch transaction, and the rechecked delete do not change, so the same messages are pruned. Instance and process pruning keep their current loop. There is no schema change. Closes #110
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge, with the previous fixture-type finding fully addressed. SummarySQL message pruning now resumes after the previous page’s last candidate id and stops after a short page.
Reviews (3) · Last reviewed commit: "Use concrete types for insertRows fixtur..." · Reviewed by Greptile |
|
Docs7 for cardmagic/solid-objects-js
Commit |
The insertRows test helper builds one multi-row INSERT for each chunk of rows. It did not check that each row has one value for each column. node:sqlite binds NULL to a placeholder that has no value, so a short row moved all the values after it into the wrong columns. The pruning tests could then pass or fail on data that the fixture did not define. The helper now stops with the table name, the row index, and the value count before it runs SQL. A new test shows that a short row causes an error and does not write a row.
Owner
Author
The insertRows test helper accepted unknown cell values, but every fixture only passes strings, numbers, or null. The repo rule is to use concrete types, so the cell type is now string | number | null.
Owner
Author
|
@greptileai review |
cardmagic
marked this pull request as ready for review
December 3, 2026 13:23
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
Operators who prune SQL message history are affected, through manual calls or scheduled retention. Message pruning now pages by id, and each batch starts after the last candidate id of the previous batch. The change is in
Repository#pruneRetentionfor themessagestarget insrc/repository.ts, with new tests intest/message-pruning.test.ts.The change applies when
runtime.retention.prune({ target: "messages" })or scheduled retention removes old messages. Each batch read the protected rows at the start of the table again, and a short last page caused one more empty query.Verification: The new paging, guard-matrix, and large-fixture tests pass, along with the existing retention tests, the type checks, and the Prettier check.
Related: #110