Scribble game implementation with Speckit#139
Open
sowmya-ari wants to merge 31 commits into
Open
Conversation
Add specification for room creation, joining via code, lobby polling, host controls, and player management for the multiplayer drawing game.
…etup & Lobby) Generate research.md, data-model.md, contracts/room-api.md, quickstart.md and update plan.md. Update agent context reference to point to new plan.
- Fix spec to reflect host transfer (not disband) per user decision - Normalize room status from 'waiting' to 'lobby' to match codebase - Add test tasks for code generation, invalid code, and room isolation - Remove stale '+updatedAt' reference from plan
30-item checklist covering requirement completeness, clarity, consistency, acceptance criteria quality, scenario/edge case coverage, non-functional requirements, and ambiguities. Audience: reviewer (PR) + QA. Covers API, UX, error handling, and concurrency domains.
- Add hostId to Room/RoomSnapshot with host transfer on leave - Require playerName (non-empty) in create/join schemas - Add leaveRoom and startGame endpoints with validation - Auto-polling lobby at 2s interval with host badge - Join form validates 4-char code client-side - Store validates room capacity (max 8), lobby status, host-only start - Room cleanup on last player departure - 21 tests across backend (18) and frontend (3)
- Empty code now shows 'Please enter a room code' (was generic format message) - Non-4-char codes still show 'Room code must be 4 alphanumeric characters' - Verified all 21 tests still pass
- Spec covering player name trimming/validation and first round mechanics - Two user stories: name trimming (P1) and drawer+word assignment (P1) - 9 functional requirements, 6 success criteria, 6 edge cases - Quality checklist: 16/16 passing, no clarifications needed
- Q1: Word retrieval via conditional API response (drawer only gets secretWord) - Q2: Drawer identified by 'Drawer' badge in player list (reusing badge pattern) - Q3: Canonical roles are 'drawer' and 'guesser'; normalized terminology Touched US2 description, acceptance scenarios, edge cases, functional requirements (FR-009–FR-011), and data requirements.
…cts, quickstart) - Phase 0: research.md with 4 resolved design decisions (word selection, conditional snapshot, name trimming, page refresh) - Phase 1: data-model.md with extended Room fields (drawerId, secretWord, currentRound) and conditional snapshot exposure - Phase 1: contracts/game-api.md documenting GET /rooms/:code with conditional secretWord and POST /rooms/:code/start side effects - Phase 1: quickstart.md with 7 validation scenarios covering all acceptance criteria - AGENTS.md plan reference updated to this feature - Constitution check: all gates pass
21 tasks across 4 phases: - Phase 2: Foundational (model/type changes + word selection function) - Phase 3: US1 — player name trimming and validation - Phase 4: US2 — first round, drawer assignment, secret word, conditional exposure - Phase 5: Polish — tests, type checks, manual validation
- C1: add .trim() to create/join Zod schemas (backend whitespace bypass) - C2: clarify 'prominently' -> 'large centered heading' in spec - C3: add US1 test tasks (T022-T024) for store trimming behavior - C4: convert no-op T010 to informational note - C6: EC-06 'Non-drawer' -> 'guesser' - C8: clarify T013 scope (add player list to GamePage)
- everest-engineering#1: secretWord serialization — omitted (undefined/absent) for non-drawers, null for lobby; updated API contract + data model - everest-engineering#2: SC-003 timing — 3s -> 2s to match stated 2s polling interval - everest-engineering#3: EC-01 error message — aligned to 'Player name is required' to match existing Zod schema - Append 39-item deep requirements quality audit (CHK017-CHK055) to checklist - Mark 7 conflict items as resolved
Phase 2 (Foundational): - T001-T004: Add drawerId, secretWord, currentRound to Room/RoomSnapshot - Add selectWord() with djb2 hash for deterministic word selection Phase 3 (US1 - Name Trimming): - T005-T007: Trim names in createParticipant(), CreateRoomPage, JoinRoomPage - T022-T024: Add tests for trimming and whitespace-only rejection Phase 4 (US2 - First Round): - T008-T009: startGame sets drawerId/secretWord/currentRound; conditional snapshot - T011: RoomSnapshot types expose drawerId/roundNumber/secretWord - T012: Add .drawer-badge CSS class - T013: GamePage with player list, Drawer badge, conditional word display - T014-T017: Tests for word selection, drawer assignment, conditional exposure Cross-cutting: - Add sessionStorage persistence for page refresh (FR-011, EC-05) - Add immediate fetchRoom() on GamePage mount - Fix toRoomSnapshot lobby null contract - Wait for isSessionRestored before redirecting in page guards
- 4 user stories: canvas drawing/sync, guess validation, history/scoring, canvas sync - 14 functional requirements - 8 success criteria, 10 edge cases - 16/16 quality checklist pass
… defaults, error indicator on save failure
…h, Phase 1 design artifacts
…ssion) Phase 1 (Setup): type-check verified for both backend and frontend Phase 2 (Foundation): CanvasStroke + Guess interfaces, Room/RoomSnapshot extensions, createRoom/toRoomSnapshot updates Phase 3 (US1 Canvas Drawing & Sync): saveCanvas service, canvasUpdateSchema, PUT /canvas route, Canvas drawing component, api.saveCanvas, GamePage integration, clear button, canvas tests Phase 4 (US2 Guess Submission & Validation): submitGuess service, submitGuessSchema, POST /guesses route, GuessForm with loading/error/success states, drawer disable, 14 new tests (49 passing)
…ponse GuessForm always showed 'Correct!' regardless of actual match because onSubmitGuess returned void. Now returns Promise<boolean> (isCorrect) and GuessForm uses it to set the proper result indicator.
- Host-initiated round end transitions room to 'finished' status - Result view shows secret word, final scores, full guess history - Host restart returns all players to lobby, clears round state, preserves participants - 9 functional requirements, 8 edge cases, 7 success criteria - 16/16 quality checklist items pass
- plan.md: Technical Context, Constitution Check, Project Structure - research.md: 7 decisions (end-round API, restart API, state idempotency, result view, canvas visibility, error messages, host transfer) - data-model.md: RoomStatus with 'finished', state transitions, cleanup rules - contracts/api.md: POST end-round, POST restart, extended GET room snapshot - quickstart.md: 4 validation scenarios + test commands - AGENTS.md: updated SPECKIT marker to reference new plan
Phase 1 (Setup): type-check verification Phase 2 (Foundational): RoomStatus 'finished', snapshot updates Phase 3 (US1): endRound backend + frontend, GuessHistory, Scoreboard, ResultView Phase 4 (US2): restartGame backend + frontend, restart button Phase 5 (Polish): error handling, CSS, full test suite
M1: currentRound reset to 0 on restart — resolved contradiction in research.md, added to T015 task description M2: spec.md independent test now explicitly says 'drawer/host' (Tab A) to clarify host=drawer assumption M3: saveCanvas status guard for 'finished' added to T005 description (FR-004 drawing rejection)
- RoomStatus extended with 'finished' (T002) - toRoomSnapshot reveals secretWord to all when finished (T003) - endRound() service, schema, route (T004-T006) with host-only auth - restartGame() service, schema, route (T014-T016) with state cleanup - GuessHistory, Scoreboard, ResultView components (T008-T010) - GamePage integration: End Round button, conditional ResultView, auto-redirect to lobby on restart (T011, T018) - Frontend API methods: endRound, restartGame (T007, T017) - 15 new backend tests (T012-T013, T019-T020) — 64 total passing - CSS styles for result view, guess history, scoreboard (T022) - Error handling for action failures (T021) - Quickstart validation: all 11 API scenarios verified (T024) - Fix: submitGuess returns 'Round has ended' for finished rounds - Fix: joinRoom allows joining during finished state (EC-04) - Fix: incorrect guess now shows 'Incorrect' feedback in UI - Fix: GamePage navigates to /lobby when status changes to lobby - AGENTS.md: add Bug Fix Workflow section
Replace stale state variable with ref for synchronous point tracking in handlePointerMove, so each stroke segment renders immediately. Also persist in-progress stroke across polling re-renders.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Scenario 1 — Room Setup & Lobby
Scenario 2 — First Round Setup
Scenario 3 — Gameplay Interaction
Scenario 4 — Result, Restart & Final Validation
Bugs Fixed
Process Artifacts
flowchart LR A[Spec] --> B[Plan] B --> C[Data Model] C --> D[Contracts] D --> E[Tasks] E --> F[Implement] F --> G[Test] G --> H{Pass?} H -->|Yes| I[Commit] H -->|No| F I --> J{More scenarios?} J -->|Yes| A J -->|No| K[Done]Contributor