# Experiment: Gateway Restart With Buffer
Date: 2026-06-24
Phase: 24 — Climate Resilience Verification

## 1. Hypothesis
If I restart the ward gateway API container while unsynced items remain in
`buffered_sync_items`, I expect the buffer count to survive the restart unchanged,
because persistence lives in gateway PostgreSQL, not the container process.

## 2. Baseline
- Encounter: `0f81a139-9f33-47ad-9df9-09c7a6c011c8`
- Central API: stopped (simulated uplink loss)
- Observations posted to gateway: 3 (HR 142, SpO2 91%, Temp 38.2°C)
- Unsynced buffer count: **5** (includes prior buffered items from earlier experiments)

## 3. Break
```bash
# Central already stopped
docker restart $(docker ps -qf name=ward-gateway-api)
# Wait ~35s for gateway health checks
```

## 4. Observe
- Gateway container restarted successfully
- Unsynced buffer count **before restart: 5**
- Unsynced buffer count **after restart: 5** (unchanged)
- No buffered rows lost from gateway PostgreSQL
- Gateway `/health/ready` returned Healthy after ~35s

## 5. Fix / Outcome
- Bug found? **no**
- Fix applied: no fix needed — by design (buffer in ward DB)

## 6. Verify
(Post-sync results in `2026-06-24-gateway-restart-buffer-fixed.json`)
