Skip to content

complete Scribble lab - all 4 scenarios implemented with Spec Kit artifacts - #35

Open
kshitijRastogi-ctrl-new wants to merge 15 commits into
everest-engineering:mainfrom
kshitijRastogi-ctrl-new:main
Open

kshitijRastogi-ctrl-new wants to merge 15 commits into
everest-engineering:mainfrom
kshitijRastogi-ctrl-new:main

Conversation

@kshitijRastogi-ctrl-new

@kshitijRastogi-ctrl-new kshitijRastogi-ctrl-new commented Jun 1, 2026 •

Copy link
Copy Markdown

Summary

Overview

Complete implementation of the Scribble drawing and guessing game
across all 4 scenarios, following the Spec Kit workflow
(constitution → specify → clarify → plan → tasks → implement → validate).

What was built

Scenario 1 — Room Setup & Lobby

  • Host tracking on room creation
  • Player name and room code validation with Zod
  • Duplicate name rejection (409)
  • Lobby auto-polling every ~2s
  • Host-only Start Game button with 2-player minimum
  • Both tabs navigate to game on start

Scenario 2 — Game Start & Drawer Flow

  • Drawer assignment (host becomes drawer)
  • Deterministic word selection from starter list
  • Secret word visible only to drawer via role-based API filtering
  • Game screen shows role-appropriate UI per player
  • Mount-time fetch + 2s polling on game screen

Scenario 3 — Gameplay Interaction

  • Interactive HTML canvas with freehand drawing
  • Canvas sync via polling (~2s) for guessers
  • Guess submission with trim, case-insensitive comparison
  • Empty guess rejection with inline error
  • Correct guess = 100 points, incorrect = 0
  • Guess history synced to all players via polling
  • Round ends on first correct guess

Scenario 4 — Result, Restart & Final Validation

  • Result screen shows secret word, final scores, full guess history
  • Scoreboard sorted by score descending
  • Host-only Play Again button with server-side verification
  • Restart resets all round state, preserves players
  • All players return to lobby via polling

Spec Kit Artifacts

  • specs/constitution.md — 5 core principles
  • specs/001-room-setup-lobby/ — spec, clarify, plan, tasks
  • specs/002-game-start-drawer/ — spec, clarify, plan, tasks
  • specs/003-gameplay-interaction/ — spec, clarify, plan, tasks
  • specs/004-result-restart/ — spec, clarify, plan, tasks

Tech decisions

  • REST polling (~2s) throughout — no WebSockets
  • In-memory store only — no database
  • TypeScript strict + Zod validation on all inputs
  • Brownfield approach — starter extended, not rewritten

Contributor

Kshitij Rastogi and others added 15 commits May 30, 2026 13:33
… API base URL

- backend/src/api/router.ts: errorHandler returns { error } instead of
  { message } in both the ZodError branch and the general error branch
  (T004, addresses analysis finding C1)
- frontend/src/services/api.ts: remove /bug suffix from fallback
  API_BASE_URL; update error parsing to read error field instead of
  message to match updated backend shape (T014 partial, addresses C2)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
T001 - backend/src/models/game.ts:
  - RoomStatus: "lobby" | "playing"
  - Participant: add isHost: boolean, score: number
  - Room: add host: string
  - RoomSnapshot: add host: string

T002 - backend/src/api/schemas.ts:
  - createRoomSchema + joinRoomSchema: playerName required,
    trim + min(1) — rejects empty/whitespace names (FR-003)
  - roomCodeParamsSchema: code required, trim + min(1) (FR-004)

T003 - backend/src/api/schemas.ts:
  - Add startGameSchema: playerName required trim + min(1) (FR-011)

TypeScript errors in roomStore.ts are expected and will be resolved
by T005-T007 in the next commit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… (T005-T008)

T005 - roomStore.ts: remove displayName() fallback; update createParticipant
  to require name: string and isHost: boolean; add score: 0 (FR-001)

T006 - roomStore.ts: update createRoom to set room.host = playerName and
  call createParticipant(playerName, true) for the creator (FR-001)

T007 - roomStore.ts: add host: room.host to toRoomSnapshot return so
  GET /rooms/:code exposes the host field (FR-002)

T008 - rooms.ts: switch POST /rooms to safeParse so Zod field-level
  message ("Name cannot be empty") is returned instead of the generic
  errorHandler message (FR-003)

One expected TS error remains in joinRoom (createParticipant missing
isHost arg) — resolved by T009.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
T009 - roomStore.ts: update joinRoom to require name: string (not
  optional), return "emptyCode" discriminant for empty code, return
  "duplicateName" if name already taken, call createParticipant with
  isHost: false — resolves final TS error from T005 (FR-004, FR-014)

T010 - rooms.ts: switch POST /rooms/:code/join to safeParse; map
  joinRoom discriminants to 400/409/404 with spec-exact error messages
  "Room code cannot be empty", "Name already taken in this room",
  "Room not found" (FR-004, FR-013, FR-014)

T011 - rooms.ts: fix GET /rooms/:code error from "Unable to load room"
  to "Room not found" (FR-004)

Backend now compiles with zero TypeScript errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…name/code validation, Zod schemas, error key alignment, API URL fix, start game endpoint, lobby polling 2s, status navigation to /game/:code, host label, host-only start button, client-side form validation, localStorage session writes. All 6 SC pass.
…e start and drawer flow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gnment on start, deterministic word selection, secret word visible to drawer only, role-based API filtering, GamePage drawer and guesser views, mount fetch, 2s polling, result navigation, ResultPage placeholder. All 5 SCs validated.
feat(s4): complete Scenario 4 - result screen, restart flow, final va…
Two Playwright tests in e2e/regression/lobby (the start page, and
creating a room through to its lobby) and one that fails on purpose
(e2e/regression/demo-failing.spec.ts) to show a failure in Factory's
Tests page. Delete the demo once it has been seen.
getByText('Room Code') also matched the sentence that tells players to
share the room code, so Playwright refused the ambiguous locator.
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.

1 participant