fix(03): WR-06 surface move-failed distinctly with re-save guidance
This commit is contained in:
@@ -434,10 +434,23 @@ export async function runOutboxDrain(): Promise<void> {
|
||||
const result = await dispatchRow(row)
|
||||
|
||||
if (result.conflict) {
|
||||
// WR-06: distinguish an edit-as-move create-412 from a same-calendar conflict.
|
||||
// For a move (D-04) the create runs first; on 412 the paired delete is later
|
||||
// marked failed and the original event survives — so this is NOT a "the event
|
||||
// changed elsewhere" conflict, it is "the move could not be applied". The PWA
|
||||
// set lastSyncedUid to the NEW (move) uid, whose only outbox row is this failed
|
||||
// create, so without a distinct message the user sees the wrong conflict copy
|
||||
// and has no cue to retry. Emit a move-specific lastError that does NOT contain
|
||||
// '412' so the toast routes it to the dedicated move-failed copy instead of the
|
||||
// generic etag-conflict copy.
|
||||
const isMoveCreate = !!row.groupId && row.operation === 'create'
|
||||
const conflictError = isMoveCreate
|
||||
? 'move-failed: the event could not be moved — re-open it and save again'
|
||||
: (result.error ?? '412 conflict')
|
||||
// 412 — mark failed (no retry), re-sync calendar so UI sees authoritative state (D-08)
|
||||
await db
|
||||
.update(calendarOutbox)
|
||||
.set({ status: 'failed', lastError: result.error ?? '412 conflict' })
|
||||
.set({ status: 'failed', lastError: conflictError })
|
||||
.where(eq(calendarOutbox.id, row.id))
|
||||
await triggerTargetedResync(row.calendarUrl, row.userId)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user