Repository navigation
refactor(daemon): thread the platform-services port through request execution - #3403
Conversation
Size Report
Startup median (7 runs, lower is better):
|
|
The code in 60f5e9d looks right to me. Required live evidence (iOS open, snapshot -i and selector click; Android open and readiness) is in the PR body as your report. I did not inspect those artifacts, and I did not run typecheck, check:layering or the test suites. All 18 checks pass at this commit, and I know of no conflicts. The claim-reconciliation boot observation and the recording-health refresh were not run live. They are 1:1 member swaps, so I read the diff for them. I did not measure startup cost of the new dynamic import in startDaemonRuntime, and the Size Report shows no material change. Not blocking, and you can take or leave these: four tests (request-recording-health.test.ts:12, request-router-recording-health.test.ts:7, session-device-resolution.test.ts:17, ios-app-session-hint.test.ts:7) still vi.mock platform-runtime-apple-resources.ts, while ADR 0019 section 11 says tests pass the shared fixture instead, so either pass daemonPlatformServicesFixture({ appleSessionObservation: stub }) or soften that ADR sentence. The ADR line "every member is an already-published contract type" is also wrong for the three open-target signatures declared inline in platform-services.ts. The new JSDoc for platformServices in request-execution-scope.ts sits above dispatchLedger's doc instead of the platformServices field, and platform-runtime-daemon-services.ts:12 cites "ADR 0019 section 1" where it means section 11. Most of the +493 is one more parallel field beside inspectFacts, bindDevice and bindExactDevice in about 40 handler param types. RuntimeAdmissionBindings already names that tuple, so could handlers take one The PR is still a draft. Mark it ready for review, optionally after the two notes above. |
60f5e9d to
029223a
Compare
|
Rebased onto latest main (#3393/#3373/#3385/#3390/#3351/#3400, clean) and addressed all nits at 029223a:
Validation at 029223a: |
|
Addressed the notes:
On Rebased onto main; full gate rerun at the new head: build, check:quick, check:layering, check:di-seams, check:affected --run, eager-closure + size-ratchet, provider 213, torture 4/4, plus the four re-pointed test files. Marking ready for review. |
029223a to
e53be1d
Compare
|
This PR is ready at e53be1d. The earlier ADR wording is now fixed, and the author's answer on the Not blocking: the JSDoc at https://github.com/callstack/agent-device/blob/e53be1d/src/daemon/platform-services.ts#L15 still says every member is an already-published neutral contract, but the three open-target members and Could handlers take one The Android Smoke Tests job failed because Please rerun the Android Smoke Tests job. The other checks were still queued or in progress when I looked, so they need to finish before merge. |
…xecution Compose the daemon’s host-facing asks (local readiness, boot and runner-session observation, open-target classification) as one required DaemonPlatformServices dependency at the process root and thread it root -> RequestRouterDeps -> request scope -> handlers/consumers. Replaces the daemon value imports of platform-runtime-apple-resources/-open-target/-device-ready/-device-boot. No fail-closed placeholder: an un-composed process cannot build the router.
R76 inventory records the one daemon -> platform-runtime value edge this port keeps (the root composition factory in daemon-runtime), re-points the planted-violation fixtures at it, and the root-module zone list gains the new composition module.
e53be1d to
5e85b14
Compare
|
Took the JSDoc nit: |
|
#3391's manifest was cut before #3403 and #3404 landed, so src/daemon/platform-services.ts (imported by daemon-core files, so core) and src/daemon/device/claim-recovery-gateway.ts (imported only from daemon-server, beside its device-claim siblings in resources) were the only files R81 found unowned. This PR re-ran check:layering after rebasing over them and assigns both. Co-authored-by: Copilot <2235562194+Copilot[bot]@users.noreply.github.com>
…fest (#3412) #3391 added the daemon layer manifest while #3403 and #3404 were in flight, and each merged green on its own: src/daemon/platform-services.ts and src/daemon/device/claim-recovery-gateway.ts reached main in no layer, so R81 fails on main and every PR's Repo Guards. platform-services.ts fits only daemon-core; the claim-recovery port fits any layer and goes in daemon-resources beside the device claims, matching the assignment #3395 already carries. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…n-contracts (#3395) * refactor(move): extract the daemon-contracts zone into packages/daemon-contracts The ten files of the daemon-contracts zone (the nine root modules declared by ROOT_MODULE_ZONES plus src/daemon-contracts/daemon-diagnostics-scope.ts) move behind a workspace-package boundary with narrow per-file subpath exports. The shared daemon/client placement from #2559 and the #3288 zone declaration become physical: R11 and the package manifest hold the boundary where the per-file rows held it before. Consumers switch from relative specifiers to @agent-device/daemon-contracts/<file>; the tests move with their sources. Behavior is unchanged. * chore(gates): retarget daemon-contracts path-keyed enforcement at the package ROOT_MODULE_ZONES sheds its daemon-contracts rows (the package derives the zone), the R78 guidance names the package as the shared-contract home, the wire-compat manifest/ledger/mutation keys move with request-progress-protocol, the mutation-lane exclusion pins the moved test path, and ADR 0033 records the extraction with its rationale. * test(daemon-contracts): own the daemon-registration fixture and export it as a subpath publishDaemonRegistration was duplicated verbatim between packages/daemon-contracts/src/daemon-registration.fixtures.ts and src/__tests__/test-utils/device-claim-store.ts. Keep the package as the single owner: export the fixture via ./daemon-registration-fixtures the way capture-kit exports ./recording-artifact-fixtures, delete the root copy, and point the six root tests at the subpath. Co-authored-by: Copilot <2235562194+Copilot[bot]@users.noreply.github.com> * docs(layering): name packages/daemon-contracts/ in the root-zone migration note The example repeated src/command-runtime/ after the daemon-contracts zone moved out of src/daemon-contracts/; name the package instead. Co-authored-by: Copilot <2235562194+Copilot[bot]@users.noreply.github.com> * fix(layering): place the two port files R81 found unlayered #3391's manifest was cut before #3403 and #3404 landed, so src/daemon/platform-services.ts (imported by daemon-core files, so core) and src/daemon/device/claim-recovery-gateway.ts (imported only from daemon-server, beside its device-claim siblings in resources) were the only files R81 found unowned. This PR re-ran check:layering after rebasing over them and assigns both. Co-authored-by: Copilot <2235562194+Copilot[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot <2235562194+Copilot[bot]@users.noreply.github.com>
Summary
Threads the daemon's host-facing asks that bind no device runtime — local readiness, boot-time and runner-session observation, open-target classification — across the daemon boundary as one required
DaemonPlatformServicesdependency (src/daemon/platform-services.ts), composed by the root insrc/platform-runtime-daemon-services.tsand passed root →RequestRouterDeps→ request scope → handlers/consumers. Replaces the daemon's value imports ofplatform-runtime-apple-resources,-open-target,-device-ready, and-device-boot. No fail-closed placeholder exists: an un-composed process cannot build the router (AGENTS.md forbids the fallback). Every member is an already-published neutral contract type; device execution never enters the port (ADR 0019 §11). Tests use the shared fixture (__tests__/platform-services-fixture.ts).192 files, mostly mechanical one-field threading; gross diff ~1.6k lines exceeds the 1k budget — flagged here per the plan; the split point (claim-recovery composition) is stack PR #2.
Validation
Commits
6b73f3fb5+60f5e9d78. Local at tip:pnpm build,check:quick,check:layering(R76 records the single remaining edge),check:di-seams,check:affected --runall pass; eager-closure and test-size-ratchet gates pass;test:integration:provider213/213;test:concurrency-torture4/4.pnpm depgraph: the only daemon → platform-runtime value edges left aredaemon-runtime.ts(composition) and the pre-existing classifieddirect-ios-selector.tsedge (unchanged; no raw-selector escape ported).Live device evidence (this stack, iPhone 18 Pro sim + ReactNative_API_35 emulator): iOS open(Safari URL) +
snapshot -i+ selector click (text=refresh) OK; Android open + readiness path OK withandroidSnapshot.backend=android-helper,helperVersion=0.21.25-devmatching package.json.