Sprint 15: The Global Market & Gacha System
With the Ingress Policy Enforcement and Content Ingestion loops secured, Sprint 15 introduces the primary economic driver of the PCMTG ecosystem: The Global Market & Gacha System. The objective is to deploy a secure, atomic transaction ledger and high-throughput sliding-window rate limiter, and couple them with a premium, glassmorphic trading and synthesis user interface on the frontend.🛠 Context & Required Rules for AI Agents
- Atomic Economy (Zero-Trust): All market interactions must run inside
prisma.$transactionblocks with pessimistic raw SQLFOR UPDATErow locks to prevent double-spending on serverless Cloud Run pools. - Horizontal Scale-Safe Rate Limiter: In-memory rate limiting is forbidden across scaled container instances. All
/market/*routes must be governed by Google Cloud Memorystore (Redis) sliding windows. - Ideological Defection (“Based Pill” mechanic): Player alignment is fetched directly from the declared database record to allow faction defection without resetting the player’s Euclidean ELO footprint.
🗺 Sprint 15 Roadmap
[x] Phase 1: Database & Schema Alignment
- Objective: Establish direct declared ideological quadrant storage.
- Tasks:
- Add explicitly stored
quadrantstring property toPlayerAccountinschema.prisma. - Push the database schema updates to Neon Postgres and regenerate the Prisma Client.
- Add explicitly stored
[x] Phase 2: Cloud Memorystore sliding-window rate-limiting
- Objective: Prevent Sybil attacks and automated bulk synthesis script abuse.
- Tasks:
- Centralize connection management pool for Google Cloud Memorystore via
ioredis. - Build
marketRateLimitermiddleware running multi-exec pipelines on atomic Redis sorted sets to limit players to 5 requests per 10 seconds.
- Centralize connection management pool for Google Cloud Memorystore via
[x] Phase 3: Zero-Trust Market Ledger Routers
- Objective: Deploy transaction-safe, Row-Locked item and pack synthesis endpoints.
- Tasks:
- Build
/market/spotto fetch active policy and passive modifier items. - Build
/market/buy-itemprotecting against duplicate modifier purchases and atomic row locks. - Build
/market/buy-packenforcing the cross-quadrant pricing dynamic (20 units of native currency for native packs, 50 units for opposing quadrant packs) with backend-side cryptographically secure random pulls.
- Build
[x] Phase 4: High-Fidelity Glassmorphic Frontend
- Objective: Design a premium, highly reactive player dashboard.
- Tasks:
- Build the React-based frontend page at
/marketsupporting dual tab sections (Spot MarketandMeme Bazaar). - Wire immediate, silent balance updates with the global
<WalletOverlay />upon completed ledger purchases. - Construct full-screen, 3D CSS perspective card flips, tearing packs, and rarity glow colors (from silver to Golden celestial animations).
- Build the React-based frontend page at
[x] Phase 5: Automated Verification Suite
- Objective: Programmatically prove performance, security bounds, and game theory compliance.
- Tasks:
- Create the backend E2E integration runner test-market.js.
- Assert rate-limit throttling, double-spend resistance, duplicate item blocks, and asymmetrical cross-quadrant cost ratios.