Phase 0 — Screen boot and event listener
Layer: JS only
User lands on the commissioning screen with a scanned QR payload.
- Commissioning hook mounts → registers listener on
MatterCommissioningEvent. - Immediately starts fabric prep and commissioning.
Why listener first
Headless JS can finish while fabric prep is still running; the hook must not miss the terminal success event. Example: if the app was killed during a background cloud confirm from a previous session, returning to the screen could deliver a stale but valid COMMISSIONING_COMPLETE — register the listener before starting new work.
UI phases
loading → optional needs_conversion → converting / preparing → commissioning.
What could go wrong
No active home or user not logged in → hook stops in error phase (noActiveHome, authRequired).