Skip to content

Scribble lab - #53

Open
DivyaSaiPagidipally wants to merge 28 commits into
everest-engineering:mainfrom
DivyaSaiPagidipally:scribble-lab
Open

DivyaSaiPagidipally wants to merge 28 commits into
everest-engineering:mainfrom
DivyaSaiPagidipally:scribble-lab

Conversation

@DivyaSaiPagidipally

Copy link
Copy Markdown

Summary

This PR implements the core game lifecycle features and resolves starter codebase gaps for Branded Scribble, a multiplayer drawing and guessing game. The implementation spans all four target feature groups:

  1. Room Setup & Lobby:

    • Host tracking on room creation (room creator designated as host).
    • Automated lobby polling at ~2s intervals to dynamically update player lists.
    • Host-only game starting, gated by a 2-player minimum requirement.
  2. Game Start & Drawer Flow:

    • Backend name validation (trimming and rejection of empty/whitespace names).
    • Role assignment (host as the drawer, guests as guessers).
    • Deterministic selection of the secret word (e.g., "rocket").
    • Drawer-only visibility (the secret word is masked in guesser snapshots).
  3. Gameplay Interaction:

    • Interactive freehand canvas for drawers with base64 drawing path synchronization.
    • Drawer control to clear the canvas.
    • Case-insensitive guess checking and scoring (+100 points on the first correct guess).
    • Chronological guess log highlighting correct answers.
  4. Result & Restart:

    • Manual (host-triggered) and automatic round ending (when all active guessers are correct).
    • Results dashboard showing the correct secret word, final scores, and the complete guess history log.
    • Host-only game restart resetting room status back to "lobby", removing roles, resetting scores to 0, and cleanly redirecting all players back to the lobby.

Gaps & Assumptions Resolved:

  • Fixed the /bug suffix in the frontend API base URL fallback, restoring client-server connectivity.
  • Fixed player name default checks to support custom player names.
  • Auto-polling resolved for real-time list and state sync.

Contributor

DivyaSaiPagidipally and others added 28 commits June 1, 2026 12:28
…al components, and 80% test coverage principles
- plan.md: architecture decisions, tech choices, and phased approach
- data-model.md: Room and Participant entity definitions with field descriptions
- contracts/rooms-api.md: full REST API contract for room CRUD, start, and leave
- research.md: trade-off notes on polling vs WebSockets, in-memory storage
- quickstart.md: local dev setup and manual verification steps
- tasks.md: 29 tasks across 8 phases (setup → foundation → US1–US5 → polish)
- Groups tasks by user story with parallel execution annotations
- Targets 90% test coverage with unit tests included per story
Backend:
- Extend Room model with hostId; Participant with isHost flag
- Add Zod validation: name ≤32 chars, alphanumeric 4-char room codes
- Uppercase-normalise room codes for case-insensitive isolation
- Add startGame transition (lobby→game) gated to host + ≥2 players
- Add leaveRoom: host leave destroys room, guest leave removes participant
- Add POST /rooms/:code/start and DELETE /rooms/:code/leave endpoints
- 17 unit tests covering host designation, isolation, and state transitions

Frontend:
- Display host badge next to the creator name in LobbyPage
- Auto-poll room state every 2s; show reconnection warning on failure
- Start Game button visible to host only; disabled until ≥2 players
- Redirect all participants to /game when status transitions to 'game'
- Redirect guests to landing page when host destroys the room
- Client-side empty-name guard on CreateRoomPage and JoinRoomPage
- 5 API service unit tests
Summarises implemented behaviour across all five user stories:
host tracking, join validation, multi-room isolation, lobby
auto-polling, and host-only game start with 2-player gate.
…ement

Spec fixes (002-room-setup-lobby):
- spec.md: mark status as Implemented; fix SC-003 from 200ms to 2.5s (bounded
  by 2s poll interval); lock FR-004 cadence from ~2s to exact 2000ms
- plan.md: update constitution check from 80% to 90% test coverage; correct
  project structure diagram to show actual src-level test file paths
- data-model.md: fix leave endpoint verb from POST to DELETE
- tasks.md: mark T001 (dependency verification) as complete

Tooling:
- common.sh: disable check_feature_branch enforcement to allow single
  long-lived branch workflow (scribble-lab); original validation preserved
  as commented-out block for easy re-enabling
19-item lightweight self-review checklist (CHK001–CHK019) validating
spec/plan/tasks quality across six dimensions:

- Requirement completeness: US1–US5 FR traceability, edge case coverage
- Requirement clarity: ambiguous terms ("immediately", "temporary", "automatically")
- Requirement consistency: HTTP verb alignment, polling cadence, coverage %
- Acceptance criteria quality: measurability of SC-002/SC-003/SC-004
- Scenario coverage: post-start join, duplicate names, participant cap (gaps)
- Plan & tasks consistency: task-to-FR traceability, project structure accuracy

Surfaces 5 unresolved gaps (CHK003/004/013/014/015) to decide before
writing the next feature spec.
- CHK004 now marked fixed: POST /rooms/:code/join returns 409 Conflict if room.status === 'game'
- CHK013 now marked fixed: same restriction for guests joining after game start

Ensures no participants can join a game already in progress, preventing broken state.

Refs: implementation-readiness checklist (CHK004, CHK013)
…s clear, guess input validation, normalized secret word matching, scoring, and scoreboard/log UI
…updates, API endpoints, frontend dashboard, redirect effects, and unit tests
Replace in-memory Map with node:sqlite-backed room repository.
DB defaults to backend/data/scribble.db (DB_PATH override); tests use :memory:.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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