Skip to main content

Implementation Progress

  • 2026-04-04 sync readiness proof pass:

    • Replaced the stale single multiplayer spec with explicit deterministic browser lanes:
      • packages/app/e2e/multiplayer-world.spec.cjs
      • packages/app/e2e/multiplayer-local.spec.cjs
    • Reworked packages/app/e2e/helpers.cjs around the live Garden UI:
      • added a current Garden camera add-plant helper
      • added reusable room create/join/connect/board helpers for two-context sync proof
    • Updated packages/app/e2e/core-loop.spec.cjs to stay a live app-shell smoke instead of acting as multiplayer proof.
    • Split the package scripts into explicit gates:
      • test:e2e:smoke
      • test:e2e:sync:world
      • test:e2e:sync:local
      • test:e2e
    • Added packages/app/src/hooks/games/useGameSession.test.tsx for resume lifecycle, snapshot-first hydration, desync detection, and pending-move serialization.
    • Tightened seat-claim behavior so post-reset seat recovery requires explicit rejoin instead of silently reclaiming an open guest seat on hydration.
    • Added docs for the CI proof lanes and the separate manual true-WebRTC local validation checklist.
    • Validation for this pass:
      • bun run --cwd packages/app test:e2e
      • bunx vitest run src/modules/yjs.test.ts src/machines/gameSessionMachine.test.ts src/hooks/games/useGameSession.test.tsx
      • bun run --cwd packages/app build
    • Remaining caveat:
      • the raw peer-to-peer local path still needs the separate true-WebRTC operational checklist outside Playwright/WebDriver.
  • 2026-03-28 multiplayer hardening pass:

    • Promoted Yjs from setup-sync-plus-move-bus to authoritative logical match snapshots plus move log.
    • Added explicit matchId, sessionEpoch, moveCount, syncState, and room-full handling to the game session machine.
    • Added snapshot hydration, reconnect resume descriptors, seat recovery/room-full checks, host-driven room reset, and disconnect/desync input locking in the live session hooks.
    • Switched multiplayer reward persistence to use the synced matchId and skip duplicate local claims for the same (matchId, playerId).
    • Removed obsolete stub sync hooks under src/hooks/sync.
    • Updated multiplayer docs to the live contract and current readiness bar.
    • Validation for this pass:
      • bun run --cwd packages/app tsc
      • bunx vitest run src/modules/yjs.test.ts src/machines/gameSessionMachine.test.ts
      • bunx vitest run src/components/game/GameCanvas.experience.test.tsx src/components/game/GameCanvas.immersive.test.tsx
    • Current caveat:
      • existing Playwright multiplayer specs still target stale onboarding/bootstrap/UI flows and are not current proof of production readiness.
  • Initialized progress tracking for this implementation pass.

  • Loaded Vision and WEFA_V1.md and mapped short-term outcomes to concrete code areas.

  • Confirmed develop-web-game skill is in use for iterative implement+test verification.

  • Completed auth hardening: passkey + Pimlico-compatible smart account wiring, wallet connect fallback, and e2e-safe passkey fallback for automated browsers.

  • Completed gameplay short-term outcomes in Garden-as-Play:

    • Same-device and two-device setup flows live in Garden.
    • Ludo integrated in rules engine, registry, session machine, board renderer, and tests.
    • Youth-friendly instructions are present for Tic-Tac-Toe, Mancala, and Ludo.
  • Completed AR/3D scaffolding with live board placement, board rendering, game HUD, piece rendering, and idle piece animation.

  • Completed mandatory photo requirements for plant add and daily care submission.

  • Completed reliability fixes from verification:

    • Resolved runtime auth import mismatch (permissionless/accounts).
    • Added setup-state join transition and derived player-count behavior for same-session two-device validation.
    • Tightened e2e selectors for plant/daily photo upload inputs.
    • Removed all remaining lint blockers (R3F click false positives + stable keys).
  • Final verification state:

    • bun run lint
    • bun run test
    • bun run tsc
    • bun run test:e2e
  • Local secret validation run completed with non-committed /packages/app/.env.local containing AppKit + Pimlico + passkey RP values supplied by user.

  • With secrets loaded, all checks remained green:

    • bun run lint
    • bun run test
    • bun run tsc
    • bun run test:e2e
  • Implemented real-auth validation script:

    • Added /packages/app/scripts/validate-real-auth.cjs
    • Added workspace scripts: bun run validate:auth and bun run --filter app validate:auth
    • Added optional MANUAL_WALLET=true mode for human-approved wallet sign-in verification during headed runs.
  • Real-auth validation results with live keys:

    • Passkey registration/login succeeded using virtual authenticator.
    • Persisted auth session mode is passkey.
    • Persisted auth address is non-fallback (usedFallback: false), confirming real passkey path instead of webdriver fallback.
    • Wallet connect path did not emit AppKit misconfiguration errors, wallet modal element/signals were detected, and wallet-network activity was observed.
  • Post-change regression checks:

    • bun run lint
    • bun run test
    • bun run tsc
    • bun run test:e2e
  • Implemented option 1 for global matches using the existing Yjs stack:

    • Added relay-capable transport modes in /packages/app/src/modules/yjs.ts: webrtc, websocket, and hybrid.
    • Added deterministic websocket relay endpoint selection (selectWebsocketEndpoint) to support multi-endpoint/global room routing.
    • Added transport resolution fallback logic (resolveYjsTransport) so websocket/hybrid gracefully degrade to webrtc if no relay URLs are configured.
    • Preserved local-first behavior with IndexedDB persistence.
  • Wired transport config into runtime:

    • Added config.yjs in /packages/app/src/config.ts.
    • Added env scaffolding in /.env.example: VITE_YJS_TRANSPORT, VITE_YJS_WEBSOCKET_URLS.
    • Updated /packages/app/src/hooks/yjs/useYjsSession.ts to instantiate sessions from config.yjs and observe provider connection status.
    • Surfaced transport state in game session + Garden setup UI (Sync: ...).
  • Implemented testing improvements around the new networking layer:

    • Added /packages/app/src/modules/yjs.test.ts covering transport selection, deterministic relay routing, hybrid session creation, websocket fallback, and connection status observation.
    • Added a machine regression test in /packages/app/src/machines/gameSessionMachine.test.ts for invalid two-device join codes.
  • Verification after global-match transport changes:

    • bun run lint
    • bun run test ✅ (9 files, 34 tests)
    • bun run tsc
    • bun run test:e2e ✅ (2/2)
  • develop-web-game skill loop verification:

    • Ran $WEB_GAME_CLIENT against app server from /packages/app.
    • Captured and inspected /tmp/wefa-webgame/output-app/shot-0.png (post-passkey onboarding view, no runtime console errors emitted in this run).
  • Implemented explicit 3-mode gameplay selection in Garden setup:

    • Device (pass-and-play, no network sync)
    • Local (two devices with Yjs webrtc)
    • World (two devices with Yjs hybrid and relay URL fallback)
  • Updated mode model across app state + hooks:

    • GameMode now uses device | local | world in gameSessionMachine.
    • Network-required gates now apply to local/world only.
    • useGameSession now derives per-mode Yjs transport config.
  • Added world-testing relay default behavior:

    • If no relay URL is configured, world mode uses wss://demos.yjs.dev as a testing fallback.
    • .env.example now includes:
      • VITE_YJS_TRANSPORT=hybrid
      • VITE_YJS_WEBSOCKET_URLS=wss://demos.yjs.dev
    • Local workspace .env.local updated with same testing values.
  • Expanded e2e coverage for all three options:

    • Same-device core loop test remains.
    • Added world mode supports host + join flow.
    • Added local mode supports host + join flow.
  • Verification after 3-mode setup:

    • bun run lint
    • bun run test ✅ (9 files, 34 tests)
    • bun run tsc
    • bun run test:e2e ✅ (3/3)
  • Addressed review finding: creature progression now impacts gameplay outcomes.

    • gameSessionMachine now stores selected creature profiles (element/stage/stats/signature move).
    • Match opening turn now derives from creature initiative (speed + stage, with air bonus).
    • Match rewards now include creature ability bonuses by outcome:
      • fire boosts win payouts
      • water boosts draw payouts
      • earth boosts loss recovery payouts
    • Garden setup/play views now pass full creature profiles into the machine and surface active bonus context/signature moves in UI.
  • Closed plant profile metadata gap from short-term outcomes.

    • Added locationTag, notes, and firstPhotoAt to plant schema + creation flow.
    • Deck add-plant form now captures location tag and notes.
    • Plant cards now display saved location tag/notes for local inventory context.
  • Fixed PWA installability asset gap.

    • Added missing manifest icon files at /packages/app/public/icons/icon-192x192.png and /packages/app/public/icons/icon-512x512.png.
  • Replaced outdated project documentation outputs.

    • Rewrote root README.md for current Bun workspace, demo loop, architecture, and seam list.
    • Rewrote packages/app/README.md from template boilerplate to app-specific usage/structure docs.
  • Added explicit coverage script support:

    • packages/app/package.json: test:coverage
    • root package.json: test:coverage passthrough
  • Added autonomous-world onchain canon verification seam.

    • New src/modules/autonomous-world/onchain.ts reads canon entries from a registry contract (getCanonEntries) via viem.
    • isCanonSetReproducible now requires both local attestation checks and matching onchain registry entries.
    • Added config/env keys for registry address, chain, and optional RPC override.
    • Updated UGC service tests to mock deterministic onchain canon rows.
  • Expanded test coverage in high-risk areas.

    • Added auth storage tests (src/modules/auth/session.test.ts).
    • Added AuthProvider behavioral test for passkey login commit path (src/providers/AuthProvider.test.tsx).
    • Added route guard tests for auth/onboarding gating (src/routes/guards.test.tsx).
    • Added AR capability boundary unit tests (src/components/game/GameCanvas.test.ts).
    • Added PWA regression tests for manifest/icon/index wiring (src/modules/pwa/pwa.test.ts).
    • Added two-context multiplayer e2e sync scenario (e2e/multiplayer-two-page.spec.cjs).
    • Expanded Playwright projects to include desktop and mobile chromium profiles.
  • Explicitly wired service worker registration in app entry (src/main.tsx) and added vite-plugin-pwa type references (src/vite-env.d.ts) for compile-time stability.

  • Fixed coverage toolchain gap so scripted coverage runs are supported:

    • Added @vitest/coverage-v8 to packages/app devDependencies.
    • npm --prefix packages/app run test:coverage now executes and emits a full report.
  • Latest validation pass in this environment:

    • npm --prefix packages/app run lint
    • npm --prefix packages/app run test
    • npm --prefix packages/app run tsc
    • npm --prefix packages/app run test:coverage
  • Coverage snapshot (Vitest v8 provider):

    • All files: Statements 32.86%, Branches 65.54%, Functions 67.37%, Lines 32.86%
    • src/machines: Statements 62.51%
    • src/modules: Statements 71.27%
    • src/modules/games: Statements 85.67%
    • src/modules/ugc: Statements 95.58%
    • src/modules/attestation: Statements 85.35%
    • src/modules/auth/session.ts: Statements 90%
  • Fixed Playwright web server startup to work in environments without global bunx:

    • packages/app/playwright.config.cjs now falls back to npx --package bun bunx ... when bunx is not present.
  • Addressed E2E regression from dynamic game rewards:

    • Updated core-loop assertion to match dynamic reward values (+\d+ energy) instead of fixed +8.
  • Hardened two-context multiplayer E2E behavior:

    • Converted two-context spec to world-mode sync path for deterministic relay transport.
    • Added explicit runtime guard that skips this spec when realtime transport does not report connected in the current environment.
    • Added VITE_LOCAL_RELAY_FALLBACK env toggle (default false) for optional local-mode relay fallback in automation.
  • Latest full-suite validation after these fixes:

    • npm --prefix packages/app run lint
    • npm --prefix packages/app run test
    • npm --prefix packages/app run tsc
    • npm --prefix packages/app run test:coverage
    • npm --prefix packages/app run test:e2e ✅ (8 passed, 2 skipped due realtime transport availability)
  • 2026-03-10 hardening pass: restored green app build path and resolved all current TS build blockers.

    • Fixed strict typing/build errors in:
      • src/modules/attestation/eas-offchain.ts
      • src/modules/attestation/schemas.ts
      • src/modules/auth/passkey.ts
      • src/modules/green-goods/reporting.ts
      • src/modules/ugc/service.ts
      • src/modules/yjs.ts + src/modules/yjs.test.ts
    • Added missing PWA runtime dependency workbox-window and set workbox.maximumFileSizeToCacheInBytes in vite.config.ts so build + SW generation complete successfully.
  • Multiplayer correctness updates (host/guest setup + seat ownership + reward attribution):

    • Added Yjs setup-state sync in src/modules/yjs.ts:
      • seat ownership claim (p0/p1), synced game type, synced creature selection profiles, match start signal, and setup observers.
    • Updated useYjsSession to use real local player IDs instead of static placeholders.
    • Updated useGameSession to:
      • claim seats based on host/join role
      • sync setup state over Yjs
      • enforce local-seat creature selection ownership in network modes
      • sync start signal to peers when network setup is ready
      • route local move submissions through the local seat in network play.
    • Updated Garden setup UI for network play to show per-seat ownership/selection status and local-vs-remote selection flow.
    • Fixed multiplayer reward attribution in Garden.tsx:
      • rewards now apply by local seat (p0 or p1) instead of always p0
      • winner badge attribution now uses local seat outcome
      • persisted event payload includes per-seat rewards and local seat context.
  • Updated tests for new multiplayer flow:

    • src/modules/yjs.test.ts now covers setup sync (seat claim, game type sync, creature profile sync, start signal, and seat takeover protection).
    • Updated E2E specs (core-loop.spec.cjs, multiplayer-two-page.spec.cjs) for seat-owned creature picks and network setup behavior.
    • Realtime two-context E2E remains conditional skip when transport is unavailable in the execution environment.
  • Develop-web-game skill verification run:

    • Ran $WEB_GAME_CLIENT against http://127.0.0.1:5173 with $WEB_GAME_ACTIONS.
    • Reviewed screenshot artifact: /tmp/wefa-webgame-output/shot-1.png (login screen rendered correctly; no script-reported console error artifacts).
  • Latest validation status after this pass:

    • npm --prefix packages/app run lint
    • npm --prefix packages/app run test
    • npm --prefix packages/app run tsc
    • npm --prefix packages/app run build
    • npm --prefix packages/app run test:e2e ✅ (8 passed / 2 skipped due realtime transport availability)
    • npm --prefix packages/app run test:coverage ✅ (33.10% statements)
    • npm --prefix packages/contracts test
  • Checklist/doc updates completed for this pass:

    • Outcome Checklist now marks deployable PWA output as complete ([x]), marks deployment-path workstream complete, and records multiplayer setup/reward progress with remaining realtime-skip blocker.
    • Added offline smoke validation evidence (serviceWorker.ready + offline reload success on preview build).