commit bb33b8c61bf0841ccc566c7ffbe469e0c346b7e1
parent 629eba8337ff091f741d305e8db7a39977a92e6e
Author: anon <anon@example.com>
Date: Thu, 5 Nov 2026 04:28:45 +0000
Specify browser test API boundary and bounded migration
Diffstat:
| M | TODO.md | | | 29 | +++++++++++++++++++++++------ |
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -124,12 +124,29 @@ rewriting this document does not close them.
## P1: bounded follow-up work
-- [ ] Consolidate repeated browser fixture setup when touching those scenarios.
- Keep real actions/assertions in the existing Playwright modules and reuse
- `tools/client/game_test.mjs`. Use one small test-only Go host for deterministic
- scenario setup and state inspection; keep transaction/unit tests beside Go
- code. Migrate a representative scenario first, preserving its assertions and
- cleanup. Do not rewrite 141 browser wrappers before fixing player-visible bugs.
+- [ ] **Separate browser scenarios from Go internals through a test-only API.**
+ Put browser scenarios and end-to-end assertions in JavaScript under
+ `tests/e2e/`, reusing `tools/client/game_test.mjs`. A shared Playwright fixture
+ owns server startup/shutdown, isolated temporary databases and cleanup,
+ including restart against the same database for persistence checks.
+ Compile a small server-side setup/inspection API only into test builds using
+ a Go build tag. Its implementation may access private Go state; browser tests
+ call the running server rather than individual Go tests. Keep synchronization,
+ persistence and the normal simulation lifecycle inside the server, without
+ per-scenario tick loops or exporting internal types to accommodate tests.
+ Provide reusable setup operations and explicit authoritative snapshots, not
+ arbitrary field/SQL access or wholesale serialization of internal structs.
+ Add narrowly scoped capabilities only for demonstrated scenario needs.
+ Setup prepares conditions; the action under test uses real browser input and
+ the normal client/server protocol. Keep rule, transaction, protocol and
+ exhaustive failure-injection tests in Go, including HTTP-handler unit tests
+ whose filenames happen to start with `browser_`.
+ Completion: migrate an ordinary interaction, an inventory refusal and a cold
+ restart scenario, preserving their assertions and verifying failure cleanup;
+ verify the test API is absent from production builds. Remove their redundant
+ Go browser runners and use this structure for new browser scenarios. Migrate
+ remaining runners incrementally by subsystem; a full server package split or
+ wholesale test migration is not an alpha prerequisite.
- [ ] Document/enforce server ownership boundaries as affected code changes:
protocol/session handling, world simulation, game rules/content, and durable
transactions. Keep low-significance simulation state in memory between