EVENT LOG tab: real game events in the log terminal #11

Closed
opened 2026-09-28 23:13:36 +02:00 by kamilkrzywda · 1 comment
Owner

Goal

Make the EVENT LOG tab functional: the terminal shows real game events instead of placeholder lines.

Scope

  • DB: events table (id, turn, type, message, created_at) — writes already start with the WORLD MAP issue; every action from all tabs appends an event.
  • API: GET /api/events (latest N, newest first). Update OpenAPI spec.
  • Frontend: terminal rendered from API (turn number + message per line); no placeholder lines for this tab.

Acceptance criteria

  • Unit tests: each action type writes an event with correct turn/type/message.
  • e2e: after a jump and an exploration, the log shows both entries; persists across restart.
  • Local verify green: tsc / vitest / playwright --list (+ build DOM check).

Dependencies

Last in the chain — by then all actions exist and write events; this issue is mostly read endpoint + render.

## Goal Make the EVENT LOG tab functional: the terminal shows real game events instead of placeholder lines. ## Scope - **DB:** `events` table (id, turn, type, message, created_at) — writes already start with the WORLD MAP issue; every action from all tabs appends an event. - **API:** `GET /api/events` (latest N, newest first). Update OpenAPI spec. - **Frontend:** terminal rendered from API (turn number + message per line); no placeholder lines for this tab. ## Acceptance criteria - Unit tests: each action type writes an event with correct turn/type/message. - e2e: after a jump and an exploration, the log shows both entries; persists across restart. - Local verify green: tsc / vitest / playwright --list (+ build DOM check). ## Dependencies Last in the chain — by then all actions exist and write events; this issue is mostly read endpoint + render.
Author
Owner

Done in v0.9.0 (PR #18, merge commit fb11a8e), deployed to https://space-wanderer.dev.kkhost.pl — verified /api/version → 0.9.0 and /api/events serving the live save's log.

What shipped:

  • API: new GET /api/events — latest N events, newest first ([{id, turn, type, message, createdAt}]); optional ?limit= (default 50, cap 200; non-integers/out-of-range → 400 via parseEventLimit). Auto-initializes the save like every other read. OpenAPI now documents 15 paths + Event schema with all eight event types enumerated.
  • No schema change — the events table pre-existed (WORLD MAP issue) and every action from every tab already writes an event; this issue was the read endpoint + render, as planned.
  • UI: self-fetching EventLogPanel (components/event-log.tsx, MissionPanel pattern — refetches on each tab open, no polling) rendering real lines into the existing Terminal: T<turn> // <MESSAGE> uppercased with the event's local time as timestamp; new_game renders as a system (#) line. Placeholder feed removed from mission-control.tsx (right-column placeholders untouched — out of scope).
  • Tests: unit 73 → 78 (+4 in new events.test.ts: limit parsing, newest-first ordering/slicing; writer-gap assertions added where missing — expand had none, build + mission-complete gained turn checks); e2e 14 → 15 (jump via shared helper + scan → both entries in API newest-first and rendered in the terminal; state.spec asserts the latest five lines identical incl. ids across the mid-run restart).
  • CI note: first run failed on a stale e2e assertion — the tab-switch test still expected the removed placeholder text SHIP LOG // PLACEHOLDER FEED. Fixed e2e-only (assert at least one real /T\d+ \/\/ / line instead); no app code touched.

That's all seven tabs functional: WORLD MAP, LOCAL SYSTEM, CREW, SHIP SYSTEMS, SKILL TREE, MISSIONS, EVENT LOG.

Done in **v0.9.0** (PR #18, merge commit `fb11a8e`), deployed to https://space-wanderer.dev.kkhost.pl — verified `/api/version` → 0.9.0 and `/api/events` serving the live save's log. What shipped: - **API:** new `GET /api/events` — latest N events, newest first (`[{id, turn, type, message, createdAt}]`); optional `?limit=` (default 50, cap 200; non-integers/out-of-range → 400 via `parseEventLimit`). Auto-initializes the save like every other read. OpenAPI now documents 15 paths + Event schema with all eight event types enumerated. - **No schema change** — the `events` table pre-existed (WORLD MAP issue) and every action from every tab already writes an event; this issue was the read endpoint + render, as planned. - **UI:** self-fetching `EventLogPanel` (`components/event-log.tsx`, MissionPanel pattern — refetches on each tab open, no polling) rendering real lines into the existing Terminal: `T<turn> // <MESSAGE>` uppercased with the event's local time as timestamp; `new_game` renders as a system (`#`) line. Placeholder feed removed from mission-control.tsx (right-column placeholders untouched — out of scope). - **Tests:** unit 73 → 78 (+4 in new events.test.ts: limit parsing, newest-first ordering/slicing; writer-gap assertions added where missing — expand had none, build + mission-complete gained turn checks); e2e 14 → 15 (jump via shared helper + scan → both entries in API newest-first and rendered in the terminal; state.spec asserts the latest five lines identical incl. ids across the mid-run restart). - **CI note:** first run failed on a stale e2e assertion — the tab-switch test still expected the removed placeholder text `SHIP LOG // PLACEHOLDER FEED`. Fixed e2e-only (assert at least one real `/T\d+ \/\/ /` line instead); no app code touched. That's all seven tabs functional: WORLD MAP, LOCAL SYSTEM, CREW, SHIP SYSTEMS, SKILL TREE, MISSIONS, EVENT LOG.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/SpaceWanderer#11