forked from longtao.wu/droboticflow
reconcileSpace lists a page of up to 1000 heads, HEADs each object, then wrote the stale copy back with UpsertObjectSyncHead. A commit (new ETag, MD5 and platformVersion) or a digest attestation (md5sum and md5Attestation) that landed in that window was reverted, leaving the head drifted or legacy again. Reconcile now records its verdict with SetObjectSyncHeadDrifted. It sets only drifted and updatedAt, and only while the head still has the remoteETag, versionId, platformVersion and md5sum that reconcile read; a changed head is skipped. The Mongo filter matches missing legacy fields with $in [null, ""] like the attestation CAS, and never upserts. The scanned/drifted counters and the end-of-run space capability are unchanged. Tests run a real commit and a real digest backfill on a second coordinator replica while reconcile's HEAD is in flight and check that both receipts survive unchanged; genuinely drifted heads are still flagged. Store tests cover each compared field and the Mongo filter. The design doc no longer lists this as a follow-up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>