Repository navigation
refactor(daemon): own the boot/shutdown device-status response in one place - #3557
Conversation
… place - Point the BootCommandResult and ShutdownCommandResult doc comments in packages/contracts/src/device.ts at their owning handlers (session-boot.ts, session-shutdown.ts) instead of the retired session-appstate.ts. - Replace the duplicated bootedDeviceResponse wire-shape builders in the boot and shutdown handlers with one deviceStatusReportResponse owner. - Map the boot, shutdown, and appstate dispatch-table entries in session.ts straight to their handlers; the pass-through wrappers only copied fields the handlers already accept. Follow-ups from #3455, #3472. No behavior change.
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
…d builder Review follow-up (#3557): the contracts doc comments now cite the shared deviceStatusReportResponse the literals moved into, and the boot-shape test pins Object.keys so a wire key-order change is a test failure.
Size Report
Startup median (7 runs, lower is better):
|
|
This PR is ready at 020bb45. The refactor looks behavior-neutral: the boot and shutdown response now comes from one builder, and the wire shape matches the old one when I compare the code. All 19 checks pass, and there are no conflicts. Nothing else needs to happen before merge. Not blocking: the key-order test returns early on I did not run the tests or your mutation checks, so I judged revert-sensitivity from the diff only. I did not run a live boot or shutdown on a device, and I did not run tsc myself. The wrapper removal relies on the green CI for type compatibility. No open inline threads still apply. Both Cubic threads are fixed at this head, so please resolve them. The first is the comment wording, and the "literal" leftover is trivial: #3557 (comment). The second is the key-order assertion, which is now in place at |
|
Summary
No behavior change. Cleans up three leftovers from the session-state split (#3455–#3458, #3472):
packages/contracts/src/device.ts: theBootCommandResultandShutdownCommandResultdoc comments cited the retiredsession-appstate.ts; each now names its owning handler and the shared builder that owns the literal (session-boot.ts/session-shutdown.tsviasession-device-status-response.ts).bootedDeviceResponsebuilders duplicated insession-boot.tsandsession-shutdown.tsbecome one owner,deviceStatusReportResponseinsession-device-status-response.ts— it answers "what does this device report on the wire after a readiness command": public identity fields plus the command's status field (booted/shutdown) and the gated additiveappleOs. Wire key order is unchanged and pinned by test.session.tsare deleted; the dispatch table maps straight to the handlers, whoseRuntimeCommandHandlerParamsacceptSessionCommandParamsdirectly.New module claimed by
daemon-sessionsin the daemon layer manifest (separatechore(gates)commit). 7 files, +112/−97 gross.Validation
Tested at head 020bb45:
pnpm exec tsc -bclean;pnpm check:affected --runpassed on the head under the gate lock;pnpm exec vitest run scripts/__tests__/eager-closure-budgets.test.tspassed (838 tests);pnpm check:coverage-crap --base origin/mainover a unit-core coverage run reports no touched function at or above 30. Newsession-device-status-response.test.tsis revert-sensitive: removing the platform gate turns the stray-appleOsnegative test red, and swapping the status/appleOs spreads turns the pinnedObject.keyswire order red — both observed, green again after restore. Boot/shutdown/appstate wire-shape tests pass unchanged. Cold-context review ran; its one finding (shared device fixtures) was adopted. Cubic P3s both fixed at 020bb45. Integration/Coverage lanes stay GitHub-owned.