refactor(daemon): split session-state handlers by device-state domain question
Summary
Splits the two src/daemon/handlers/session-state.ts functions whose cyclomatic complexity alone kept CRAP ≥ 30 at 92–96% coverage (G2 of #3424, part of #3414):
handleSessionStateCommands: 34 → 4 — now a dispatcher over dedicated boot / shutdown handlers.handleAppStateCommand: 30 → 5 — appstate separates target admission (session-appstate.ts), the Apple session response (session-appstate-apple-session.ts), and the device-runtime query (session-appstate-device-runtime.ts).
All resulting functions score below 30 (check:coverage-crap --all and fallow health at max-crap 1 show no production finding ≥ 30 in the new modules; highest is handleShutdownCommand at CC 15). New modules are registered in the R81 daemon-layer manifest; the path-keyed session-state.ts health-baseline entry moves in the final chore(gates) commit (no bulk regeneration).
Behavior is shown unchanged: existing tests were kept green with moves only (renames + one source-slice test retargeted to session-shutdown.ts, one inventory-mocked boot test adapted to the boot file's harness), no assertion edits. Production gross diff is 975 lines (6 files).
Part of #3424.
Validation
- Tested SHA:
ab79e9b8f pnpm check:affected --run: all runnable checks passed (under the machine lock).pnpm check:coverage-crap --all: "no function(s) at or above 30" (partial map including the six handler modules).pnpm check:layering,pnpm check:fallow,pnpm typecheck: green.