Skip to content

feat(F6): FNV-1a scent with scent_u64 accessor + birthday collision tests#303

Merged
AdaWorldAPI merged 3 commits into
mainfrom
claude/pr-f6-dn-path-scent
Apr 30, 2026
Merged

feat(F6): FNV-1a scent with scent_u64 accessor + birthday collision tests#303
AdaWorldAPI merged 3 commits into
mainfrom
claude/pr-f6-dn-path-scent

Conversation

@AdaWorldAPI
Copy link
Copy Markdown
Owner

Summary

  • scent(): replaces scent_stub XOR-fold with FNV-1a hash of canonical hex path, folded to u8. Deprecated scent_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 routing
  • No new deps: FNV-1a implemented inline (2 constants, no crate needed)
  • Caller migrated: lance_membrane.rs updated from scent_stub() to scent()

Test plan

  • scent_deterministic — same path → same scent
  • different_paths_different_scents — distinct leaf segments produce different scents
  • empty_path_defined_value — edge case
  • scent_stub_alias_matches_scent — deprecated alias parity
  • scent_u64_fold_matches_scent — sanity: scent() == XOR-fold of scent_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 paths
  • 10/10 dn_path tests pass, 70 callcenter tests pass

https://claude.ai/code/session_01NYGrxVopyszZYgLBxe4hgj


Generated by Claude Code

claude added 3 commits April 29, 2026 20:00
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
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@AdaWorldAPI AdaWorldAPI merged commit 5fc9e4d into main Apr 30, 2026
1 of 5 checks passed
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.

2 participants