Repository navigation
fix(sandbox): implement Redis set ops and raw command/pipeline instead of raising - #53
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
=======================================
Coverage 83.89% 83.89%
=======================================
Files 24 24
Lines 708 708
=======================================
Hits 594 594
Misses 114 114 ☔ View full report in Codecov by Harness. |
…d of raising
Cache.Sandbox raised "Not Implemented" from smembers/3, sadd/4, command/3,
command!/3, pipeline/3 and pipeline!/3. Under sandbox?: Mix.env() === :test
the use-Cache wrappers delegate to Cache.Sandbox, so dialyzer (running in
test) correctly inferred every Redis cache module's injected command/1,
pipeline/1, sadd/2, smembers/2 ... had no local return — forcing a
:no_return ignore entry per Redis cache module in every consuming app.
- sadd/smembers: real in-memory sets (MapSet under the key), Redis
semantics — SADD returns the new-member count, SMEMBERS of a missing key
is [].
- command/pipeline: PING, GET, EXISTS, DEL mapped onto the sandbox map;
anything else returns {:error, %ErrorMessage{code: :not_implemented}} —
the same error shape the Redis adapter produces — instead of raising.
The bang variants raise only on that error branch, so they have a real
success typing too.
- pipeline runs commands in order and halts on the first error.
MikaAK
force-pushed
the
fix/sandbox-redis-set-ops
branch
from
September 3, 2026 07:12
c8dbe37 to
fa45e0b
Compare
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
Cache.Sandboxraised"Not Implemented"fromsmembers/3,sadd/4,command/3,command!/3,pipeline/3andpipeline!/3.Under
sandbox?: Mix.env() === :testtheuse Cachewrappers delegate toCache.Sandbox, so dialyzer (running in test) has been correctly inferring that every Redis cache module's injectedcommand/1,2,command!/1,2,pipeline/1,2,pipeline!/1,2,sadd/2,3,smembers/2have no local return — 11no_returnwarnings per Redis cache module, forcing a:no_returnignore entry per module in every consuming app.sadd/smembers— real in-memory sets (MapSet under the key), Redis semantics:SADDreturns the new-member count,SMEMBERSof a missing key is[].command/pipeline—PING,GET,EXISTS,DELmapped onto the sandbox map; anything else returns{:error, %ErrorMessage{code: :not_implemented}}— the same error shape the Redis adapter produces on failure — instead of raising. RawGETreturns the stored binary undecoded, exactly as Redis would (the Redis-backed sandbox term-encodes on put).pipelineruns commands in order and halts on the first error.Verification
test/cache/redis_sandbox_test.exs(11 tests, sandbox only, no Redis needed) — green.sandbox?: trueRedis cache module:mainproduces the 11no_returnwarnings above; this branch produces 0.:no_returnignore entries deleted, dialyzer goes 174 → 108 total warnings, all remaining ones already skipped, 0 unnecessary skips.RedisJSONTest/RedisHashTestunder parallel contention) failures are unchanged frommain; everything else green.