feat: production-ready polish#53
Merged
Merged
Conversation
- Add local hash-based embedding provider (providers/local/) for testing without API keys. Deterministic FNV hashing, L2-normalised, with WithLocalProvider option. - Remove centralized errors/ package. Move sentinel errors to owning packages: ErrClosed/ErrZeroKey/ErrInvalidN in root package, ErrNilBackend/ErrNilProvider/ErrNilComparator in options package. - Add comprehensive backend tests (backends/inmemory/backend_test.go): CRUD, eviction, overwrite, flush, interface compliance checks for all three backends (LRU, LFU, FIFO). - Add benchmarks: backend Set/Get/Keys benchmarks, cache-level Set/Get/ Lookup/TopMatches benchmarks. - Rewrite README.md: concise, no emojis, accurate API reference matching current architecture (sync-only, no async docs). - Add README.md and AGENTS.md to every module: types, options, backends, backends/inmemory, backends/remote, providers, providers/openai, providers/local, similarity, chunker, tokenizer. - Update root CLAUDE.md and AGENTS.md: fix import paths (botirk38 not botirkhaltaev), document current architecture and error conventions. - Fix CONTRIBUTING.md: types.CacheBackend -> types.Backend. - Add Makefile with test, test-race, bench, vet, fmt, lint, build, check. - Add example program (examples/basic/) using local provider. Co-Authored-By: Botir Khaltaev <btrghstk@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: Botir Khaltaev <btrghstk@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Production-readiness improvements in a single PR. No API changes to Cache[K,V] itself.
New features:
providers/local/-- hash-based embedding provider for testing without API keys. Deterministic FNV hashing, L2-normalised. Newoptions.WithLocalProvideroption.examples/basic/-- runnable example using the local provider.Makefile--make test,make test-race,make bench,make lint,make check.Architecture cleanup:
errors/package. Sentinel errors moved to owning packages:ErrClosed/ErrZeroKey/ErrInvalidNin root,ErrNilBackend/ErrNilProvider/ErrNilComparatorinoptions/.CONTRIBUTING.mdreference totypes.CacheBackend(nowtypes.Backend).Test coverage:
backends/inmemory/backend_test.go-- CRUD, eviction, overwrite, flush, interface compliance for LRU/LFU/FIFO.backends/inmemory/bench_test.go-- Set/Get/Keys benchmarks for all three backends.cache_bench_test.go-- Set/Get/Lookup/TopMatches benchmarks at the cache level.providers/local/local_test.go-- determinism, dimensions, normalisation, batch.Documentation:
README.md-- concise, no emojis, accurate API reference (sync-only).README.md(human docs) andAGENTS.md(agent instructions) to every module: types, options, backends, backends/inmemory, backends/remote, providers, providers/openai, providers/local, similarity, chunker, tokenizer.CLAUDE.mdandAGENTS.md-- fixed import paths (botirk38), documented current architecture and error conventions.Review & Testing Checklist for Human
errors/package deletion doesn't break any downstream code you have outside this repo that importedgithub.com/botirk38/semanticcache/errorsgo run ./examples/basic/to confirm the example worksmake check(builds, tests with race detector, vet, fmt)Notes
errors/package removal is a breaking change for anyone who imported it directly. Since this is pre-1.0 and you confirmed no backward compat is needed, this is intentional.Link to Devin session: https://app.devin.ai/sessions/1ffef0a58ad440e9aa7f1b64e537a98f
Requested by: @botirk38