feat(F6): FNV-1a scent with scent_u64 accessor + birthday collision tests#303
Conversation
Replace the Phase-A XOR-fold scent stub with a proper FNV-1a hash of the canonical hex path string, folded to u8. This avoids pulling bgz-tensor into the callcenter dep tree while providing better avalanche properties than raw XOR of segment hashes. - Add `DnPath::scent()` using FNV-1a of hex-rendered segment hashes - Keep `scent_stub()` as `#[deprecated]` alias delegating to `scent()` - Update `lance_membrane.rs` caller to use `scent()` directly - Add tests: deterministic, different-paths, empty-path, alias parity https://claude.ai/code/session_01NYGrxVopyszZYgLBxe4hgj
Replace the Phase-A XOR-fold scent stub with a proper FNV-1a hash of the canonical hex path string, folded to u8. This avoids pulling bgz-tensor into the callcenter dep tree while providing better avalanche properties than raw XOR of segment hashes. - Add `DnPath::scent()` using FNV-1a of hex-rendered segment hashes - Keep `scent_stub()` as `#[deprecated]` alias delegating to `scent()` - Update `lance_membrane.rs` caller to use `scent()` directly - Add tests: deterministic, different-paths, empty-path, alias parity https://claude.ai/code/session_01NYGrxVopyszZYgLBxe4hgj
…x collision tests
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b5370a55b7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /// dispatch. | ||
| pub fn scent_u64(&self) -> u64 { | ||
| use core::fmt::Write; | ||
| let mut buf = String::with_capacity(6 * 17); |
There was a problem hiding this comment.
Avoid heap allocation in per-intent scent calculation
LanceMembrane::ingest() computes a scent for every incoming intent, and scent() now routes through scent_u64() which builds a String and formats six hex segments on each call. In high-throughput or realtime ingestion, this introduces repeated heap allocation and formatting overhead on a hot path that was previously allocation-free, which can noticeably increase latency and reduce throughput. Hashing the segment words directly (or via a fixed stack buffer) would keep the new semantics without adding per-event allocation churn.
Useful? React with 👍 / 👎.
Summary
scent(): replacesscent_stubXOR-fold with FNV-1a hash of canonical hex path, folded to u8. Deprecatedscent_stub()alias preserved.scent_u64(): exposes the full 64-bit FNV-1a digest before folding — CAM-PQ Phase C downstream needs the unfolded bits for HHTL routinglance_membrane.rsupdated fromscent_stub()toscent()Test plan
scent_deterministic— same path → same scentdifferent_paths_different_scents— distinct leaf segments produce different scentsempty_path_defined_value— edge casescent_stub_alias_matches_scent— deprecated alias parityscent_u64_fold_matches_scent— sanity:scent()== XOR-fold ofscent_u64()scent_distribution_100_paths_low_collision— 100 paths into 256 buckets → ≥50 unique (birthday paradox distribution test)scent_u64_distribution_100_paths_all_unique— 64-bit codomain zero-collision across 100 pathshttps://claude.ai/code/session_01NYGrxVopyszZYgLBxe4hgj
Generated by Claude Code