From a keystroke to an audit entry
This is the actual sequence, described from the code that runs it. Each step can refuse; none of them fakes the next.
The sequence
Ordered as the request travels. A refusal at any step ends the request with a taxonomy code.
| Step | What happens | What can refuse |
|---|---|---|
| 1 · Capability probe | The browser reports WebGPU, the Prompt API availability, memory, cores and platform. The result is cached per tab. | Nothing — probing is read-only. The router simply sees unavailability. |
| 2 · Routing | The router combines policy, capability, entitlement, context budget and failure history, and returns a target plus a typed reason. | no_route when no backend satisfies the policy. |
| 3 · Reservation | beginInferenceExecution takes a token hold in a Firestore transaction, keyed by the client's execution id. | ENTITLEMENT_DENIED, INFERENCE_QUOTA_EXCEEDED, APP_CHECK_FAILED. |
| 4 · Provider call | The adapter calls the on-device model or Firebase AI Logic. Prompts follow the requested mode. | MODEL_UNAVAILABLE, INFERENCE_TIMEOUT, provider errors mapped to taxonomy codes. |
| 5 · Completion | completeInferenceExecution writes the execution record and usage counters in one transaction. | SYNC_CONFLICT if the execution was already finished. |
| 6 · Audit | The outcome is appended to the audit chain with actor, correlation id and outcome. | Nothing on the request path — audit failures are reported, not swallowed. |
What happens without a backend
The workspace is usable before it is configured, and says exactly that.
With no Firebase web configuration, /app renders a local demo banner naming the missing keys. Records live in IndexedDB only. Sign-in is disabled rather than simulated, and cloud inference reports MODEL_UNAVAILABLE instead of returning text from nowhere.
Adding the configuration changes the behaviour, not the interface: the same routes gain cloud inference, authentication and sync.
Where data lives at each step
Chosen so a network loss degrades the product instead of breaking it.
| Data | Location | Notes |
|---|---|---|
| Conversations and collections | IndexedDB on the device | Readable without a network round trip. |
| Workspace records | Firestore | Tenant-scoped by orgId; rules re-derive membership. |
| Documents and media | Cloud Storage | Seven allowed prefixes with per-type size limits. |
| Inference record | Firestore | Status, source, latency, tokens, error code. |
| Integration credentials | Secret Manager | Firestore stores a resource reference only. |
Run it end to end
Open the workspace, send a prompt, and read the execution record it produces.