feat(reshard): tag backfill writes with _miroir_origin for CDC suppression (P5.1.c, miroir-uhj.1.3)

Per plan §13.1 step 3, backfill writes must be tagged with _miroir_origin:
reshard_backfill so that §13.13 CDC suppresses them by default. This ensures
that shadow-index writes during backfill do not generate duplicate CDC events
for client writes (only the live-index write emits an event).

Changes:
- Add _miroir_origin field to shadow documents in process_reshard_chunk
- Remove unnecessary X-Miroir-Origin header (field-based tagging is canonical)
- Aligns with dual-write preparation code (reshard.rs line 1779)

Closes: miroir-uhj.1.3
This commit is contained in:
jedarden 2026-05-24 17:38:23 -04:00
parent fea0c90558
commit 0ad96cd38e

View file

@ -641,6 +641,9 @@ impl ModeCWorker {
// Clone document and update _miroir_shard field
let mut shadow_doc = doc.clone();
shadow_doc["_miroir_shard"] = serde_json::json!(new_shard_id);
// Tag with _miroir_origin for CDC suppression (plan §13.1, §13.13)
// Backfill writes are suppressed from CDC by default
shadow_doc["_miroir_origin"] = serde_json::json!(ORIGIN_RESHARD_BACKFILL);
shadow_documents.push(shadow_doc);
}
@ -655,7 +658,6 @@ impl ModeCWorker {
let response = client
.post(&write_url)
.header("Authorization", format!("Bearer {}", node_master_key))
.header("X-Miroir-Origin", ORIGIN_RESHARD_BACKFILL)
.json(&shadow_documents)
.send()
.await