fix(stores): add caching to CliSettings.load() to reduce disk I/O#762
fix(stores): add caching to CliSettings.load() to reduce disk I/O#762github-actions[bot] wants to merge 3 commits into
Conversation
Addresses item from code quality report. - Added @lru_cache to _load_cli_settings() function - Cache is keyed by config file path for test isolation - Cache is automatically invalidated when save() is called - Added invalidate_cache() class method for explicit cache clearing Closes #761 Co-authored-by: openhands <openhands@all-hands.dev>
|
@OpenHands make an empty commit to kick in CI, then /codereview this PR and /iterate to green and approved from AI reviewer bot |
|
I'm on it! enyst can track my progress at all-hands.dev |
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
enyst
left a comment
There was a problem hiding this comment.
🟢 Good taste - Simple, targeted cache extraction with explicit invalidation and path-keyed isolation.
The implementation keeps the persistence behavior intact while removing repeated disk reads from hot call sites. save() clears the cache, callers that need to observe out-of-band file edits now have CliSettings.invalidate_cache(), and the added unit coverage exercises cache hits, explicit invalidation, save invalidation, and path-key isolation.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟢 LOW
Small, localized settings-store change with no public API removal. The main behavioral change is intentional caching; the invalidation path and tests cover the practical stale-read cases.
VERDICT:
✅ Worth merging: Core logic is sound and now has focused regression coverage.
KEY INSIGHT:
The right abstraction here is keeping disk I/O behind a single cached loader while making invalidation explicit at every write boundary.
This review was created by an AI agent (OpenHands) on behalf of the requester.
|
Since the last summary, there were no additional repository or PR changes. Checklist:
|
Summary
Adds LRU caching to
CliSettings.load()to prevent repeated disk reads when loading CLI settings.Changes
@lru_cacheto internal_load_cli_settings()functionsave()is calledinvalidate_cache()class method for explicit cache clearingRelated Issue
Addresses findings from #761 (Code Quality Report - Low-Hanging Fruit)
Testing
make lint)make test- 1353 tests)This PR was automatically generated by the Code Quality Report workflow.
🚀 Try this PR