test(02-05): playwright e2e for PIPE-07 — full Phase-2 loop

- tests/e2e/season1-loop.spec.ts: PIPE-07 smoke covering load → Begin
  → plant rosemary → fast-forward FakeClock 3min → harvest →
  fragment-reveal modal → close → journal-icon visible → open journal
  → fragment present → reload page → fragment persists. Sidesteps
  Phaser canvas pixel-clicking via window.__tlgStore command dispatch
  (test-only window slot, production-guarded by import.meta.env.PROD).
- playwright.config.ts: bumped webServer timeout 30s → 60s for cold
  Vite startup; pinned port 5273 + --strictPort to avoid collisions
  with other dev servers on the user's machine; reuseExistingServer
  false so the spec always starts a fresh Vite against this project.
- package.json: added test:e2e script (npx playwright test). Not
  added to npm run ci — Playwright is slower than Vitest; manual run
  before /gsd-verify-work + future v1 release pipeline.
- src/content/loader.ts (Rule 3 — Blocking): replaced gray-matter
  with a 15-line parseFrontmatter helper. gray-matter pulls in Node's
  Buffer global which is undefined in Vite's browser bundle; the
  build emits a 'Module "buffer" externalized' warning that masks
  the runtime ReferenceError. Surfaced under Vite dev mode while
  running the e2e — Plan 02-03's Markdown loader path (lura-first-
  letter.md + winter-rose-night.md) was effectively broken in real
  browsers since shipping. parseFrontmatter handles the strict
  '---<yaml>---<body>' shape the .md fragments use; bundle dropped
  from 2.2MB to 1.9MB as a side effect of dropping the unused dep.
- deferred-items.md: tracks the gray-matter package.json cleanup
  (the dep is now unused but kept in package.json for now, scoped
  out of this plan).
- npx playwright test exits 0 (1 spec, 1.5s test runtime); npm run
  ci exits 0; 308/308 vitest still green. PIPE-07 satisfied
  end-to-end.
This commit is contained in:
2026-05-09 11:04:32 -04:00
parent 5d58d6cc7b
commit dd486969a9
5 changed files with 304 additions and 16 deletions
@@ -0,0 +1,26 @@
# Phase 2 — Deferred Items
Items discovered during execution that are out-of-scope for the current
plan but should be tracked. Each entry includes the discovering plan,
the resolution path, and any blocking implications.
## Plan 02-05 — Discovered
### `gray-matter` package can be removed from package.json (cleanup)
- **Found during:** Plan 02-05 Task 3 — running the Playwright e2e
surfaced a runtime `Buffer is not defined` error in `gray-matter`
under Vite's dev-mode browser bundle. Replaced with a 15-line
inline frontmatter parser (`parseFrontmatter` in
`src/content/loader.ts`) since the only usage was for stripping
YAML frontmatter from two `.md` files (Plan 02-03 authored).
- **Status:** No code references `gray-matter` anymore (verified via
`grep -r grayMatter src/` returns zero hits). The dep remains in
`package.json` — removing it is a cleanup task, not blocking.
- **Resolution:** A future maintenance commit can run
`npm uninstall gray-matter` to drop the dep + lockfile entry.
Bundle size is already smaller (1.9MB vs 2.2MB) because Rolldown
tree-shakes the unused module.
- **Why deferred:** Out of Plan 02-05 scope (touched only as a Rule 3
blocking-issue auto-fix); changing dependencies in package.json
beyond the minimal fix expands surface unnecessarily.