Skip to content

feat(paste): implement Paste clone with concurrency handling - #30

Open
iQodeIT wants to merge 10 commits into
quicksilverj2:mainfrom
iQodeIT:feat/paste-clone
Open

feat(paste): implement Paste clone with concurrency handling#30
iQodeIT wants to merge 10 commits into
quicksilverj2:mainfrom
iQodeIT:feat/paste-clone

Conversation

@iQodeIT

@iQodeIT iQodeIT commented Aug 11, 2026

Copy link
Copy Markdown

What this does

Closes #4. Implements a view-once Paste service with TTL and concurrency handling.

The invariant

The viewsAllowed counter is decremented atomically using a single Prisma update with a where clause (viewsLeft: { gt: 0 }). This ensures that even under high concurrent load, the paste is never served more times than allowed.

How I verified it

Ran pnpm -w run test and verified the new paste.test.ts which fires 20 concurrent reads against a 1-view paste; exactly 1 succeeded (200) and 19 failed (410).

Checklist

  • Whole test suite is green from a clean checkout
  • - [x] The concurrency/correctness probe passes with zero 5xx
  • - [x] Migrations apply cleanly on a fresh DB; key events are logged
  • - [x] No regressions to other clones' probes
  • - [x] I've read TERMS.md
    AI usage (directed vs. decided):
    I directed the AI to implement the Paste clone based on the requirements in issue [bounty] Paste clone (view-once) #4, specifically focusing on the concurrency invariant. I decided on the specific Prisma update logic to ensure atomicity.

@iQodeIT
iQodeIT requested a review from quicksilverj2 as a code owner August 11, 2026 17:21
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.

[bounty] Paste clone (view-once)

1 participant