Skip to content

Fix adapted cache deserialization recovery - #129

Merged
Fryuni merged 6 commits into
masterfrom
adated-deserialize-error
Sep 10, 2026
Merged

Fryuni merged 6 commits into
masterfrom
adated-deserialize-error

Conversation

@Fryuni

@Fryuni Fryuni commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

  • validate freshly loaded values before they can enter cached-value recovery
  • evict malformed cached values and retry once through the normal cache miss path
  • cover direct loads, background revalidation, and shared in-flight requests

Verification

  • npx jest -c jest.config.js test/adapted.test.ts --runInBand (15 passed)
  • npx eslint src/adapted.ts test/adapted.test.ts
  • npm run validate
  • end-to-end malformed JSON cache smoke scenario

@Fryuni
Fryuni requested review from a team as code owners July 16, 2026 20:50
@github-actions

Copy link
Copy Markdown

👋 @Fryuni

Thanks for your contribution!

The approval and merge process is almost fully automated 🧙

Here's how it works:

  1. You open a new pull request
  2. Automated tests check the code
  3. Maintainers review the code
  4. Once approved, the PR is ready to merge.

👉 Omit the extended description
Please remove the commit body before merging the pull request.
Instead, include the pull request number in the title to provide the full context
about the change.

☝️ 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! 🎉

@Fryuni Fryuni added the bug Something isn't working label Sep 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread src/adapted.ts Outdated
@Fryuni Fryuni self-assigned this Sep 8, 2026
Comment thread test/adapted.test.ts Outdated
Comment thread test/adapted.test.ts
Comment thread test/adapted.test.ts Outdated
Comment thread src/adapted.ts Outdated
Comment thread test/adapted.test.ts Outdated
@Fryuni
Fryuni merged commit 8cded9c into master Sep 10, 2026
7 checks passed
@Fryuni
Fryuni deleted the adated-deserialize-error branch September 10, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants