Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 11 additions & 29 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,47 +87,29 @@ jobs:
- name: Run distance benchmarks
working-directory: crates/ruvector-postgres
run: |
set -o pipefail
cargo bench --features pg17 --bench distance_bench -- --output-format bencher | tee ../../distance_bench.txt

- name: Run index benchmarks
- name: Compile-check remaining standalone benchmarks
working-directory: crates/ruvector-postgres
run: |
cargo bench --features pg17 --bench index_bench -- --output-format bencher | tee ../../index_bench.txt

- name: Run quantization benchmarks
working-directory: crates/ruvector-postgres
run: |
cargo bench --features pg17 --bench quantization_bench -- --output-format bencher | tee ../../quantization_bench.txt

- name: Run quantized distance benchmarks
working-directory: crates/ruvector-postgres
run: |
cargo bench --features pg17 --bench quantized_distance_bench -- --output-format bencher | tee ../../quantized_distance_bench.txt
set -o pipefail
cargo bench --features pg17 \
--bench e2e_bench \
--bench hybrid_bench \
--bench index_bench \
--bench integrity_bench \
--no-run |& tee ../../benchmark_smoke.txt

- name: Upload benchmark results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: benchmark-results
path: |
distance_bench.txt
index_bench.txt
quantization_bench.txt
quantized_distance_bench.txt
benchmark_smoke.txt
retention-days: 30

- name: Store benchmark result
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: benchmark-action/github-action-benchmark@52576c92bccf6ac60c8223ec7eb2565637cae9ba
with:
name: Rust Benchmarks
tool: 'cargo'
output-file-path: distance_bench.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: '150%'
comment-on-alert: true
fail-on-alert: true

- name: Generate benchmark summary
run: |
cat > benchmark_summary.md <<EOF
Expand Down Expand Up @@ -308,8 +290,8 @@ jobs:
- name: Run baseline benchmarks
working-directory: crates/ruvector-postgres
run: |
set -o pipefail
cargo bench --features pg17 --bench distance_bench -- --output-format bencher | tee ../../baseline_distance.txt
cargo bench --features pg17 --bench index_bench -- --output-format bencher | tee ../../baseline_index.txt

- name: Compare results
run: |
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/hooks-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ jobs:
- name: Install dependencies
run: |
# Copy CLI package to temp location to avoid workspace interference
workspace="$PWD"
cp -r npm/packages/cli /tmp/cli
cd /tmp/cli
npm install --ignore-scripts
cp -r node_modules $GITHUB_WORKSPACE/npm/packages/cli/
cp -r node_modules "$workspace/npm/packages/cli/"

- name: Build CLI
working-directory: npm/packages/cli
Expand Down Expand Up @@ -193,10 +194,11 @@ jobs:
run: |
cargo build -p ruvector-cli --release
# Install CLI deps in temp to avoid workspace interference
workspace="$PWD"
cp -r npm/packages/cli /tmp/cli
cd /tmp/cli && npm install --ignore-scripts && npm run build
cp -r /tmp/cli/node_modules npm/packages/cli/
cp -r /tmp/cli/dist npm/packages/cli/
cp -r /tmp/cli/node_modules "$workspace/npm/packages/cli/"
cp -r /tmp/cli/dist "$workspace/npm/packages/cli/"

- name: Compare command counts
run: |
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/postgres-extension-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,15 @@ jobs:
set -o pipefail
cargo bench --no-default-features --features pg17 \
--bench distance_bench \
--bench e2e_bench \
--bench hybrid_bench \
--bench index_bench \
--bench integrity_bench \
-- --output-format bencher | tee benchmark-output.txt
working-directory: crates/ruvector-postgres

- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@52576c92bccf6ac60c8223ec7eb2565637cae9ba
- name: Upload benchmark result
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: Rust Benchmark
tool: 'cargo'
output-file-path: crates/ruvector-postgres/benchmark-output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: false
name: postgres-extension-benchmark
path: crates/ruvector-postgres/benchmark-output.txt
retention-days: 30

# Security audit
security:
Expand Down Expand Up @@ -297,6 +291,7 @@ jobs:
context: .
file: crates/ruvector-postgres/Dockerfile
push: false
load: true
tags: ruvector-postgres:test
cache-from: type=gha
cache-to: type=gha,mode=max
Expand Down
17 changes: 4 additions & 13 deletions .github/workflows/ruvector-postgres-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,21 +376,12 @@ jobs:

- name: Run benchmarks
run: |
cargo bench --features pg17 -- --output-format bencher | tee benchmark-results.txt
set -o pipefail
cargo bench --no-default-features --features pg17 \
--bench distance_bench \
-- --output-format bencher | tee benchmark-results.txt
working-directory: crates/ruvector-postgres

- name: Store benchmark results
uses: benchmark-action/github-action-benchmark@52576c92bccf6ac60c8223ec7eb2565637cae9ba
with:
name: RuVector-Postgres Benchmarks
tool: 'cargo'
output-file-path: crates/ruvector-postgres/benchmark-results.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: false
alert-threshold: '150%'
comment-on-alert: true
fail-on-alert: false

- name: Upload benchmark artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
Expand Down
43 changes: 40 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,14 @@ members = [
"crates/ruvector-timesfm",
# Speculative ANN search: draft-verify with adaptive candidate multiplier (ADR-272)
"crates/ruvector-speculative-ann",
# Hierarchical cluster-summary retrieval for agent-memory RAG (ADR-300)
"crates/ruvector-cluster-rag",
# S-T mincut namespace routing for multi-namespace search (ADR-299)
"crates/ruvector-namespace-merge",
# Semantic query-result reuse for repeated agent-memory queries (ADR-301)
"crates/ruvector-query-cache",
# Reservoir-sampled adaptive product quantization under drift (ADR-302)
"crates/ruvector-streaming-qng",
]
resolver = "2"

Expand Down Expand Up @@ -321,7 +329,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

# Node.js bindings
napi = { version = "2.16", default-features = false, features = ["napi9", "async", "tokio_rt"] }
napi = { version = "2.16", default-features = false, features = ["napi9", "async", "tokio_rt", "dyn-symbols"] }
napi-derive = "2.16"

# WASM
Expand Down
2 changes: 1 addition & 1 deletion crates/ruvector-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ tokio-postgres = { version = "0.7", optional = true }
deadpool-postgres = { version = "0.14", optional = true }

# LRU cache for performance optimization
lru = "0.16"
lru = "0.18"

# Compression for storage
flate2 = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/ruvector-cli/src/mcp/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ mod tests {

let result = handler.validate_path("test.db");
assert!(result.is_ok(), "Should allow relative path within data dir");
assert!(result.unwrap().starts_with(dir.path()));
assert!(result.unwrap().starts_with(&handler.allowed_data_dir));
}

#[test]
Expand Down Expand Up @@ -886,7 +886,7 @@ mod tests {
"Should allow path in subdirectory: {:?}",
result
);
assert!(result.unwrap().starts_with(dir.path()));
assert!(result.unwrap().starts_with(&handler.allowed_data_dir));
}

#[test]
Expand Down
21 changes: 21 additions & 0 deletions crates/ruvector-cluster-rag/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "ruvector-cluster-rag"
version.workspace = true
edition.workspace = true
authors.workspace = true
license.workspace = true
repository.workspace = true
description = "Hierarchical cluster-summary retrieval for RuVector: RAPTOR-style two-level tree with coherence-weighted cluster scoring for agent memory RAG"
readme = "README.md"
keywords = ["vector-search", "rag", "cluster", "agent-memory", "hierarchical"]
categories = ["algorithms", "data-structures"]

[[bin]]
name = "benchmark"
path = "src/bin/benchmark.rs"

[dependencies]

[lints.rust]
dead_code = "allow"
unused_variables = "allow"
13 changes: 13 additions & 0 deletions crates/ruvector-cluster-rag/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ruvector-cluster-rag

Experimental hierarchical retrieval over a two-level tree of leaf vectors and
k-means cluster summaries. It includes exhaustive, IVF-style, and
coherence-weighted search variants.

```bash
cargo test -p ruvector-cluster-rag
cargo run --release -p ruvector-cluster-rag --bin benchmark
```

Clustered variants are approximate. Tune the cluster count, probe count, and
coherence weight against workload-specific recall and latency targets.
Loading
Loading