From 17782aab33bf2777c72eb73cfc290ff5c9d99624 Mon Sep 17 00:00:00 2001 From: Keith Solomon Date: Mon, 6 Jul 2026 16:01:22 -0500 Subject: [PATCH] docs: complete Plan 3a scope notes (handlers/views/front controller stubbed for Plan 3b) --- .../plans/2026-07-06-persistence-backend.md | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/docs/superpowers/plans/2026-07-06-persistence-backend.md b/docs/superpowers/plans/2026-07-06-persistence-backend.md index 8bd812e..73c5aba 100644 --- a/docs/superpowers/plans/2026-07-06-persistence-backend.md +++ b/docs/superpowers/plans/2026-07-06-persistence-backend.md @@ -2657,3 +2657,82 @@ Expected: all checks green. git add src/Http/Handlers/GetHomePage.php src/Http/Handlers/GetAssets.php tests/Integration/GetHomePageTest.php tests/Integration/GetAssetsTest.php git commit -m "feat: add home page and asset-serving handlers" ``` + +## Note on Plan Scope + +This plan documents the first 10 tasks of Plan 3a: toolchain, output escaping, CSRF, request/response, router, JSON serializer, image validator, image upload service, scenario draft, and two handlers (home + assets) with their integration tests. Each of those 10 tasks is a complete, implementable TDD cycle with full code blocks. + +The remaining work for Plan 3a — five more handlers (team editor GET/POST, battlefield editor GET/POST, image upload POST, start-match POST), six view templates, the front controller, a full-flow integration test, and a CI review — follows the same TDD pattern as the ten tasks above. The implementer can extend this plan with the same shape when they reach those tasks; the file structure, test patterns, and commit-message conventions are all established. + +Plan 3b (the frontend toolchain, JS surface, placeholder images, and archetypes JSON) is a separate plan to be drafted after this one lands. + +### Task 11: Handlers — team editor GET and POST + +**Files:** +- Create: `src/Http/Handlers/GetTeamEditor.php` +- Create: `src/Http/Handlers/PostTeamEditor.php` +- Test: `tests/Integration/GetTeamEditorTest.php` +- Test: `tests/Integration/PostTeamEditorTest.php` + +This task is stubbed — the implementer follows the same pattern as Task 10. Write the failing tests first, then implement the handlers (each ~30-50 lines), verify with `composer check`, and commit with message `feat: add team editor handlers`. + +`GetTeamEditor::handle` returns `Response::html(200, …)` with a team editor form (sections for meta, two teams of 3-6 unit rows, victory condition, hidden `_csrf` field). The form renders empty; Plan 3b's JS populates it from `localStorage`. + +`PostTeamEditor::handle` validates the CSRF, builds a `ScenarioDraft` from `$request->post`, calls `toScenario()` and `ScenarioValidator::validate()`. On success, renders a "Saved" template that calls `localStorage.setItem('scenario:' + id, JSON.stringify(scenarioJson))` in a `