Repository navigation
refactor(daemon): add the single package entry and resolve its metadata consumers - #3633
Conversation
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
2 issues found across 56 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/command-registry/src/owner-files.ts">
<violation number="1" location="packages/command-registry/src/owner-files.ts:53">
P3: The `generic` route is not lazy: the handler chain statically imports its module. Narrow this statement to specialized routes so the metadata comment does not misdescribe the generic route.</violation>
</file>
<file name="docs/adr/0033-collocation-decision-table.md">
<violation number="1" location="docs/adr/0033-collocation-decision-table.md:198">
P3: `session-lifecycle/index.ts` and `session-observability/index.ts` remain internal re-export barrels; qualify this as the only public package barrel rather than the only allowed barrel.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
|
|
||
| /** | ||
| * Development-only owner-file navigation claims for each daemon route. The route's runtime | ||
| * binding is its lazy loader in the daemon's handler table; this map is tooling metadata only |
There was a problem hiding this comment.
P3: The generic route is not lazy: the handler chain statically imports its module. Narrow this statement to specialized routes so the metadata comment does not misdescribe the generic route.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At packages/command-registry/src/owner-files.ts, line 53:
<comment>The `generic` route is not lazy: the handler chain statically imports its module. Narrow this statement to specialized routes so the metadata comment does not misdescribe the generic route.</comment>
<file context>
@@ -46,3 +47,28 @@ export const COMMAND_OWNER_FILES = buildOwnerFiles(RAW_COMMAND_DESCRIPTORS) sati
+
+/**
+ * Development-only owner-file navigation claims for each daemon route. The route's runtime
+ * binding is its lazy loader in the daemon's handler table; this map is tooling metadata only
+ * `explain:command` reads, so it lives with the command claims above and the bundler drops it.
+ *
</file context>
| * binding is its lazy loader in the daemon's handler table; this map is tooling metadata only | |
| * Specialized routes bind through lazy loaders in the daemon's handler table; this map is tooling metadata only |
| `@agent-device/daemon` has one entry, `.`, which is `packages/daemon/src/index.ts`: explicit named | ||
| re-exports of what the daemon process root uses (`startDaemonRuntime` and the types its | ||
| composition and platform-runtime modules name), no `export *`. It is the package boundary, the | ||
| one place a barrel is allowed; the layer folders hold no barrel. A value import of the package |
There was a problem hiding this comment.
P3: session-lifecycle/index.ts and session-observability/index.ts remain internal re-export barrels; qualify this as the only public package barrel rather than the only allowed barrel.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At docs/adr/0033-collocation-decision-table.md, line 198:
<comment>`session-lifecycle/index.ts` and `session-observability/index.ts` remain internal re-export barrels; qualify this as the only public package barrel rather than the only allowed barrel.</comment>
<file context>
@@ -192,20 +192,25 @@ files have no seam (published facade, public-type collision, root dependency fac
+`@agent-device/daemon` has one entry, `.`, which is `packages/daemon/src/index.ts`: explicit named
+re-exports of what the daemon process root uses (`startDaemonRuntime` and the types its
+composition and platform-runtime modules name), no `export *`. It is the package boundary, the
+one place a barrel is allowed; the layer folders hold no barrel. A value import of the package
+evaluates the daemon server graph, so root code that needs only command metadata reads it from
+its owner: the route owner-file claims sit beside the per-command claims in
</file context>
| one place a barrel is allowed; the layer folders hold no barrel. A value import of the package | |
| only public package barrel; legacy internal barrels remain in subfolders, not at the layer roots. A value import of the package |
|
This looks good at 7fd5aa3. Every removed subpath's consumer is resolved, and the route owner-file map now sits beside the DaemonCommandRoute type it is keyed by, with no dependency back on the daemon. I know of no conflicts. I did not run the layering, fallow, eager-closure or affected gates, so I took those results from the PR body. Smoke Tests is still running and has not failed. It matters here because src/daemon.ts:2 now loads startDaemonRuntime through the new "." export, so it exercises daemon start through the new entry. Not blocking, take or leave these: the index re-exports DaemonRuntimeController, DaemonRuntimeDepsInput, DaemonRequest and DaemonInvokeFn, which only tests import, so either move them to the ./testing entries or widen the ADR 0033 sentence; and the parity check at command-descriptor-parity.test.ts:172 no longer asserts the daemon's canRunReplayScopedAction, so you could add that assertion to the moved daemon core suite. The three cubic-dev-ai doc-wording threads still apply and are small: the "lazy loader" wording at owner-files.ts:53 (#3633 (comment)), the session-lifecycle and session-observability barrels against the ADR's no-barrel line (#3633 (comment)), and "one production entry" in the ADR (#3633 (comment)). |
…onsumers at command-registry Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7fd5aa3 to
95686fd
Compare
|
Summary
Layer 2 of the daemon single-entrypoint stack (after #3616 and #3625):
@agent-device/daemongets its public API in one file, and the seven production subpaths collapse into it.packages/daemon/src/index.tsis the package boundary: explicit named re-exports, noexport *. The one value isstartDaemonRuntime. The rest are types the composition and platform-runtime modules name (ComposeDaemonRuntimeDeps,DaemonRuntimeController,DaemonRuntimeDeps,DaemonRuntimeDepsInput,DaemonPlatformServices,PlatformOwnerLifecycle,PlatformResourceCleanup,DaemonRequest,DaemonInvokeFn).exportsdrops./server/daemon-runtime,./platform-owner-lifecycle,./platform-resource-cleanup,./platform-services,./daemon-request,./daemon-command-registryand./route-owner-files, and gains..src/daemon.ts,src/daemon-composition.tsandsrc/platform-runtime-*import@agent-device/daemon.route-owner-fileswas tooling metadata keyed bycommand-registry's ownDaemonCommandRoute. It now sits beside the per-command claims in@agent-device/command-registry/owner-files(existing subpath). The scripts, the CLIcommand-explaintest,command-surface-metadata, andowner-files-no-leakread it there, so none of them depend on the daemon.daemon-command-registrystays daemon-owned: its queries takeDaemonRequest, and ~50 daemon modules use them. Its outside consumers no longer need it.scripts/depgraph/affected-run.tsandcommand-descriptor-parity.test.tsreadderiveDaemonCommandDescriptors(commandDescriptors).command-descriptor-ref-frame-effect.test.tstests the daemon query, so it moved topackages/daemon/src/core/__tests__/unchanged apart from its import.daemon-client-abort*.test.tsfiles declare a local(req: DaemonWireRequest) => Promise<DaemonResponse>instead of importingDaemonInvokeFn.packages/daemon/src/index.tsas the one production file at the daemon root, with a test.packages/daemon/src/index.tsis a new entry evaluating 372 modules, which isstartDaemonRuntime's server graph. It carries anAPPROVED_OVER_CEILINGrow (fix(metro): separate server control from Expo app launch #3352).src/daemon.tsand every existing entry stay under the no-growth rule. The stale maestro row is removed, because refactor(maestro): shape the replay backend as a create(host) plugin #3623 is now in the merge-base and the gate requires it.DaemonPlatformServicesis exported from it. ADR 0032 and AGENTS.md state no changed path.Transitional testing subpaths
Two
./testing/*entries are added, each deleted with its consumers in the relocation layers:./testing/server/daemon-runtime: the fourteardownDaemonSessionForShutdowntests undersrc/__tests__/daemon-composition/server../testing/daemon-command-registry:test/integration/nightly/concurrency-torture/bindings.ts, which deliberately consumes the production lock decision.Subpath exports
daemon.+ 100 testing + 2 transitional)command-registryowner-filesalready existed)daemon-contracts,host-kit,test-kit,kernelValidation
On the pushed head:
pnpm check:quick,pnpm check:layering,pnpm check:fallow,pnpm check:gate-manifest,pnpm check:production-exports,pnpm check:affected --run,pnpm format:check, and afterpnpm build:check:bundle-owner-files,check:package,check:doc-prose. The wire-compat ledger is untouched.Not in this PR: moving the
./testing/*consumers into the package (next layers). The handoff notes name two candidates that may need a decision there: the client abort tests, which run the real client against the real daemon transport, and the nightlyconcurrency-torturebindings.🤖 Generated with Claude Code