← Back to Pull requests

sds: abstract local index behind interface, add sds/view and support memory index #163

Closed
unknown closed this pull request without merging on Oct 04, 2026 11:25 UTC
View on GitHub
unknown unknown commented on Oct 04, 2026 01:11 UTC
Author

Description


This PR abstracts the local queryable index behind the sds.LocalIndex interface, moves the overlay of unapplied rows, read cache, and write-behind applier into the generic pkg/sds/view package, and updates ObjectFS controller to use this machinery with a selectable --metadata-index=sqlite|memory flag.

Key Changes


1. sds.LocalIndex Interface (pkg/sds/index.go):
- Defines the standard contract for a derived local stream view: Position(), SyncRegistry(), ApplyBatch(), Get(), Scan() (returning iter.Seq2[proto.Message, error]), and Close().
- Updated pkg/sds/projection/sqlite (sqlite.DB) and pkg/sds/memtable (memtable.MemStore) to implement sds.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/view Package (pkg/sds/view):
- Provides view.View wrapping any LocalIndex with 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.Scan yields 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 Volume to use sds.LocalIndex and view.View, removing SQLite-specific applier and overlay coupling from the filesystem layer.
- Replaced --metadata-store with --metadata-index=sqlite|memory (default sqlite).
- 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/view layer in docs/structured-data-streams.md.

Fixes #162

Diff: 265 lines (+198 / -67) across 3 files Reviewer: justinsb Review duration: 613m
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
0.39
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
56%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 39.3% (MEDIUM) · Higher = larger blast radius
39.3%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 56.8% · Lower = rushed or shallow review
56.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 17% · Safe to merge
17%