Overview
A measured hardening pass across one live Profile World, from typed state to lifecycle and visible recovery.
Problem
A polished surface can still hide ambiguous state, unnecessary work, and unclear runtime ownership. The project makes those seams visible without replacing systems that already work.
Goals
- Model one surface with exhaustive loading, ready, empty, unavailable, unauthorized, and error states.
- Measure hydration, render count, App launch latency, and background work.
- Preserve existing code-split and playback ownership while hardening the remaining bridge.
Architecture
Trusted App context + database truth → server Track Runtime projection → `/api/apps/runtime/launch` → `@casset/apps` validation → ProfileAppRuntimeHost → selected App surface over canonical playback.
Design
Failure and loading states should preserve the atmosphere of the Profile World without hiding what happened or what the person can do next.
Implementation
Start with a trace and profiler capture. Change the smallest ownership seam supported by evidence, add regression tests, and verify the real Profile World on mobile.
Lessons
- Profiling should precede refactoring.
- A finite state model can improve both the type system and the visible experience.
Future improvements
Generalize only after the chosen Profile World proves the boundary and the measurement remains useful.