Fix adapted cache deserialization recovery - #129
Conversation
|
👋 @Fryuni Thanks for your contribution! The approval and merge process is almost fully automated 🧙 Here's how it works:
☝️ Lastly, the title for the commit will come from the pull request title. So please provide a descriptive title that summarizes the changes in 50 characters or less using the imperative mood. Happy coding! 🎉 |
There was a problem hiding this comment.
🟡 Changes recommended
src/adapted.ts introduces a strict-null-checks TypeScript type error (loadedValue compared to undefined but typed as non-optional).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates AdaptedCache deserialization recovery to prevent malformed values (especially from cached entries) from contaminating recovery flows, and adds test coverage for cache hits, cache misses, background revalidation, and shared in-flight requests.
Changes:
- Validate freshly loaded values before they can be used in recovery flows.
- Evict malformed cached values and retry once via the normal cache-miss path.
- Add/extend Jest coverage for malformed cached values, malformed freshly loaded values, and shared in-flight behavior.
File summaries
| File | Description |
|---|---|
src/adapted.ts |
Adds load validation and single-retry eviction logic when output transformation fails for cached values. |
test/adapted.test.ts |
Adds test cases covering malformed cached entries, freshly loaded transformation failures, background revalidation, and SharedInFlightCache behavior. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Summary
Verification
npx jest -c jest.config.js test/adapted.test.ts --runInBand(15 passed)npx eslint src/adapted.ts test/adapted.test.tsnpm run validate