# Store & Spawn Flow

# Store & Spawn Flow

## Storing

The server validates ownership/access, garage compatibility, capacity and current authoritative vehicle state before committing the store operation.

When storing succeeds:

- Vehicle properties/health/fuel are persisted.
- Temporary world tracking is cleared.
- State is changed to `stored`.
- Framework state is synchronized where supported.
- Key lifecycle is reconciled.
- History/live-sync events are emitted.

A failed store validation does **not** intentionally detach a still-active vehicle from runtime tracking.

## Spawning

Spawning uses a short server lock to prevent concurrent duplicate requests. The state can temporarily enter `spawning`, then transitions after the client/server confirm flow.

On resource/server restart, stale `spawning` rows are repaired back to `stored` by migration/startup safety logic.

## Duplicate guard

Vehicle OS duplicate protection checks authoritative identity/state before restoration or spawn operations. Do not bypass the spawn APIs by creating a second owned entity manually with the same plate.
