Skip to content

RedisList: implement insert/del, fix slicing and IndexError; safe list assignment - #11

Merged
thorwhalen merged 2 commits into
masterfrom
fix/6-7-redislist-contract
Oct 13, 2026
Merged

thorwhalen merged 2 commits into
masterfrom
fix/6-7-redislist-contract

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

Fixes #6, fixes #7.

  • insert: exact (duplicate-safe) via WATCH/MULTI with a sentinel + LINSERT; list.insert clamping semantics.
  • __delitem__: atomic MULTI of LSET sentinel + LREM; clear() is a single DEL. So pop/remove/reverse/+= now work.
  • Slices follow slice.indices (l[:], l[1:0], negatives, steps). Out-of-range int get/set/del raise IndexError (so index()/in terminate). Slice assign/delete: NotImplementedError.
  • Iteration in batches of iter_batch_size (one lrange per batch).
  • store[k] = [] raises ValueError before touching the existing value (no more data loss); list replace is atomic (DEL+RPUSH in MULTI); generators accepted; numbers are stored as strings instead of being silently dropped.
  • 37 tests on fakeredis.

thorwhalen and others added 2 commits October 13, 2026 07:43
…; safe list assignment

Fixes #6, fixes #7

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@thorwhalen

Copy link
Copy Markdown
Member Author

Adversarial review (fresh Opus subagent): no correctness/data-loss bugs. 12,000 randomized differential runs against a python list (raw, decode_responses, codec, tiny batch), plus retry/WATCH, 8-thread concurrency and failure-atomicity probes all passed. Minor findings: non-integer index not TypeError and iter_batch_size<=0 looping forever -> fixed in the last commit (38 tests); wrong-type-key message and bytearray storage -> deferred to a new issue. Dependents gate: redisdol has no dependent suites (see PR #9 note).

@thorwhalen
thorwhalen merged commit f8caea0 into master Oct 13, 2026
8 checks passed
@thorwhalen
thorwhalen deleted the fix/6-7-redislist-contract branch October 13, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RedisList: slicing, IndexError and empty-assign edge cases RedisList.insert is an unimplemented stub (MutableSequence contract)

1 participant