This repository was archived by the owner on Oct 3, 2026. It is now read-only.
Repository navigation
Make Film Club room mutations atomic without changing stored history - #29
Closed
WalksWithASwagger wants to merge 1 commit into
Closed
WalksWithASwagger wants to merge 1 commit into
WalksWithASwagger wants to merge 1 commit into
Conversation
Replace whole-room get/set/del writes with create-if-absent, join, append, and owner-delete operations. Redis uses SET NX plus bounded Lua compare-and-set because Upstash REST cannot WATCH; memory uses per-code locks and detached snapshots. Stored room:{code} JSON is unchanged.
Closes #18
Co-authored-by: Kris Krüg <WalksWithASwagger@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
Author
WalksWithASwagger
deleted the
cursor/atomic-club-room-mutations-19f6
branch
September 27, 2026 07:05
This branch was successfully deployed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Closes #18.
Outcome
Film Club create/join/submit/delete no longer use unconstrained whole-room read/modify/write. Routes call a small atomic store API so concurrent successful writes are preserved, capacity and create-if-absent are enforced in the mutation, and a submit racing a delete cannot resurrect a room.
Stored history is unchanged: same
room:{code}keys, same room JSON shape, no TTL, no key migration, no production rewrite.Approach
SET NXfor create-if-absent, and a bounded Lua CAS (createScript/ EVALSHA). Lua does not re-encode rooms withcjson, so empty arrays and existing critiques are not rewritten by the script.409/503without logging private payloads.isStoreConfigured()).Route consumers enumerated
GET /api/club/rooms/[code]getget(detached snapshot)POST /api/club/roomsget+setcreateIfAbsentPOST .../joinget+setjoinMemberPOST .../submitget+set(could fall back to a stale room after delete)appendSubmissionDELETE /api/club/rooms/[code]get+deldeleteIfOwnerset/delare no longer on the write API.Tests
Deterministic interleavings covered at store and actual route level: join/join, submit/submit, join/submit, submit/delete, create collision, duplicate member update, capacity race, snapshot isolation, legacy critique readability, CAS retry/conflict, and safe unavailable errors.
The Redis path is exercised by an in-process CAS fake (SET NX + Lua-shaped compare-and-set). That is not live Redis concurrency evidence.
Focused command:
Verification
npm run typechecknpm run lintnpm testnpm run buildnpm run test:browsernpx playwright install chromiumin this environment.CLUB_TEST_REDIS_URL+CLUB_TEST_REDIS_TOKEN+CLUB_TEST_NAMESPACE)docs/film-club.md.Smoke/search checks were not run; #18 does not require them and they need a live server.
Hard gates
Rollback
A code revert restores the old racy writers against the same keys and shape. It does not rewrite stored rooms. Rooms mutated after deploy are still valid legacy JSON.