Skip to content

feat: scale bounded query rewriting - #8

Draft
hyeonsangjeon wants to merge 1 commit into
mainfrom
codex/similar-repo-improvements
Draft

feat: scale bounded query rewriting#8
hyeonsangjeon wants to merge 1 commit into
mainfrom
codex/similar-repo-improvements

Conversation

@hyeonsangjeon

Copy link
Copy Markdown
Owner

What changed

  • Replaced the Python Levenshtein hot path with RapidFuzz while preserving distance semantics, added a bounded deterministic candidate LRU, Unicode NFC/NFKC policy, and immutable atomic index snapshots.
  • Added bounded rewrite_many() and map_sentences() APIs, stronger Microsoft Foundry terminal-status handling, batch-aware evaluation, and a reproducible 10k-term benchmark.
  • Preserved V1 mutable attributes and pickle/deepcopy behavior, including migration of v2.0.1 plain-state pickles.
  • Documented the similar-repository review, architecture decision, cache privacy tradeoff, and self-contained batch usage in README and GitHub Pages.

Why

Candidate retrieval scaled linearly through a Python dynamic-programming implementation, concurrent mapping updates could expose partial indexes, short canonical terms could hide valid typo candidates, and incomplete Foundry responses could be treated as valid decisions. Similar projects support keeping the existing bounded candidate-selection architecture while accelerating deterministic retrieval and adding controlled batch concurrency.

Impact

Large vocabularies get substantially faster candidate lookup, online batches preserve input order and per-sentence traces, and V1 callers keep their public mutation and serialization patterns. Provider outputs and full sentences are not cached; normalized lexical tokens remain in the bounded LRU unless candidate_cache_size=0 is used.

Validation

  • Python 3.11 and fresh Python 3.13: 118 passed, 1 integration test deselected, 163 subtests
  • Ruff 0.15.22 and 0.16.2
  • Offline golden evaluation: 15/15, exact accuracy 1.0, false rewrite rate 0.0
  • Docs validator and JavaScript syntax check
  • 10,000-term benchmark: about 7.8 ms cold and 0.002 ms cached median on the development machine
  • wheel and sdist build, Twine check, pip check, and fresh-wheel smoke test

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