Add comprehensive tests, benchmarks, and bug fixes#2
Merged
Conversation
Add dev dependencies required for comprehensive test coverage: - server: tower, tempfile, http-body-util, http for testing HTTP endpoints without network access - cli: tempfile, serde_json for testing CLI commands in isolated environments
Add bash script that runs all llmem CLI commands and server endpoints against a clean, isolated HOME directory. Reports pass/fail with timing for each operation. Requires release binaries to be built beforehand. Covers all command groups: init, config, memorize, note, remember, reflect, learn, consolidate, forget, ctx, and server endpoints (/health, /search, /reload). Exits with the count of failures for CI integration.
Add testing section to README with quick reference for running tests and E2E validation. Add comprehensive testing documentation to CONTRIBUTING.md including: - Instructions for running unit and integration tests - Per-crate test counts and coverage summary - Details on end-to-end validation script Documentation clarifies that tests are colocated with source except for CLI which uses dedicated integration.rs file.
When calculating days since access for memory consolidation, use the created_at timestamp if last_accessed is None. This ensures memories without explicit access times can still be consolidated correctly.
Extract router construction into build_router() function to enable testing the Axum application without a running server. Add comprehensive tests for /health, /search, and /reload endpoints including edge cases like empty results, matching memories, and parameter validation.
Add integration test suite covering all CLI commands: init, memorize, note, remember, reflect, consolidate, forget, ctx, and config. Tests verify JSON output, exit codes, file creation, and capacity limits using isolated temporary directories.
Add a new project_mem_dir field to AppState to cache the resolved project memory directory path instead of recomputing it on each request. This improves performance by: - Deriving the directory once during initialization and reload - Eliminating repeated path computations in search requests - Simplifying the search handler logic Update all AppState construction sites (main initialization, reload handler, and test helpers) to populate the new field. Update tests to use the new test_state_with_mem_dir() helper for cases that need to specify both root and memory directory independently.
Add benchmark suites for llmem-index (HNSW, IVF, distance functions) and llmem-quant (TurboQuant MSE/Prod, pack/unpack) using criterion. Add insta snapshot tests across core types (memory, index, inbox, config), server routes (health, search, reload), and CLI outputs (init, memorize, note, reflect, consolidate, config, forget).
Add docs/benchmarks.md with performance numbers for distance functions, HNSW, IVF-Flat, TurboQuant MSE/Prod, and bit packing. Embedded into README using embed-src markers for single-source-of-truth updates.
The embedded field depends on Ollama availability, which differs between local dev (true) and CI (false). Redact it for determinism.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
created_atwhenlast_accessedis not setTest plan
cargo testto verify all tests pass (117 total)cargo benchto verify benchmarks executelast_accessedgracefully