sds: abstract local index behind interface, add sds/view and support memory index #163
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.39) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 265 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.334
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #163"
general
weight: 0.35
justinsb
Description
This PR abstracts the local queryable index behind the
sds.LocalIndexinterface, moves the overlay of unapplied rows, read cache, and write-behind applier into the genericpkg/sds/viewpackage, and updates ObjectFS controller to use this machinery with a selectable--metadata-index=sqlite|memoryflag.Key Changes
1.
sds.LocalIndexInterface (pkg/sds/index.go):- Defines the standard contract for a derived local stream view:
Position(),SyncRegistry(),ApplyBatch(),Get(),Scan()(returningiter.Seq2[proto.Message, error]), andClose().- Updated
pkg/sds/projection/sqlite(sqlite.DB) andpkg/sds/memtable(memtable.MemStore) to implementsds.LocalIndex.- Added snapshot publishing and restoration for
memtable.MemStore.- Added comprehensive conformance test suite (
pkg/sds/conformance_test.go) running against both SQLite and MemTable implementations.2. Generic
sds/viewPackage (pkg/sds/view):- Provides
view.Viewwrapping anyLocalIndexwith an in-memory overlay of unapplied mutations, a bounded LRU read cache, and a background write-behind applier.- Preserves transaction boundaries, handles coalescing of duplicate row updates, exponential backoff with retry, degraded state tracking, backpressure on lag, and starvation-free flush to position.
-
View.Scanyields 2-way merged rows in strict canonical key-byte order.- Added exhaustive unit and fault-injection tests running against both implementations.
3. ObjectFS Controller Migration:
- Refactored
Volumeto usesds.LocalIndexandview.View, removing SQLite-specific applier and overlay coupling from the filesystem layer.- Replaced
--metadata-storewith--metadata-index=sqlite|memory(defaultsqlite).- Added unit test coverage for memory metadata index mode with snapshot publish/restore and stream recovery.
4. Documentation & Spec:
- Added Section 10 ("Local Index Contract") to
docs/sds-spec.md.- Documented the Local Index concept and
sds/viewlayer indocs/structured-data-streams.md.Fixes #162