feat(server): cache physical inputs across workspaces - #110
Merged
Conversation
|
| Filename | Overview |
|---|---|
| crates/server/src/scan.rs | Integrates physical-input cache lookup and storage, stable-file rescanning, and bounded Postcard serialization; the prior payload-limit concern is addressed. |
| crates/server/src/cache.rs | Implements the transactional SQLite store, producer isolation, epoch-protected clearing, corruption recovery, and retention pruning. |
| crates/server/src/backend.rs | Updates cache-path reporting and clear/rebuild commands to operate on the shared cache. |
| Cargo.toml | Adds the SQLite, Postcard, and hashing dependencies required by the new cache implementation. |
Reviews (3): Last reviewed commit: "fix(server): bound cache payload seriali..." | Re-trigger Greptile
Owner
Author
Owner
Author
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.
Problem
The persistent index cache introduced in #33 and optimized in #95 is still keyed by the complete workspace/base-root set. That makes the expensive analysis of an unchanged
baseIniRootsinput unusable as soon as the user opens another workspace, adds or reorders a root, or changes a root's role.A cache per root would reduce some misses, but roots are discovery/configuration boundaries rather than ownership boundaries: roots can overlap, the same physical file can move between base and workspace roles, and a large root changing should not invalidate every unchanged file inside it.
Design
Replace the root-set JSON cache with one shared, transactional cache of physical inputs:
This retains the warm-start work from #95 while removing the root-set coupling. It also supersedes the old multi-file retention model from #93 and preserves the clear/rebuild behavior restored in #65.
Correctness and recovery
index-v*-<hash>.jsonfiles are removed only after the new store commits successfully.Retention
Performance
Local release-mode regression test with 256 tiny INI inputs:
The warm path still performs directory discovery and inexpensive file metadata checks, but it avoids rereading, parsing, extracting, serializing, and rewriting unchanged inputs. Manual testing against real game data also confirmed a large startup improvement.
Tests
New regression coverage includes:
Validation:
cargo test— 205 passed, 2 corpus-dependent tests ignoredcargo clippy --workspace --all-targets -- -D warningscargo fmt --all -- --check