Repository navigation
Conversation
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 16 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
… question handleSessionStateCommands (CC 34) and handleAppStateCommand (CC 30) kept CRAP at or above 30 from complexity alone. The command group now routes through a small dispatcher: boot, shutdown, and appstate each answer their own domain question in a dedicated module, and appstate separates target admission, the Apple session response, and the device-runtime query. No behavior change; tests move one-to-one with their subjects.
…ed health baseline entry The five new handler modules join the daemon-sessions layer in the R81 manifest, and the fallow health baseline drops the session-state.ts complexity_critical entry its two split functions no longer trigger.
0040c53 to
ab79e9b
Compare
|
The split of the session-state handlers by domain question looks correct at ab79e9b, and all 19 checks pass. I did not run the test suite, check:coverage-crap or fallow myself, so the CRAP<30 claim rests on your report and CI. No conflicts. Not blocking, and you can take or leave these: (1) the full diff is +1214/-1023 (2237 gross), mostly test moves, while docs/agents/pull-requests.md and #3424 set a 1,000-line gross budget and the rename-only exemption does not apply, so either move the tests first in a refactor(move) PR (session-boot-shutdown.test.ts to session-boot.test.ts and session-shutdown.test.ts) or state the overage against the gross number in the PR body; (2) the routing test at https://github.com/callstack/agent-device/blob/ab79e9b/src/daemon/handlers/__tests__/session-state.test.ts#L26 only asserts INVALID_ARGS, which all three commands return, so swapping boot and shutdown routing would still pass, and asserting the command name in the message would fix that; (3) the Android serial allowlist sort is now spelled in session-boot.ts:119 and session-appstate-device-runtime.ts:15, and also in session-doctor.ts:276 and session-lifecycle/internal/inventory.ts:373, so one shared helper beside resolveAndroidSerialAllowlist in @agent-device/kernel/device-isolation could serve all four sites. Could session.ts's existing command table point boot, shutdown and appstate straight at handleBootCommand, handleShutdownCommand and handleAppStateCommand, so session-state.ts (https://github.com/callstack/agent-device/blob/ab79e9b/src/daemon/handlers/session-state.ts#L12) and its routing test can go, since the table is compile-checked and the new switch has a The cubic-dev-ai test-assertion thread at #3450 (comment) is fixed at this head, so you can resolve it. Before merge, please answer the gross-diff budget (2237 vs 1,000) and whether session.ts should own the dispatch. Also, #3424 is labeled on-hold pending coordination with the src/daemon to packages/daemon extraction, and I did not check whether that move collides with these new files, so please confirm that coordination before landing new handler files. |
Summary
Splits the two
src/daemon/handlers/session-state.tsfunctions 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 --alland fallow health at max-crap 1 show no production finding ≥ 30 in the new modules; highest ishandleShutdownCommandat CC 15). New modules are registered in the R81 daemon-layer manifest; the path-keyedsession-state.tshealth-baseline entry moves in the finalchore(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
ab79e9b8fpnpm 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.