feat(federation): capture dm_close/reopen/read_state/profile/file_rejected in mutation log

Four event types previously bypassed appendMutationLog, making
them unrecoverable via /api/federation/sync after peer inactivity:
  - queueDmCloseRelay (dm_close, dm_reopen)
  - queueReadStateRelay (read_state_update)
  - handleSizeRejection in federationWorker (file_rejected)
  - profile PATCH route (profile_update) — two call sites,
    one appendMutationLog per profile change (not per target origin)

The /api/federation/sync response builder is extended to
serialize these event types in the next task.
This commit is contained in:
Jannis Braun
2026-04-22 00:48:49 +02:00
parent 250596c0f6
commit a23e02339e
4 changed files with 175 additions and 2 deletions
@@ -700,6 +700,12 @@ export function queueReadStateRelay(
};
const targetOrigins = getGroupDmTargetOrigins(channelId);
appendMutationLog(
`read_state:${channel.federatedId}:${userId}`,
channelId,
'read_state_update',
JSON.stringify({ user: { homeUserId, homeInstance }, messageRef }),
);
queueOutboxEvent(
`read_state:${channel.federatedId}:${userId}`,
channelId,
@@ -755,6 +761,12 @@ export function queueDmCloseRelay(
};
const targetOrigins = getGroupDmTargetOrigins(dmChannelId);
appendMutationLog(
`${eventType}:${channel.federatedId}:${userId}`,
dmChannelId,
eventType,
JSON.stringify({ homeUserId, homeInstance }),
);
queueOutboxEvent(
`${eventType}:${channel.federatedId}:${userId}`,
dmChannelId,