Repository navigation
v7.0.0
A MAJOR release: an admin update that sets stock_quantity on a product or variant now needs If-Match with the current ETag (428 otherwise), so a form read before some sales can no longer undo them; GET /api/v1/admin/products/{product_id} gives that ETag, deactivated products included. The personal data export is now a zip archive built by a Celery worker and downloaded after login (F-42); a deletion request removes it at once. An open dispute's status no longer moves back on out-of-order Stripe events, product listings with search_query count under the search limit (F-19), and the Checkout Session response answers expires_at. stripe-python 17.1.0, and CI cut to four jobs with local checks in pre-commit. No migration. Tested in CI on PostgreSQL 18.6 and Redis 8.8; the servers were not audited again.
Upgrade notes
- Breaking for admin clients:
PUTandPATCHof/api/v1/admin/products/{id}and of/api/v1/admin/products/{id}/variants/{variant_id}that setstock_quantitynow requireIf-Matchwith the current ETag; without it, or with*, the answer is 428 Precondition Required (RFC 6585) and nothing changes. Read the ETag fromGET /api/v1/admin/products/{id}(new; it shows deactivated products too) orGET /api/v1/admin/products/{id}/variants/{variant_id}(or the previous update's response) and send it; on 412, refetch and retry. Updates withoutstock_quantityare unchanged. This is why 7.0.0 is a major release. - A personal data export is now a zip archive downloaded after login, no longer the data inside the mail. The frontend must serve the page the ready mail links to,
<FRONTEND_URL>/account/data-export/<request_id>, which downloadsGET /api/v1/legal/data-export/{request_id}with the user's token. docker-compose.ymladds thegdpr_exportsvolume onapiandcelery-worker(created bydocker compose up); the two must run on one host. New settingGDPR_EXPORT_DIR(defaultexports,/app/exportsin the image).
Added
GET /api/v1/admin/products/{product_id}: an admin reads one product, deactivated ones included, asGET /products/{id}shows it, with the ETag that a product update checks inIf-Match.GET /api/v1/legal/data-export/{request_id}: the account that requested an export downloads its zip archive (account, addresses, orders with their lines, payments, refunds as JSON) forGDPR_EXPORT_EXPIRY_HOURS(24). 409 while it is being built, 404 when it failed, expired or belongs to another account.- Celery tasks
build_gdpr_export(builds the archive, then mails that it is ready) andcleanup_expired_gdpr_exports(hourly, deletes expired archives). POST /api/v1/orders/{order_id}/checkout-sessionanswersexpires_at: when the hosted page stops taking payment (created_atplusCHECKOUT_SESSION_EXPIRE_MINUTES), the same instant sent to Stripe.- A deletion request (
request_typedeletion) deletes the account's export archives at once, without recovery; a build still running for the account keeps nothing and sends no mail.
Changed
- Dependencies: Celery 5.7.0 (kombu 5.7.0), stripe 17.1.0, FastAPI 0.165.0, SQLAlchemy 2.1.9, pydantic 2.14.4 (pydantic-settings 2.16.3), psycopg 3.3.9, python-multipart 0.0.34, email-validator 2.4.0, anyio 4.16.0, httpx2 2.16.2, ruff 0.17.6, hypothesis 6.170.17, coverage 7.17.3, mypy 2.4.1.
- Stripe: stripe-python 17.1.0 pins API version
2026-11-18.endive(a monthly Endive release; the SDK changelog lists additions and type changes only). Its one breaking change, API keys no longer kept in pickled Stripe objects, does not apply: the application does not pickle them. Create a new webhook endpoint with that version; see docs/OPERATIONS.md. - python-dateutil 3.0.0 -> 2.9.0.post0: Celery 5.7.0 requires exactly
python-dateutil==2.9.0.post0. dateutil is used only by Celery and freezegun; the application keeps time in UTC, and the time zone test matrix passed on 2.9 before it was removed. - CI is 4 jobs instead of 11:
lint(Ruff, mypy, module length, pip-audit),test(SQLite, both coverage gates),integration(whole suite, timing-sensitive database tests and real-Redis parity on the PostgreSQL 18 and Redis 8.8 images Compose deploys, then the previous release on the new migrations) anddocker-build(three images, Trivy). Runs on pushes and pull requests only, no longer weekly; a new push to a pull request cancels its older run; every job has a timeout; checkouts keep no credentials. - Bandit is replaced by Ruff's
Srules overapp/(the rules Bandit rates low stay off, as in the medium-severity Bandit run); the accepted bind address is marked# noqa: S104. - gitleaks moved from CI to a pre-commit hook:
.pre-commit-config.yaml, run byprek(new dev dependency, 0.5.11), with zizmor, Ruff,uv lock --checkand generic file checks. Install once per clone withuv run prek install. - Age rule: one week for every dependency, base images, actions and hooks included (was two weeks for those). Updates are made by hand;
.github/dependabot.ymlis removed. - Coverage records which test ran each line (pytest-cov
--cov-context=testin CI), shown bycoverage html. .github/scripts/migration_compat.shleaves out the old release's migration test files by file (--ignore) instead of seven test ids; one of the ids no longer existed.POST /api/v1/legal/data-requestwithexport: request ids areexport_<32 hex digits>; while an export is being built or can be downloaded, a new export request answers its id and builds nothing; when the task cannot be queued the answer is 503 (Retry-After: 30).
Removed
- CI jobs
benchmark(and.github/scripts/benchmark_ab.sh), the 7-time-zone matrix (naive local time is rejected by Ruff's DTZ rules), PostgreSQL 16 and 17 runs (PostgreSQL 18 is the supported server),secrets(now a pre-commit hook), the CycloneDX SBOM artifact and the coverage XML artifact.
Fixed
- The data export loaded the whole account into the API worker's memory and mailed it as one message, without any limit: a large account cost the worker that much memory on every request, and a mail too large for the mail servers was lost although the request counted as done. The 3.0.0 size cap had been removed with the old export route in 4.0.0 (F-42). The archive is now written in batches by a Celery worker, and one export per account is built at a time.
- An open dispute could show a stale status: Stripe does not deliver events in order, and a
charge.dispute.createdorcharge.dispute.funds_withdrawn(needs_response) that arrived aftercharge.dispute.updated(under_review) moved the stored status back. An open status now only moves forward (inquiry, chargeback, appeal); an event with an earlier one is acknowledged and ignored, as a late event for a closed dispute already was. The order was on hold either way; only the status and evidence shown to the admin and the customer were stale. Found by the stateful payment test.
Security
- An admin could overwrite stock moved by orders: a product or variant update set
stock_quantityto the value the admin's form had read, andIf-Matchwas optional, so sales made since were undone and the shop could sell stock it no longer had. A stock change now needsIf-Matchwith the current ETag (428 otherwise, 412 when stale). - A product listing with
search_query(GET /api/v1/products?search_query=) runs the same text match asGET /api/v1/products/searchbut was counted underRATE_LIMIT_DEFAULT(300/minute), five times the search limit. Both are now counted together underRATE_LIMIT_SEARCH(60/minute); a listing without a search term keeps the default limit (F-19).