Repository navigation
perf(store): index latest version lookups - #87
Merged
Merged
Conversation
earakely-scale
approved these changes
Oct 7, 2026
Collaborator
|
Another good PR, thanks @morluto ! |
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.
Closes #86
Latest-version reads now use SQLite's existing
(id, version)index and decode one document. The typed store and namespace router use the same hook; custom stores retain the existing concrete fallback. Exact-version reads and version-conflict retries retain their semantics.Latest get
Local medians on Python 3.12.13/macOS arm64; full
VersionedEntityStoreAPIs, 128-byte payloads and 1,000 unrelated IDs. Baseline methods come directly from05b3310; equivalent fixtures and alternating measurement order. Put samples append 84 versions. These are synthetic local results, not cloud or end-to-end task timings.Profile proof: 100 latest gets over 1,000 versions decode 100,000 → 100 documents.
EXPLAIN QUERY PLANconfirms the compound index; returned latest/exact entities and allocated versions match.Reproduce:
PYTHONPATH=src:packages/agentenv-protocol/src .venv/bin/python tst/benchmarks/version_lookup.pyValidation: 6,325 unit/protocol tests passed, 13 existing capability skips; plugin API check passed. Independent correctness and maintainability reviews are clean.
The PR appears safe to merge; the earlier benchmark error is addressed and no new actionable issue was established.
What we checked:
Summary
This PR adds an indexed latest-version lookup for SQLite, reducing work on long version histories while keeping exact-version reads unchanged.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A[Versioned entity store] --> B[Latest-version hook] B --> C[SQLite indexed read] B --> D[Other store fallback] B --> E[Namespace router] E --> C E --> DReviews (2) · Last reviewed commit: "test(benchmark): cover shallow baseline ..." · Reviewed by Greptile