Backend: Scenario create-from-UI support (validation + defaults) #58
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
POST /api/scenariosalready exists and stamps the owner (#50 Story 1). But "create a scenario from the UI" as a first-class flow may need more than the bare Post: sensible defaults (distribution_mode), the ability to seed an initial bucket set, and confirmation the create→redirect-to-show flow works end-to-end against the owner-scoped reads.This ticket exists to make in-app scenario creation a complete, tested flow rather than assuming the existing Post is sufficient. Scope to be confirmed during tdd-scoper — it may turn out the existing Post needs nothing and this collapses into a thin frontend-only follow-up.
Scope (to validate)
POST /api/scenariosreturns the created scenario IRI/id so the SPA can redirect to its show page.NotBlank). Any other field the UI must supply?GET /api/scenarios/{id}round-trips for the owner (no scoping surprise on a just-created row).Depends on
Testing (TDD if backend changes land)
Note
Flagged as possibly-thin — run tdd-scoper to confirm whether real backend work exists here or it folds into a frontend ticket.
Resolved in
e0e2f25(onrelease/v0.3.0).Verdict was as the ticket suspected — thin, no production code needed. The existing
POST /api/scenariosalready satisfies create-from-UI (owner stamped, returns@idfor redirect,namerequired,descriptionoptional). Landed two functional characterization tests intests/Functional/ScenarioApiTest.phppinning the SPA contract:testPostThenGetOnReturnedIriRoundTripsForTheOwner— create → GET the returned IRI as the same owner → 200 (guards against an owner-scope regression 404'ing the redirect target).testPostWithDescriptionPersistsAndEchoesIt— optionaldescriptionpersists and is echoed.Decisions:
distribution_modewas found dead (stored, never read) → spun out and removed under #61.195 tests green, php-cs-fixer + PHPStan clean.