miroir/crates
jedarden d02486187d P2.2: Add write path acceptance tests
Added comprehensive acceptance tests for the write path implementation:
- POST /indexes/{uid}/documents - add documents
- PUT /indexes/{uid}/documents - replace documents
- DELETE /indexes/{uid}/documents/{id} - delete by ID
- DELETE /indexes/{uid}/documents - delete by IDs array or filter

Acceptance criteria verified:
1. 1000 docs indexed via POST — every doc fetch-by-id returns the same doc
2. Docs distribute across all configured nodes (no node holds < 20%)
3. Batch with one missing primary key → 400 miroir_primary_key_required
4. Doc containing _miroir_shard → 400 miroir_reserved_field
5. RG=2, RF=1, 1 group down: write succeeds with X-Miroir-Degraded: groups=1
6. RG=2, RF=1, both groups down: 503 miroir_no_quorum
7. DELETE by IDs array routes each ID to its shard independently

All tests pass. The write path implementation in documents.rs was already
complete and handles all required functionality including:
- Primary key extraction and validation
- _miroir_shard injection and reserved field rejection
- Two-rule quorum (per-group quorum + at least one group met quorum)
- Per-batch grouping for efficient fan-out
- Session pinning support (plan §13.6)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 13:01:33 -04:00
..
miroir-core P1.6: Verify property + benchmark tests for router 2026-05-23 12:42:50 -04:00
miroir-ctl P3: Phase 3 Task Registry + Persistence — COMPLETE 2026-05-02 16:50:42 -04:00
miroir-proxy P2.2: Add write path acceptance tests 2026-05-23 13:01:33 -04:00