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¶
- Run
tempest lint-layersand count the warnings per code. - Follow the order and the traps in
Recommended architecture › Migrating an existing service,
one family per PR, with
tempest lint-layers --rule <CODE>. - Once a family reaches zero, turn on
layers_strict = trueunder[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 gets403. Switch totempest_fastapi_sdk.testing.admin_login(async) oradmin_login_sync(TestClient), which load the form and send the token. Withcookie_secure=True, give the clientbase_url="https://...": the token cookie isSecure. - An admin served over plain HTTP with
cookie_secure=True(which already could not keep a session) now refuses every login with403"The sign-in form expired". The fix is the same as before: HTTPS in front, orcookie_secure=False. - Code that read
tempest_fastapi_sdk.cli.main.LINT_LAYERS_STEPmust handleNone(withouttempest-cliinstalled).find_pyproject, fromtempest_fastapi_sdk.cli.config, is now the SDK's own; the other config names stay importable from the same place. - Optional:
tempestin production can swap[cli]for[cli-ops], which installs neitherruffnortempest-cli. Keep[cli]in thedevgroup.
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 anotherx-queue-typeor withx-message-ttl) makesconnect()fail withPRECONDITION_FAILED - inequivalent arg ...before any consumer runs. Align theQueueSpecwith what exists, delete the queue, or passdeclare_topology=Falseand manage the topology outside. publish(..., exchange=...)is now a named parameter and the channel becomes the routing key: passingrouting_key=alongside through**optionsraisesValueError— 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(orOSError) around a send: catchEmailDeliveryException(exported at the package top level). A network or TLS failure carries the original error in__cause__; a refusal answered by the server is raisedfrom None. - Check
SMTP_PORT,SMTP_USE_TLSandSMTP_USE_SSLbefore deploying to production:587needsSMTP_USE_TLS=trueandSMTP_USE_SSL=false;465needsSMTP_USE_SSL=trueandSMTP_USE_TLS=false. Both enabled also fails the boot. make_auth_routerclients:/signup,/email-change/*,/email-verify/requestand/email-recovery/requestmay answer503 EMAIL_UNAVAILABLE(nothing stored; safe to retry)./activation/requestand/password-reset/requestkeep their usual202.
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 (withoutstream_object'schunk_size). Without them, the type checker rejects the client. - Code calling
storage.client.presigned_put_url(storage.key(...)),stat_objectorstream_objectdirectly can switch topresign_put,statandread(max_bytes=...), which pin the subject prefix.
0.320.0 — production guard for e-mail and links¶
With ENV=production and e-mail on (a missing EMAIL_ENABLED counts as on),
two new rules fail the boot:
EmailSettings: a devSMTP_HOST(mailpit,mailhog, port1025on loopback, the declared default withoutSMTP_USERNAME) and anSMTP_FROM_ADDRleft at the default (noreply@example.com), empty, without@, or on a reserved domain.AuthSettings: the fourAUTH_*_URL_TEMPLATE(activation, reset, e-mail change and verification) with a local/reserved host or a scheme other thanhttps. Thehttp://localhost:3000/...defaults hit this rule.
What to do¶
- Configure a real SMTP and an
SMTP_FROM_ADDRon your own domain (Gmail with an app password onsmtp.gmail.com:587passes). - 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 answer503 INTEGRATION_DISABLED.