Files
edr-platform/apps/edr-freight-api
Nathnael 2dfea96cb8 fix(chat): retry rate limits, lock instead of deactivate, guard reconcile
Provisioning created nothing on dev. Synapse answers a burst of writes with
429 + retry_after_ms, and a reconcile is nothing but a burst of writes, so the
first throttled m.space.child PUT threw and took the whole run with it. On the
sign-in path ChatSsoService catches that by design, so every employee got a
working sign-in into an Element with no rooms in it. fetchWithRetry now sits
behind all three request wrappers and honours the delay Synapse asks for,
capped at 5 attempts so a wedged homeserver still fails rather than hangs.

Two ways the reconcile could destroy state, both now blocked:

- Zero position holders meant "remove everyone": every member kicked from
  every room, then every account deactivated. It never means that - it means
  the IAM query failed, the org/unit keys drifted, or a migration is
  mid-flight. reconcile() aborts, and syncMembership() refuses to empty a
  populated room, as a per-room backstop.
- Deactivation could not be undone here. Reactivation wants a password and
  password_config.enabled is false, and room memberships do not come back.
  Departed accounts are locked instead - same access block, one PUT to
  reverse - and ensureUser lifts the lock when someone returns in IAM.

Also: join the space itself, not only the rooms inside it, or Element leaves
every dept room loose in Home and never shows the space at all. And drop the
bridge's per-type routing - it pointed at a hardcoded dept-operation alias
while the reconcile derives dept-${positionKey} from IAM, so bridged
notifications went to a room the bridge created and nobody was in.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-01 06:28:55 +00:00
..
2026-06-29 13:00:55 +00:00
2026-08-22 00:49:53 +00:00
2026-05-12 16:50:18 +03:00
2026-08-15 08:53:24 +00:00
2026-08-12 07:57:20 +00:00
2026-07-16 01:05:57 +00:00
2026-05-12 15:17:16 +03:00