feat(backend): add operational smoke tooling and safe pricing cleanup endpoints

- add backend README and refresh API map and smoke regression docs
- add full backend smoke regression script
- add admin pricing cleanup preview and dry-run endpoints
- add helper script for test pricing cleanup
- verify typed error contracts, draft flow, publish readiness and preview flows
- verify publish preview retention and clean backend startup behavior
This commit is contained in:
greebo
2026-03-19 22:54:12 +03:00
parent 127c5bff71
commit 0f9c2a1cbd
16 changed files with 551 additions and 235 deletions

View File

@@ -90,6 +90,10 @@
- GET /api/v1/admin/artifacts/publish-preview/audit
- POST /api/v1/admin/artifacts/publish-preview/cleanup
## app/api/routes/admin_cleanup.py
- GET /api/v1/admin/schemes/{scheme_id}/pricing/categories/cleanup-preview
- POST /api/v1/admin/schemes/{scheme_id}/pricing/categories/cleanup
## 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.

View File

@@ -17,6 +17,14 @@ export API_URL="http://127.0.0.1:9020"
export API_KEY="admin-local-dev-key"
export SCHEME_ID="82086336d385427f9d56244f9e1dd772"
## Main script
Primary operator regression:
`backend/scripts/smoke_regression.sh`
The script is expected to fail fast on any contract break or unexpected 5xx.
## 1. Health / system
- GET /healthz -> 200
@@ -175,14 +183,14 @@ Validate:
- GET /api/v1/admin/schemes/{scheme_id}/current/validation -> 200
- GET /api/v1/admin/artifacts/publish-preview/audit -> 200
- POST /api/v1/admin/artifacts/publish-preview/cleanup?dry_run=true -> 200
Optional:
- POST /api/v1/admin/schemes/{scheme_id}/current/display/regenerate?mode=passthrough -> 200
- POST /api/v1/admin/display/backfill?mode=passthrough&limit=10&only_missing=true -> 200
- GET /api/v1/admin/schemes/{scheme_id}/pricing/categories/cleanup-preview -> 200
- POST /api/v1/admin/schemes/{scheme_id}/pricing/categories/cleanup with dry_run=true -> 200
Validate:
- audit endpoint does not report orphan files or missing files for DB rows in normal state
- artifact audit does not report orphan files or missing files for DB rows in normal state
- validation report is readable and deterministic
- pricing cleanup preview returns matched candidates and safe_to_delete_count
- pricing cleanup dry-run returns deleted_count=0 and would_delete_count>0
- admin routes do not produce 500 for healthy scheme state
## 13. Audit trail
@@ -207,6 +215,7 @@ Regression is considered failed if any of the following happen:
- draft summary / structure / validation / compare-preview returns 500
- pricing bundle or diagnostics contract changes unexpectedly
- admin audit/cleanup endpoints fail on healthy environment
- pricing cleanup dry-run mutates data
- artifact retention grows without bound for repeated preview refresh on same variant
## 15. Operator note
@@ -220,3 +229,4 @@ Run this checklist after:
- startup/import/config changes
- draft lifecycle changes
- publish readiness changes
- admin cleanup changes