fix(documents): tighten archive/restore idempotency + document fire-and-forget
Three follow-ups from Task 6 code review: 1. applyEntityArchivedSuffix short-circuits when the folder is already archived — prevents archivedAt drift on backfill replay. 2. applyEntityRestoredSuffix short-circuits when the folder was never archived — matches the docstring's "no-op" claim. 3. Inline comment on archiveClient's fire-and-forget hook documents why Task 6 uses void (archive UI doesn't depend on folder sync) while Task 5 uses await (rename should be visible to the next read). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -557,6 +557,10 @@ export async function archiveClient(id: string, portId: string, meta: AuditMeta)
|
||||
|
||||
await softDelete(clients, clients.id, id);
|
||||
|
||||
// fire-and-forget: archive UI does not depend on the folder suffix
|
||||
// being stamped before the HTTP response returns. Task 5 (rename
|
||||
// hook) uses await because the rename should be visible to the
|
||||
// next read; archive does not.
|
||||
void applyEntityArchivedSuffix(portId, 'client', id).catch((err) => {
|
||||
logger.warn({ err, clientId: id }, 'Failed to apply archived suffix to client folder');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user