Skip to content

Commit db3e829

Browse files
authored
Merge pull request #2 from urmzd/feat/testing-and-fixes
Add comprehensive tests, benchmarks, and bug fixes
2 parents 6dbe4e6 + 076c74e commit db3e829

40 files changed

Lines changed: 2371 additions & 19 deletions

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
sleep 30
8989
publish llmem-index
9090
sleep 30
91-
publish llmem-cli
91+
publish llmem
9292
sleep 30
9393
publish llmem-server
9494
@@ -150,7 +150,7 @@ jobs:
150150
if [ "${{ matrix.cross }}" = "true" ]; then
151151
BUILD_CMD="cross"
152152
fi
153-
$BUILD_CMD build --release --target ${{ matrix.target }} -p llmem-cli
153+
$BUILD_CMD build --release --target ${{ matrix.target }} -p llmem
154154
$BUILD_CMD build --release --target ${{ matrix.target }} -p llmem-server
155155
shell: bash
156156

CONTRIBUTING.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,39 @@ Conventional commits via `sr commit`:
3131

3232
Scope by crate: `feat(core):`, `feat(cli):`, `feat(server):`, `docs(spec):`.
3333

34+
## Testing
35+
36+
### Unit and integration tests
37+
38+
Run the full test suite with:
39+
40+
```bash
41+
cargo test --workspace
42+
# or
43+
just test
44+
```
45+
46+
Tests are colocated with their source in `#[cfg(test)]` modules, except for the CLI which uses a dedicated file at `crates/llmem-cli/tests/integration.rs`.
47+
48+
| Crate | Tests | What is covered |
49+
|-------|-------|-----------------|
50+
| `llmem-core` | 21 | Config TOML roundtrip and dot-notation get/set; embedding store binary format and hash-based change detection; inbox capacity eviction and JSON persistence; MEMORY.md index parsing, search, and save; memory file frontmatter parsing and markdown roundtrip; `FileBackend` store/get/remove/list |
51+
| `llmem-index` | 16 | HNSW insert, remove, save/load, and recall ≥ 90% on 200 vectors; IVF-Flat insert, remove, save/load, and recall ≥ 85% on 200 vectors; cosine similarity, dot product, L2 distance, and normalization; tree-sitter Rust chunking and language-extension mapping |
52+
| `llmem-quant` | 39 | Lloyd-Max codebook structure and scalar quantize/dequantize at 1–4 bits; bit-packing roundtrip for 1–4 bits including non-byte-aligned counts; `TurboQuantMse` roundtrip MSE, norm preservation, zero vector, and empirical MSE against theoretical bound; `TurboQuantProd` unbiased inner-product property and fast estimate; QJL determinism and unbiased inner-product property; rotation orthogonality, forward/inverse roundtrip, and norm preservation; compressed embedding store save/load for MSE and Prod variants |
53+
| `llmem-server` | 6 | HTTP handler tests using `tower::ServiceExt::oneshot` (no network): `/health` status and version fields; `/search` empty state, text matching, `top_k` truncation, and level filtering; `/reload` response |
54+
| `llmem-cli` | 15 | End-to-end CLI tests that spawn the binary as a subprocess: `init`, `memorize` (with type, name, and stdin JSON), `note` (inbox capacity enforcement), `remember` (match and no-match), `reflect`, `consolidate` (dry-run and real), `forget` (success and nonexistent), `ctx switch`/`show`, `config init`/`get`/`set` |
55+
56+
### End-to-end validation
57+
58+
`scripts/validate.sh` runs every CLI command and the RAG server against a clean, isolated `$HOME` directory and reports pass/fail with timing for each operation. It requires release binaries built beforehand:
59+
60+
```bash
61+
cargo build --release
62+
bash scripts/validate.sh
63+
```
64+
65+
The script covers all command groups in order — `init`, `config`, `memorize`, `note`, `remember`, `reflect`, `learn`, `consolidate`, `forget`, `ctx`, and the server endpoints (`/health`, `/search`, `/reload`) — and exits with the number of failures as its exit code.
66+
3467
## Pull Requests
3568

3669
1. Fork the repository

0 commit comments

Comments
 (0)