feat: a launch cleanup that clears the test orders, run once by hand

ops.launch_reset counts the orders, quotes, payment attempts and
notifications, and with --confirmar APAGAR removes them, with their moves,
files and notices. The artwork files are marked expired so the worker
deletes them from storage. Operators, the Tiny connection and the backups
stay; --contas also removes customer accounts. It refuses if any payment
was made with real money. Order numbers restart at #1 with the database
administrator's rights, so the script prints the psql line for the db
container when the worker's role cannot do it.

The test runs last in CI, since it empties the order tables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-10-05 12:07:24 -03:00
parent 1b445f0459
commit b1fbaad2bd
4 changed files with 152 additions and 1 deletions

View File

@@ -175,6 +175,21 @@ SHA of the last known-good Gitea commit and redeploy. This rolls back Site, API,
Kanban, and worker code; it does not undo database migrations or restore data.
After recovery and a corrected release, return `IMAGE_TAG` to `latest`.
## 6. Before opening to customers
Once, right before launch, clear the test orders from the worker's console
(Containers > worker > Console):
```bash
python -m ops.launch_reset # only counts
python -m ops.launch_reset --confirmar APAGAR # removes orders, quotes and payments
```
It refuses if any payment was made with real money. Order numbers restart at
#1 only with the database administrator: the script prints the `psql` line to
run in the `db` container's console. Add `--contas` to remove the test
customer accounts too.
## Current blocker
This is the final deployment shape, but it is not authorized for production