Upgrading to 0.6
This guide covers moving from 0.5.x to 0.6.0. 0.6 adds legal holds, account erasure, emergency deletion, erasure webhooks and an opt-in access log. It runs two database migrations, 0011 and 0012, so back up Postgres first.
Almost everything is additive. The exceptions are the reserved id dotwire:erased, 409 responses moving to a new Conflict error kind in the SDKs, and new required members on two SDK types. Each one is in the tables below.
Breaking changes
| Area | In 0.6.0 | What to do |
|---|---|---|
Reserved id dotwire:erased | Erasure writes this constant as the sender of anonymized messages, so it's now rejected as a token sub, in admin path ids and as an injection senderId. No migration renames existing rows. | Search your user ids for this exact value before upgrading, and rename any you find. |
Error kind Conflict | Both host SDKs gain a Conflict error kind, and every 409 (self_role_change, last_admin and the new codes) now classifies as Conflict instead of Unknown. In .NET, Conflict is inserted before PresendRejected, so the numeric values of PresendRejected, RateLimited, Unavailable and Unknown shift by one. | Update code that matched Unknown for 409s. Compare DotwireErrorKind by name, not by number. |
| SDK types gain required members | UserExport gains accessLog / AccessLog, and ComplianceSettings gains accessLogEnabled and accessLogRetentionDays (AccessLogEnabled, AccessLogRetentionDays). Code that builds these types by hand, in tests or fixtures for example, must pass them. An export from an older server parses with an empty accessLog. | Add the new members wherever you construct these types. |
IDotwireHostClient.MintToken | Gains a trailing optional actor parameter. Callers compile unchanged. | Only a class that implements the interface itself must add the parameter. |
What's new
| Area | In 0.6.0 | What to do |
|---|---|---|
| Legal holds | POST /admin/holds places a hold on a room or a user, DELETE /admin/holds/{id} releases it and GET /admin/holds lists them. While any hold is active, retention for messages and the access log is paused, and redaction and erasure of held data answer 409 legal_hold. See Compliance. | Nothing, unless you need holds. |
| Account erasure | POST /admin/users/{id}/erase revokes the user's access at once, like a role deletion, then a background worker anonymizes (reattributes to dotwire:erased) or deletes their messages in Postgres and JetStream. Poll GET /admin/erasures/{id} or list with GET /admin/users/{id}/erasures. Erasure waits for holds, MinimumKeepDays and AllowChanges and reports what blocks it. | Pick a default mode with Dotwire:Compliance:Erasure:Mode and decide it with counsel. |
409 erasure_open | While an erasure is open, PUT /admin/users/{id}/role, POST /admin/rooms/{id}/members and admin injection with that user as senderId answer 409 erasure_open. Member adds now take the role-mutation lock, so they may wait briefly during concurrent role changes. | Handle erasure_open in admin tooling. |
| Redaction refusals | DELETE /admin/rooms/{roomId}/messages/{seq} answers 409 legal_hold, 409 minimum_keep or 409 changes_not_allowed when a hold or setting applies. A refusal writes no audit event. | Handle the new codes in admin tooling. |
| Emergency deletion | POST /admin/rooms/{roomId}/messages/{seq}/emergency-delete with a reason of illegal_content or court_order removes a message even under a hold or keep period, and is audited as message.redacted.emergency. | Use it only with a documented basis. |
| Compliance settings | New Dotwire:Compliance section: AllowChanges, MinimumKeepDays, Erasure:Mode, Erasure:RecheckMinutes and HoldRetentionWaitSeconds. GET /admin/compliance reports them along with the active hold count and whether retention is paused. See Configuration. | Nothing. The defaults keep 0.5 behavior. |
| Retention | GET /admin/retention adds paused. PUT /admin/retention answers 409 minimum_keep for 0 < days < MinimumKeepDays, and startup refuses Dotwire:Retention:MessagesDays in that range. | Check MessagesDays against MinimumKeepDays before upgrading. |
| Erasure webhook | Set Dotwire:Webhooks:Erasure:Url to receive a signed notice for each redaction and erasure (onErasure in @dotwire/host, Erasure in Dotwire.Host). Delivery is at least once, and an undelivered notice expires after Nats:ErasureNoticesMaxAgeHours (168 by default). | If you copy messages out of dotwire (search, archives, postsend consumers), set the URL and delete your copies when a notice arrives. Dedupe in the receiver. |
| Live erasure events | Clients receive MessagesErased on the hub and erased on SSE, with the room, mode and seqs. @dotwire/client adds onMessagesErased, and useRoom applies it. See Hub events. | Handle it if you render messages without useRoom. |
| Access log (off by default) | Dotwire:AccessLog:Enabled=true records each live window (hub subscribe or SSE stream) and each history page before it's served, queryable through GET /audit/access. A read the log can't record is refused: 503 access_log_unavailable on REST and SSE, AccessLogUnavailable on the hub. Startup refuses it with Nats:Enabled=false or Auth:MaxTokenLifetimeMinutes=0. | Leave it off, or turn it on on every node at once and record the choice in your risk analysis. |
Token claim dw:actor | An optional claim that names who made a call on a member's behalf, validated like sub. Both host SDKs set it to the admin user id on their own member calls, so access-log rows name your backend rather than the member. Pass actor to mintToken / MintToken to set it yourself. | Nothing, unless you mint tokens for backend reads and want them attributed. |
| DSAR export and compliance response | The export adds an accessLog array (rows where the user is the subject or the actor). GET /admin/compliance adds accessLogEnabled and accessLogRetentionDays. | Nothing for JSON consumers. |
| History during a NATS outage | History and SSE replay now wait at most 3 seconds for the JetStream tail, then serve Postgres rows alone, instead of waiting for NATS to return. | Nothing. |
| TimescaleDB | Erasure and DSAR sender scans rely on the sender_id bloom filter TimescaleDB 2.32 builds on compressed chunks. 2.11 to 2.31 aren't verified for this release. | Use the Compose-pinned TimescaleDB 2.32.0, or test your version first. |
| SDKs | All packages are at 0.6.0. @dotwire/react 0.6.0 requires @dotwire/client ^0.6.0. Both host SDKs add methods for holds, erasure, emergency deletion, the compliance settings and the access log. | Upgrade @dotwire/react and @dotwire/client together. |
Rollout order
- Back up Postgres. Migration
0011adds the hold and erasure tables and replacesset_message_retention. Migration0012adds theaccess_loghypertable, which is created even with the access log off. - Search your user ids for
dotwire:erased, and checkDotwire:Retention:MessagesDaysagainstDotwire:Compliance:MinimumKeepDays. - Roll the migrating node first, then the other server nodes. With the Compose files, set
DOTWIRE_VERSION=0.6.0or pull the new defaults. - Update host applications to the 0.6.0 SDKs, handling
Conflictand the new required members. Then roll browser clients. - Optionally, set
Dotwire:Webhooks:Erasure:Urland turn on the access log, the same way on every node.
0.6 changes the schema, and running a 0.5 image against it isn't tested. To roll back, restore the backup from step 1 and run the 0.5.1 image.