Skip to content

fix(cache): make simhash hamming threshold configurable via TOML (T-P4-fix)#267

Merged
Destynova2 merged 1 commit intomainfrom
fix/simhash-threshold-config
Apr 25, 2026
Merged

fix(cache): make simhash hamming threshold configurable via TOML (T-P4-fix)#267
Destynova2 merged 1 commit intomainfrom
fix/simhash-threshold-config

Conversation

@Destynova2
Copy link
Copy Markdown
Contributor

Summary

  • Adds [cache].simhash_threshold (u32, default 3) so operators can trade fuzzy hit rate against false positives without recompiling.
  • SimHashCache::with_threshold() already existed; ResponseCache::new() now takes the threshold and forwards it.
  • Closes the T-P4-fix item from Phase P (routing intelligent).

Changes

  • src/cli/config/cache.rs: new field with serde default + 3 unit tests (parse, default-when-absent, Default impl)
  • src/cache/response_cache.rs: constructor signature gains simhash_threshold: u32
  • src/server/init.rs: passes config.cache.simhash_threshold and logs it on startup
  • tests/integration/cache_test.rs: 5 callers updated

Test plan

  • `cargo check --lib` — clean
  • `cargo clippy --lib --tests -- -D warnings` — clean
  • `cargo test --lib cache::` — 33 passed (incl. 3 new)
  • All prek pre-commit + pre-push hooks green
  • CI passes (auto-merge enabled below)

Migration

Backward compatible: omitting simhash_threshold from [cache] keeps the previous behavior (threshold = 3).

…4-fix)

Adds [cache] simhash_threshold (u32, default 3) so operators can trade
fuzzy hit rate against false positives without recompiling. The
SimHashCache constructor with_threshold() already existed; ResponseCache
now wires it from CacheConfig.simhash_threshold.

- src/cli/config/cache.rs: new field with serde default + tests
- src/cache/response_cache.rs: constructor takes simhash_threshold
- src/server/init.rs: passes config.cache.simhash_threshold + logs it
- tests/integration/cache_test.rs: callers updated
@Destynova2 Destynova2 enabled auto-merge April 25, 2026 18:23
@Destynova2 Destynova2 merged commit f4c9882 into main Apr 25, 2026
42 checks passed
@Destynova2 Destynova2 deleted the fix/simhash-threshold-config branch April 25, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant