You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,39 @@ Conventional commits via `sr commit`:
31
31
32
32
Scope by crate: `feat(core):`, `feat(cli):`, `feat(server):`, `docs(spec):`.
33
33
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.
0 commit comments