1.7 KiB
1.7 KiB
Task 08: Prisma Integration Test Harness
Assigned to: Antigravity (Implementation Orchestrator)
Priority: MEDIUM (production storage driver coverage)
Date: 2026-08-21
Base SHA: 2da8b01b1b5491b0db491492ec039271d7855ead
Scope
- Implement integration test suite for
PrismaGiveawayRepositoryandPrismaUserRepositoryagainst PostgreSQL:- Atomic state transitions:
createAndLockSnapshot(atomic seed + snapshot lock, single lock invariant, concurrent lock attempts with exactly 1 winner). - Atomic draw finalization:
saveDrawResultAndAudit(transitionSNAPSHOT_LOCKED -> DRAWN, P2002 duplicate prevention). - Atomic snapshot unlock:
unlockSnapshot(transitionSNAPSHOT_LOCKED -> READY, reset seed to null). - State guard:
saveParticipantsrequiresREADY. - Ownership constraint:
onDelete: RestrictonGiveaway.organizerId. - Pagination & counts:
getParticipantsPaginated. - Record factual
eligibleCountbehavior under Prisma.
- Atomic state transitions:
- Separate test configuration & script in
package.json:npm testremains 100% executable without database (unit tests with memory repository).npm run test:integrationexecutes integration tests againstDATABASE_URL.- If
DATABASE_URLis not set or PostgreSQL is unreachable, fail-closed with explicit error/skip instructions rather than silent pseudo-green.
- CI workflow update (
.github/workflows/ci.yml):- Add integration test job against real postgres service with
prisma migrate deploy(to verify actual Prisma migrations) andSTORAGE_DRIVER=prisma.
- Add integration test job against real postgres service with
- Verification evidence & report in
agents/antigravity/done/TASK-2026-08-21-08-prisma-integration-harness.md.