Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions internal/cli/devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,13 +578,13 @@ func replayQuarantinedEvents(ctx context.Context, stderr io.Writer, opts *option
if replayed > 0 {
_, _ = fmt.Fprintf(stderr, "Replayed %d quarantined event(s) from device %s\n", replayed, deviceID)
}
// ENV-SYNC-01 review: the replayed events may include the project.added an
// env_pending_project quarantine was waiting on — re-attempt those now so
// approving the project's origin device recovers the profile in one step.
if n, err := dssync.ReplayPendingEnvProfileConflicts(ctx, store); err != nil {
_, _ = fmt.Fprintf(stderr, "warning: could not replay pending env profile conflicts: %v\n", err)
// The replayed events may include the project.added a pending-project
// pointer quarantine was waiting on — re-attempt those now so approving the
// project's origin device recovers env and draft pointers in one step.
if n, err := dssync.ReplayPendingProjectConflicts(ctx, store); err != nil {
_, _ = fmt.Fprintf(stderr, "warning: could not replay pending project conflicts: %v\n", err)
} else if n > 0 {
_, _ = fmt.Fprintf(stderr, "Recovered %d pending env profile(s)\n", n)
_, _ = fmt.Fprintf(stderr, "Recovered %d pending project pointer(s)\n", n)
}
}

Expand Down
9 changes: 4 additions & 5 deletions internal/cli/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,10 @@ func pullAndApplyEvents(ctx context.Context, store *state.Store, hub dssync.Hub,
}
}
}
// ENV-SYNC-01 review: an env.profile.updated quarantined earlier because
// its project had not applied yet may be recoverable now that this batch
// applied (the project could have arrived in it). Replay AFTER apply so
// recovery is one-cycle.
if _, err := dssync.ReplayPendingEnvProfileConflicts(ctx, store); err != nil {
// Pointer events quarantined earlier because their project had not applied
// yet may be recoverable now that this batch applied (the project could
// have arrived in it). Replay AFTER apply so recovery is one-cycle.
if _, err := dssync.ReplayPendingProjectConflicts(ctx, store); err != nil {
return pullApplyOutcome{}, err
}
return pullApplyOutcome{events: remoteEvents, stats: stats}, nil
Expand Down
Loading
Loading