feat(backend): harden pricing mutation contract and sync backend docs

- add typed response schemas for pricing write endpoints
- add stale draft version guard for pricing mutations
- unify pricing API contract around expected_scheme_version_id
- update API route map
- add smoke regression checklist for backend routes and artifact flows
This commit is contained in:
greebo
2026-03-19 19:11:33 +03:00
parent c7c9184a71
commit fbeac890be
5 changed files with 197 additions and 215 deletions

View File

@@ -55,6 +55,19 @@
- POST /api/v1/schemes/{scheme_id}/draft/remap/preview
- POST /api/v1/schemes/{scheme_id}/draft/remap/apply
## app/api/routes/editor.py
- GET /api/v1/schemes/{scheme_id}/draft/structure
- GET /api/v1/schemes/{scheme_id}/draft/compare-preview
- POST /api/v1/schemes/{scheme_id}/draft/sectors
- POST /api/v1/schemes/{scheme_id}/draft/groups
- DELETE /api/v1/schemes/{scheme_id}/draft/sectors/records/{sector_record_id}
- DELETE /api/v1/schemes/{scheme_id}/draft/groups/records/{group_record_id}
- PATCH /api/v1/schemes/{scheme_id}/draft/seats/records/{seat_record_id}
- POST /api/v1/schemes/{scheme_id}/draft/seats/bulk
- PATCH /api/v1/schemes/{scheme_id}/draft/sectors/records/{sector_record_id}
- PATCH /api/v1/schemes/{scheme_id}/draft/groups/records/{group_record_id}
- POST /api/v1/schemes/{scheme_id}/draft/repair-references
## app/api/routes/admin.py
- GET /api/v1/admin/schemes/{scheme_id}/current/artifacts
- GET /api/v1/admin/schemes/{scheme_id}/current/validation
@@ -66,4 +79,4 @@
## Notes
- This file is an operational route index, not a generated OpenAPI export.
- Update this map in the same change set when adding, removing, renaming, or moving routes.
- Editor routes are maintained separately and should be synced from current source before relying on this file as a full route inventory.
- Query guards such as expected_current_scheme_version_id / expected_scheme_version_id are part of the operational contract for optimistic concurrency on mutable flows.

View File

@@ -62,16 +62,20 @@ Validate:
- no 500 on passthrough mode
- unsupported mode returns 422
## 5. Pricing read model
## 5. Pricing read / write contract
- GET /api/v1/schemes/{scheme_id}/pricing -> 200
- GET /api/v1/schemes/{scheme_id}/current/seats/{seat_id}/price -> 200 for priced seat
- GET /api/v1/schemes/{scheme_id}/test/seats/{seat_id} -> 200 for known seat
- POST /api/v1/schemes/{scheme_id}/pricing/categories?expected_scheme_version_id={draft_version_id} -> 200 for valid draft
- POST /api/v1/schemes/{scheme_id}/pricing/categories?expected_scheme_version_id=deadbeef... -> 409 for stale draft
Validate:
- pricing bundle contains categories and rules arrays
- effective seat price resolves according to domain priority
- test seat preview explains selectable / has_price state
- pricing write responses are stable and typed
- stale pricing mutation returns `detail.code = stale_draft_version`
## 6. Draft publish preview
@@ -122,6 +126,8 @@ Regression is considered failed if any of the following happen:
- passthrough display endpoint fails on known-good sample
- publish preview refresh or cached read returns 500
- pricing bundle contract changes unexpectedly
- pricing write contract regresses or stops returning typed payloads
- stale draft guard stops returning 409 on pricing mutations
- admin audit/cleanup endpoints fail on healthy environment
- artifact retention grows without bound for repeated preview refresh on same variant