Repository navigation
Conversation
yeahjack
marked this pull request as ready for review
October 12, 2026 20:51
9 tasks done
📊 Automated PR Analysis
SummaryThis PR fixes a bug in RTK's SQLite recall store where repeating identical command output with different truncation hints would overwrite an earlier hint's offset, metadata, and retained bytes. It introduces immutable Review Checklist
Analyzed automatically by wshm · This is an automated analysis, not a human review. |
1 of 2 tasks
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.
Stack / review order
Depends on #4541 (
85fe79b282bd41097ae2f8b4ac93d63011acf194), which adds invocation/capture IDs and actual recall-output accounting. This PR targetsdevelopbecause the dependency branch is in a fork, so GitHub's full diff currently includes #4541. The stable-reference changes are the commits after that dependency in this stack. Please review/merge the dependency first, then rebase this PR; this is not an independent diff.Problem and reproduction
A recovery hint currently names
hash(command slug + original output). Repeating the same bytes overwrites the offset and metadata associated with an earlier hint. With finite storage caps, it can replace the saved bytes too.Two synthetic regressions fail on the base:
first\nsecond\nthird\nfourth\nwith first-hidden line 2, then capture it with first-hidden line 4. The original hint returns onlyfourth, instead ofsecond,third, andfourth.second\nthird\nbecomesfourth\n.Changes
c_<32-hex capture ID>references, reusing feat(tracking): link hook invocations and measure recall output #4541's random capture identity and invocation ownership.p_<full SHA-256>payload keys. The hash includes the command slug to preserve existing per-command aggregate-stat semantics. Payload bytes and codec are immutable; only retention time refreshes.--listprints usable capture references and retained legacy entries.Expired captures fail clearly rather than returning another run's output. Existing entry/retention limits and the bounded 1,000 capture-record limit still apply.
--fullreturns all bytes saved for that capture, subject to its original storage cap.This does not widen or migrate the legacy hash namespace, claim to recover already-overwritten legacy data, or supersede #4464's legacy-hash collision fix.
Validation
cargo fmt --all,cargo clippy --all-targets,cargo test --all: 4,399 passed, 8 ignored across 38 test binaries.cargo doc --no-depsandgit diff --check.--listexposes both capture references, and eviction/recapture leaves the old hint expired.Related storage work: #4537 (byte budget/GC) and #4540 (batch writes). Both use the same
recallpayload table; their transaction changes need reconciliation when integrating the stack. Because this PR retains the first payload encoding, #4537's test expecting a same-payload gzip-to-raw recapture to replace the encoded size must be updated to expect the retained size.Release spotcheck against the exact #4541 parent: 60 alternating warmed duplicate-grep captures (30 synthetic lines,
--max 1, separate stores) measured median 4.395 ms before and 4.511 ms after; p95 was 6.194 / 6.174 ms. These are noisy shared-cloud measurements, not a claimed speedup or comprehensive performance result.