35 lines
1.2 KiB
Markdown
35 lines
1.2 KiB
Markdown
# Experiment: Duplicate Batch Re-upload
|
|
Date: 2026-06-24
|
|
Phase: 24 — Climate Resilience Verification
|
|
|
|
## 1. Hypothesis
|
|
If I POST the same `batchReference` twice to `/api/v1/sync/batches`, I expect the
|
|
second request to return the existing batch id with only one row in
|
|
`clinical_sync_batches`, because batch reference is the idempotency key for gateway sync.
|
|
|
|
## 2. Baseline
|
|
- Test: `ClinicalSyncBatchTests.DuplicateBatchReference_ReturnsExisting`
|
|
- Fixture: `ApiFixture` with `GatewayRegistrySeeder` and active encounter
|
|
- Gateway auth: `X-Api-Key` + `X-Gateway-Id`
|
|
|
|
## 3. Break
|
|
```bash
|
|
dotnet test VigilCareClinicalAPI.Tests \
|
|
--filter "FullyQualifiedName~ClinicalSyncBatchTests.DuplicateBatchReference_ReturnsExisting"
|
|
```
|
|
|
|
The test posts identical `ClinicalSyncBatchRequest` (same `batchReference`) twice.
|
|
|
|
## 4. Observe
|
|
- First POST: HTTP 201 Created, returns `batchId`
|
|
- Second POST: returns **same** `batchId` as first response
|
|
- Database: exactly **1** row in `clinical_sync_batches` for that `batchReference`
|
|
- Test result: **Passed** (702 ms)
|
|
|
|
## 5. Fix / Outcome
|
|
- Bug found? **no**
|
|
- Fix applied: no fix needed — by design
|
|
|
|
## 6. Verify
|
|
(Assertions captured in `2026-06-24-duplicate-batch-fixed.json`)
|