feat: port audience sponsors and recap

This commit is contained in:
goose
2026-10-03 20:41:34 -04:00
parent 196dcab4f4
commit 19811194ec
20 changed files with 598 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
# Task F4 — Audience, Followers, Sponsors, and Episodes
## Scope
Implemented only F4’s audience and recap feature set in the `f4` worktree:
- Run-scoped `AudienceState` for cumulative spectacle, one-time follower threshold rewards, one-time sponsor unlocks, and fixed turn-based episode cadence.
- Run-scoped `RecapLog` that collects meaningful recent highlights and snapshots immutable chronological episode records.
- Spectacle integration for real player combat, kills, pickups, quest completion, chests, and traps. Sponsor unlocks and published episodes are authoritative `GameEvent` journal entries.
- `U` Audience panel for spectacle score, followers, episode total, and unlocked sponsors; `Y` recap panel for episode timeline and highlights. Both actions use the existing action router/input map and close with their toggle key or Escape.
- Strict TDD coverage: unit tests cover threshold/sponsor behavior, repeated episode prevention, and immutable recap snapshots; a real Game-scene E2E test drives combat through keyboard input, checks audience events/state, and opens both panels.
No unrelated behavior or DCWASCII files were modified.
## Root cause and TDD evidence
The F4 capability was entirely absent: the input map listed `audience` and `recap`, but there was no audience state, recap log, UI scene/presentation controller, action dispatch, run persistence, or tests.
The red test run (`/tmp/f4-unit-red.log`) failed as intended with parse errors because `res://scripts/domain/meta/audience_state.gd` and `recap_log.gd` did not exist; `./scripts/test-unit.sh` returned status 1. The implementation then made the same tests green without a workaround.
## Verification and captures
`git diff --check` passed.
`./scripts/verify.sh` completed successfully with Godot 4.5.0:
- Unit: **171 / 171** tests, **1,283** assertions
- Integration: **10 / 10** tests, **59,462** assertions
- E2E: **50 / 50** tests, **502** assertions, including `test_audience_episode_e2e.gd`
- Visual: both Xvfb captures passed and were inspected
Captured and validated artifacts (ignored by Git):
- `artifacts/visual-check.png`: `dungeon_non_black_pixels=489308`, `visible_pixels=17524`, `explored_pixels=10438`, `explored_luminance=0.012`, `unknown_pixels=365325`, `unknown_luminance=0.001`
- `artifacts/visual-check-exit.png`: `dungeon_non_black_pixels=489252`, `visible_pixels=17404`, `explored_pixels=17146`, `explored_luminance=0.012`, `unknown_pixels=439497`, `unknown_luminance=0.001`
The verification output contained only the pre-existing third-party GUT invalid-UID/resource cleanup warnings; it contained no application `SCRIPT ERROR` or parse error.
## Git
All F4 implementation, tests, resource UID files, and this report are included in one local commit. No push and no PR were created.