Skip to content
This repository was archived by the owner on May 13, 2026. It is now read-only.

fix: improve discovery anonymity gate — token-level entropy, address NER, phone dot separator - #441

Merged
github-actions[bot] merged 4 commits into
mainlinefrom
fix/discovery-anonymity-p0-p1
Mar 30, 2026
Merged

fix: improve discovery anonymity gate — token-level entropy, address NER, phone dot separator#441
github-actions[bot] merged 4 commits into
mainlinefrom
fix/discovery-anonymity-p0-p1

Conversation

@shiba4life

Copy link
Copy Markdown
Collaborator

Summary

  • Token-level entropytoken_entropy() now measures word diversity (Shannon entropy over whitespace-delimited tokens) instead of byte-level entropy. Recalibrated threshold from 2.0 to 1.5 bits.
  • Address NER detection — New has_address() detects street address patterns (number + suffix like St, Avenue, Blvd). Required by design doc but was missing.
  • Phone dot separatorhas_phone() now recognizes 555.123.4567 format (added . to valid separators).
  • New tests for Unicode entropy equivalence, address detection, and dot-separated phones.

Test plan

  • All 18 anonymity tests pass (cargo test --lib -- anonymity)
  • Clippy clean (cargo clippy --workspace --all-targets -- -D warnings)
  • CI passes

🤖 Generated with Claude Code

…NER, phone dot separator

- Change token_entropy() from byte-level to token-level Shannon entropy
  (measures word diversity, not character diversity)
- Recalibrate MIN_ENTROPY_BITS from 2.0 to 1.5 for token-level metric
- Add has_address() NER detection for street address patterns
- Add '.' as valid phone number separator
- Add tests for all new detection patterns

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
github-actions Bot enabled auto-merge (squash) March 30, 2026 16:07
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

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

Copy link
Copy Markdown

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: 1b256d411b

ℹ️ 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".

Comment thread src/db_operations/native_index/anonymity.rs Outdated
Comment thread src/db_operations/native_index/anonymity.rs Outdated
shiba4life and others added 2 commits March 30, 2026 09:19
…nces

- Use char_indices().rev() instead of byte offset for preceding-text
  window, preventing panic on multi-byte UTF-8 codepoints
- Loop over all occurrences of each street suffix (not just first match)
  to avoid false negatives when the first occurrence lacks a number
- Add tests for Unicode input and second-occurrence address patterns

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
github-actions Bot merged commit ab7597f into mainline Mar 30, 2026
2 checks passed
@github-actions
github-actions Bot deleted the fix/discovery-anonymity-p0-p1 branch March 30, 2026 16:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant