Repository navigation
fix(MUF-11810): treat a record missing on get as a cache miss - #56
Open
corradopetrelli wants to merge 1 commit into
Open
corradopetrelli wants to merge 1 commit into
corradopetrelli wants to merge 1 commit into
Conversation
getDataCacheRecord called cache.has() and then cache.get(): if the key expired or was invalidated in between, get() returned undefined and the destructuring threw "Cannot destructure property 'result'". It now reads the record with a single get() and treats a missing record as a miss. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
alessandrobocci
approved these changes
Oct 30, 2026
Cadienvan
approved these changes
Oct 30, 2026
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
getDataCacheRecord(src/internal.ts) calledcache.has(key)and thencache.get(key). If the key expired or was deleted by a concurrent invalidation between the two calls,getreturnedundefinedand the destructuring threw:This happened in production in refunds (
syncUser, 2026-10-26 06:17 UTC) with@jointlytech/cache-candidate-kv-adapteron Redis.Change
cache.get(key), andhasis no longer called on the read path. That also saves one adapter round-trip per lookup.undefined, ornullfrom an adapter that returns it) is handled as a cache miss, so the wrapped function runs.Tests
should treat a record vanished between has and get as a cache miss: an adapter whosehasreturnstrueand whosegetreturnsundefined. The test checks that the function runs, that its result is returned and thatonCacheHitis not fired.npm testreports 24 passing and 0 failing.npm run lintand the prettier check also pass.Follow-up
Releasing a new version and bumping it in refunds is handled in a separate cycle.
🤖 Generated with Claude Code