Friday, May 8, 2026

Cover the recipient-suggestions cache dedupe with a test that pins the in-flight collapse, not just the TTL hit

Volleyball Elite Academy development update
Volleyball Elite Academy
Cover the recipient-suggestions cache dedupe with a test that pins the in-flight collapse, not just the TTL hit

Cover the recipient-suggestions cache dedupe with a test that pins the in-flight collapse, not just the TTL hit

Volleyball Elite Academy — Development Update • May 5, 2026

--- title: Cover the recipient-suggestions cache dedupe with a test that pins the in-flight collapse, not just the TTL hit ---

Cover the recipient-suggestions cache dedupe with a test that pins the in-flight collapse, not just the TTL hit

## What & Why The existing test in ("dedupes getSofRecipientSuggestions across coaches that share a sampleSessionId via the TTL cache") proves that two coaches sharing a sampleSessionId only trigger one storage call — but it does so via the TTL hit path (the first call resolves, populates the cache, then the second call reads it). That doesn't actually exercise the dedupe, which is the path that collapses concurrent in-flight calls before either one has resolved. If a future refactor accidentally drops the in-flight map but keeps the TTL cache, the existing test would still pass because Promise.all on the same microtask still serializes well enough for the first one to populate the cache before the second checks it.

A targeted test should make return a Promise that resolves only after both fan-out callers have been kicked off (e.g. via a deferred-promise pattern) and assert that the storage was invoked exactly once. This pins the dedupe behavior independently of the TTL.

## Done looks like - A new test in the route test file demonstrates that two simultaneous in-flight calls for the same sessionId collapse to one storage invocation, even when the storage call hasn't resolved yet.

## Relevant files - (, ) - (existing TTL-hit dedupe test as a starting point)

Volleyball Elite Academy

Reply to this email — we read every reply.

You received this because you have an account with Volleyball Elite Academy.

elitevolleyball.training

No comments:

Post a Comment