Integration robustness contracts #710
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 599 lines diff across 7 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.383
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #710"
general
weight: 0.35
MarkWolters
Synopsis
This is a set of changes to make the embedding layer between JVector an hosting runtimes more robust, visible, and efficient. The aspects addressed here are those which we haven't been prescriptive enough about for embedding systems.
Most essentially, these contracts and supporting types and wrappers are used by embeding systems to instruct JVector where and how to do certain things, like writing index outputs, or using thread pools.
The aspects covered in this set include execution controls, rate-limiting, output vectoring (virtualization), runtime-safety checks on non-runtime debugging features, and memory safety.
Why
Jvector today assumes it owns its execution, its output files, and its process. When it runs embedded in a host that manages its own thread pools, IO budget, mmap lifecycle, and cancellation — e.g. Cassandra's SAI vector indexing driving compaction — those assumptions leak:
ForkJoinPool.commonPool()/PhysicalCoreExecutor.pool(), outside the host's budget;This PR adds the extension points a host needs to close those gaps. It is purely additive and opt-in — no existing behavior changes, and nothing in jvector consumes these seams yet. It's the foundation an embedding/compaction effort builds on; a follow-up PR illustrates how the compactor's calling conventions convert onto these seams.
What's in it, in detail
Five contracts, one per commit:
1. Cooperative work-limiting + progress (
util/work/) —ProgressLimiter=ProgressTracker(progress up) +WorkLimiter(throttle down), withWorkStagefor phase scoping andLeakyBucketLimiteras a default rate-limited limiter. A host installs one to observe and rate-limit a long jvector operation, and to checkpoint cancellation at phase boundaries.2. Pluggable output sink (
disk/) —SeekableSink+CompactionDestination(with file-backed defaults) let a host redirect compaction output through a caller-owned channel — e.g. a slot inside a larger container after a reserved header — instead of jvector always allocating its own file.Targethas an explicitopen → commit → closelifecycle (nocommit()⇒ aborted, partial output discarded).3.
ParallelExecutor(graph/) — a minimal parallel-for abstraction so a host supplies its own pool (forkJoin(pool)) or runs inline (callerRuns()), instead of jvector reaching for the common pool.4.
RuntimeMode(util/) — a process-leveljvector.modegate. Unset is production; diagnostic-only work is opt-in behind it.5. Reader memory-safety (
disk/) — bounded record reads inOnDiskGraphIndex(an out-of-range node id fails withIllegalArgumentExceptioninstead of becoming a wild offset into the mapped file), plus documenting theclose()contract onReaderSupplier/SimpleMappedReader(the raw-release-immediate-unmap vs. coordinated-liveness-handshake families) so a host knows not to close a supplier while any vended reader is live.Design principles
--release 11. Everything lands injvector-base(bytecode v55), so it runs on every supported JDK (11–25). NoMETA-INF/versions/overrides, no incubator Vector API use — no per-runtime divergence.- Seams only, no consumers. Nothing in jvector calls these yet, so the PR reviews in isolation and adoption can land separately.
Deliberately not* here
No changes to the compactor or its algorithm, no new call sites, no host-specific code. Adoption is the follow-up PR.
Testing
jvector-basecompiles at--release 11. New unit tests coverProgressLimiter,SeekableSink, andRuntimeMode. The only edits to existing files are non-breaking (Javadoc onReaderSupplier/SimpleMappedReader, an internal bounds check inOnDiskGraphIndex).Stats: 17 files, +1346/−3 (the 3 deletions are lines replaced by the
OnDiskGraphIndexbounds check).Commits
util/work: cooperative work-limiting and progress interfacedisk: pluggable output sink for compaction writesgraph: ParallelExecutor abstraction for host-provided executionutil: RuntimeMode gate for opt-in diagnostic workdisk: memory-safety guards for host-managed reads