Add reproduction for Cache issue - #6844
Conversation
🦋 Changeset detectedLatest commit: 1eaf23a The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — a single test added to packages/effect/test/Cache.test.ts reproducing a race condition where an interrupted Cache.get lookup removes a newer value written by an explicit Cache.set.
- Reproduction test for interrupted-lookup-vs-set race: the test forks a
Cache.get, waits for the lookup to start, callsCache.setto overwrite the value, interrupts the getter, then assertsCache.getSuccessreturnsSome(99). Confirmed failing locally — returnsNoneinstead.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — one commit since the prior review (1eaf23a) that applies the fix for the race condition.
- Guarded interrupted-lookup cache cleanup with an identity check: the observer now reads the current entry before removing it on interrupt, and only removes if it is the same
EntryImplthat the lookup created. If aCache.setoverwrote the entry in the meantime, the identity check fails and the newer value is preserved. - Added changeset documenting the fix.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|

Reproduction only
This PR adds reproduction tests only. No implementation fix is included. CI is expected to fail until the underlying issue is fixed.
Covered audit issues
1.
core-a-f-cache-stale-lookup-removes-set: Stale interrupted lookup removes a newer set valueModule:
CacheExpected contract: set overwrites any existing value for the key, and an older lookup finishing later must not erase that explicit write.
Observed result: Cache.getSuccess returned Option.none() instead of Option.some(99).
Reproduction command: