# Colibri pilot safety adoption

Status: implementation handoff, not proof of adoption or dispatch readiness.

Mother: WAOS V12/V13. Les Saintes SOS first; Vanuatu V21 second. Both pilots remain deferred.

## Separate V12 applications — adoption contract v1.0.0

Review and export the typed contract at `/pilot-handoff`. The contract is also carried by City OS pilot metadata in the mother catalog. Neither export nor evaluation executes an action.

### Les Saintes → `sos.alert.request`

The adopted Colibri client must use the improved continuous two-second shared hold, cancellation safeguards and an awaited, duplicate-safe save. Explicitly migrate the separate legacy three-second control only where adopting this new shared behavior; preserve unrelated rehearsal controls.

Server-verifiable request envelope: `{ pilot: "les-saintes-sos", territory: "LS", action: "sos.alert.request", mode: "real"|"exercise", requestId }`. Generate a cryptographically random request ID on deliberate submission. Derive the actor from authenticated credentials, not the body. Verify territory authorization, explicit audience consent, device-fix freshness, approved recipients, configured transport and completed supervised delivery trials. Persist the request, consent, captured device time and payload digest atomically with an outbox entry; unique actor/request ID replays return the original record. Changed payload on replay must fail.

Worker delivery owns retries and append-only receipt events. Verify provider callback signatures and event IDs, bind each receipt to its exact request and recipient. Distinguish requested → persisted → queued → provider accepted → delivered → human acknowledged → responder assigned; failed delivery is visible and never converted into acknowledgement. Exercise mode uses separately approved test recipients; it must not fall through to real emergency endpoints. No emergency phone numbers or provider endpoints are supplied by this contract.

### Vanuatu → `v21.flip.request`

Separate authenticated V21 child workflow, not an SOS message. Envelope: `{ pilot: "vanuatu-v21", territory: "VU", action: "v21.flip.request", mode: "real"|"exercise", requestId }`. Verify record access, explicit consent, an approved V21 workflow definition and the authorized reviewer. A Flip request opens a private review of the scoped claim/patient record. The precise clinical transition remains to be approved; do not invent care, discharge, medication or WHO/UNDRR approval.

Persist append-only requested → persisted → review pending → responded / overdue → closed states. A deadline produces overdue, never patient consent, debt, payment or automatic clinical approval. SOS remains an independent deliberate action with its own consent and transport authorization. Never place patient payloads, private GPS or invite credentials in campaign/catalog exports.

### Activation gates

Each child separately verifies signed-in identity, territory permission, explicit consent, adopted code, owner activation and durable idempotency. Browser readiness flags and the shared reporting secret cannot authorize private actions. Activation must be persisted and audited in the child, scoped to territory, application and environment; an exercise cannot promote itself to live. Provide a revocable pause for future requests without deleting past evidence.

Before live enablement, verify duplicate retry, changed-payload replay denial, unauthorized/other-territory denial, stale-device-fix denial, recipient isolation, receipt signature denial, actual designated-recipient delivery/readback and failure recovery. For V21 also test unauthorized record access, no-response overdue and independent SOS isolation. Obtain local field-partner and clinical workflow approval. This mother handoff does not send alerts, deploy the child or establish field coverage.

## Concrete child fix

Inspected `src/components/sos-button.tsx` at commit `5582e1b7`:

1. Separate `cancel` from `finish`. Cancel clears the timer, start reference and visual progress without invoking `onTrigger`, even after the threshold.
2. Bind `onPointerCancel`, window blur, document hidden, component unmount and transition to disabled/active to `cancel`.
3. Only matching deliberate pointer/key release may finish the inspected release-triggered legacy control. Prevent repeated keydown and prevent keyboard scrolling; unrelated keyup must not finish a hold.
4. Keep the existing legacy three-second hold until its intended migration is explicitly reconciled; mother shared V13 holds remain two seconds.
5. Keep a synchronous submission lock until mission persistence resolves. Do not claim durable idempotency without a persisted request identifier and duplicate-replay tests.

## Required tests

- Cancel at 3,100ms must invoke `onTrigger` zero times.
- Window blur / hidden document / active state during a hold must invoke it zero times.
- A deliberate complete legacy hold invokes it once; repeated keydown cannot create multiple timers.
- Slow persistence cannot unlock a second submission; save failure stays visibly unsaved.
- Unordered position events select the newest complete coordinate pair; refresh must not make a position appear newly captured.
- Family-only mission stays invisible to unrelated users and territory operators; no parent reporting credential grants private patient or family access.

## Pilot boundaries

No live alerts, campaigning, provider spending or publication until separately authorized. Test designated recipients only after local agreement. QR scans never trigger SOS. Validate emergency numbers locally; the diagrams do not establish applicable numbers in Vanuatu. Record V21 nonresponse as unanswered/overdue, not patient consent. Keep verified delivery, human acknowledgement and rescue assignment separate. Use observed metrics, never illustrative rescue or coverage totals.