refactor: Replace string cache keys with type-safe primary key methods #141
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
Refactor the SQLite cache system to eliminate string-based cache keys and replace them with type-specific methods that accept primary key components directly.
Changes
Removed string-based cache key system:
cache_keys.py- no longer needed_parse_cache_key()method that parsed string keys_get_table_name()method for key-to-table mappingget(key),set(key, ...),delete(key)methodslist_keys()methodAdded type-specific methods to SQLiteCache:
PR Review cache:
get_pr_review(owner, repo, pull_number)→ Returns cached review dataset_pr_review(owner, repo, pull_number, data, ...)→ Stores review datadelete_pr_review(owner, repo, pull_number)→ Deletes review entryPR Metadata cache:
get_pr_metadata(owner, repo, pr_number)→ Returns cached PR metadataset_pr_metadata(owner, repo, pr_number, data, ...)→ Stores PR metadatadelete_pr_metadata(owner, repo, pr_number)→ Deletes PR metadataPR Index cache:
get_pr_index(owner, repo)→ Returns cached PR indexset_pr_index(owner, repo, data, ...)→ Stores PR indexdelete_pr_index(owner, repo)→ Deletes PR indexUpdated CacheManager:
Benefits
✅ Type-safe API - Explicit parameters with proper types instead of string keys
✅ No parsing overhead - Direct parameter usage, no string splitting/validation
✅ Clearer method signatures - Self-documenting what each method does
✅ Better IDE support - Autocomplete and type checking work perfectly
✅ Simpler code - Removed ~200 lines of key parsing logic
✅ More maintainable - Changes to primary keys are compiler-checked
Test Plan
🤖 Generated with Claude Code