# V9-004 offline event identity

Date: 2026-07-27

## Repository result

The Metis Expo client now assigns every newly recorded offline progress event a
cryptographically secure UUID from Expo Crypto. The identifier is created before
the event is appended or persisted, remains stable through restarts and delivery
retries, and is suitable for direct reuse as the xAPI statement UUID at the
authenticated ingestion boundary.

The runtime rejects malformed UUID output and any collision with a queued
identifier without mutating the queue or claiming that progress was saved. UUID
comparisons are case-insensitive, matching UUID semantics rather than treating
textual casing as a new identity.

## Legacy migration

Existing version-1 snapshots may contain the former process-local `progress_*`
identifiers. On startup, the runtime replaces every pending legacy identifier
with a secure UUID and durably checkpoints the complete migrated snapshot before
it subscribes to network changes or attempts delivery.

If identity generation or that checkpoint fails, startup remains degraded,
reports the retained pending count, and does not dispatch an event. The original
snapshot stays intact, preventing an acknowledged server event from being
replayed later under a different identity.

## Verification

- `pnpm --dir apps/metis/mobile test --runInBand`: 3 suites, 24 tests passed.
- `pnpm --dir apps/metis/mobile lint`: passed.
- `pnpm --dir apps/metis/mobile typecheck`: passed.
- `pnpm --dir apps/metis/mobile build`: Expo web export passed with the Expo
  Crypto dependency included; generated native prebuild directories were removed
  after verification because this application does not track them.

Focused coverage includes secure UUID creation, restart retention, serialized
concurrent recording, case-insensitive duplicate rejection, legacy migration,
migration checkpoint failure without dispatch, invalid/repeated entropy, and
stable-identity delivery retries.

## Honest boundary

This closes collision-resistant client identity creation and safe migration, not
end-to-end mobile synchronization. The app still has no Metis session/token
provider, so its transport remains deliberately unconfigured. No authenticated
device delivery, production database conflict, mastery merge, or deployed
learner event is claimed. Those remain part of the open composite V9-004 launch
task.
