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>
|
||
|---|---|---|
| .. | ||
| miroir-core | ||
| miroir-ctl | ||
| miroir-proxy | ||