Skip to content

Migration 0.32x

Use when upgrading from a version older than these releases: 0.327.0, 0.325.0, 0.323.0, 0.322.0, 0.321.0 and 0.320.0.

Part of the Migration guide.

0.327.0 — the #616 architecture rules, as warnings

Nothing changes in the code you already have: the new tempest check rules (LAY*, IMP*, DI*, REPO002, RTR003/RTR004, STR*, TST*) enter as warnings and fail the gate only with layers_strict = true.

What to do

  1. Run tempest lint-layers and count the warnings per code.
  2. Follow the order and the traps in Recommended architecture › Migrating an existing service, one family per PR, with tempest lint-layers --rule <CODE>.
  3. Once a family reaches zero, turn on layers_strict = true under [tool.tempest].

0.325.0 — CSRF on the admin login and the [cli-ops] extra

POST /admin/login now requires the csrf_token that GET /admin/login issues. The CLI gains the [cli-ops] extra, without the quality gate.

What to do

  • A test that signs in to the admin by posting only the credentials (client.post("/admin/login", data={"identifier": ..., "password": ...})) now gets 403. Switch to tempest_fastapi_sdk.testing.admin_login (async) or admin_login_sync (TestClient), which load the form and send the token. With cookie_secure=True, give the client base_url="https://...": the token cookie is Secure.
  • An admin served over plain HTTP with cookie_secure=True (which already could not keep a session) now refuses every login with 403 "The sign-in form expired". The fix is the same as before: HTTPS in front, or cookie_secure=False.
  • Code that read tempest_fastapi_sdk.cli.main.LINT_LAYERS_STEP must handle None (without tempest-cli installed). find_pyproject, from tempest_fastapi_sdk.cli.config, is now the SDK's own; the other config names stay importable from the same place.
  • Optional: tempest in production can swap [cli] for [cli-ops], which installs neither ruff nor tempest-cli. Keep [cli] in the dev group.

0.323.0 — the dead-letter topology comes up before the consumers

On RabbitMQ, MessageBroker.connect() now opens the connection, runs declare_topology() and only then starts the consumers. The declaration used to come after, and a message rejected in that window was lost.

What to do

  • A queue that already exists on the broker with arguments other than the QueueSpec's (a DLQ created by hand with another x-queue-type or with x-message-ttl) makes connect() fail with PRECONDITION_FAILED - inequivalent arg ... before any consumer runs. Align the QueueSpec with what exists, delete the queue, or pass declare_topology=False and manage the topology outside.
  • publish(..., exchange=...) is now a named parameter and the channel becomes the routing key: passing routing_key= alongside through **options raises ValueError — pass the key as the channel.

0.322.0 — SMTP failure becomes 503 EMAIL_UNAVAILABLE and the guard checks TLS × port

EmailUtils.send and send_many now raise EmailDeliveryException (503, code="EMAIL_UNAVAILABLE") on every transport failure instead of the aiosmtplib error. With ENV=production and e-mail enabled, EmailSettings refuses a TLS mode that does not match the port.

What to do

  • Code that caught aiosmtplib.SMTPException (or OSError) around a send: catch EmailDeliveryException (exported at the package top level). A network or TLS failure carries the original error in __cause__; a refusal answered by the server is raised from None.
  • Check SMTP_PORT, SMTP_USE_TLS and SMTP_USE_SSL before deploying to production: 587 needs SMTP_USE_TLS=true and SMTP_USE_SSL=false; 465 needs SMTP_USE_SSL=true and SMTP_USE_TLS=false. Both enabled also fails the boot.
  • make_auth_router clients: /signup, /email-change/*, /email-verify/request and /email-recovery/request may answer 503 EMAIL_UNAVAILABLE (nothing stored; safe to retry). /activation/request and /password-reset/request keep their usual 202.

0.321.0 — SubjectStorageClient gains three methods

The SubjectStorageClient protocol (the type of SubjectObjectStorage.client) now declares presigned_put_url, stat_object and stream_object, which SubjectObjectStorage uses for direct upload (presign_put, stat, read). AsyncMinIOClient and FakeObjectStorageClient already implement all three.

What to do

  • A custom client implementing the protocol: add the three methods, with AsyncMinIOClient's signatures (without stream_object's chunk_size). Without them, the type checker rejects the client.
  • Code calling storage.client.presigned_put_url(storage.key(...)), stat_object or stream_object directly can switch to presign_put, stat and read(max_bytes=...), which pin the subject prefix.

With ENV=production and e-mail on (a missing EMAIL_ENABLED counts as on), two new rules fail the boot:

  • EmailSettings: a dev SMTP_HOST (mailpit, mailhog, port 1025 on loopback, the declared default without SMTP_USERNAME) and an SMTP_FROM_ADDR left at the default (noreply@example.com), empty, without @, or on a reserved domain.
  • AuthSettings: the four AUTH_*_URL_TEMPLATE (activation, reset, e-mail change and verification) with a local/reserved host or a scheme other than https. The http://localhost:3000/... defaults hit this rule.

What to do

  • Configure a real SMTP and an SMTP_FROM_ADDR on your own domain (Gmail with an app password on smtp.gmail.com:587 passes).
  • Configure the four templates with https:// and the app's domain.
  • Or, if e-mail is not ready yet, set EMAIL_ENABLED=false: the boot passes and the routes that send e-mail answer 503 INTEGRATION_DISABLED.