refactor: split daemon server runtime into daemon/server/ — Phase 5#985
Merged
Conversation
Phase-5 §5.5 folder move (server side; the daemon/client/ split shipped in #962). Extracts the process-bootstrap / server-runtime cluster into src/daemon/server/ as a pure, behaviorless path codemod — no logic changes. Moved (server bootstrap/runtime — the layer that spins up the daemon and owns the platform graph; each imported only by the bootstrap layer + each other): src/daemon-runtime.ts -> src/daemon/server/daemon-runtime.ts src/daemon/http-server.ts -> src/daemon/server/http-server.ts src/daemon/transport.ts -> src/daemon/server/transport.ts src/daemon/server-lifecycle.ts -> src/daemon/server/server-lifecycle.ts src/daemon/server-shutdown.ts -> src/daemon/server/server-shutdown.ts Left in src/daemon/ root (request core / shared wire helpers, out of scope): request-router.ts, handlers/, session-store.ts, lease-registry.ts, context.ts (the daemon's request layer) and http-contract.ts / http-health.ts / http-errors.ts / config.ts (HTTP wire contract + daemon config shared across client, remote, and cli — not server-only). Left: src/daemon.ts (the thin process entry) stays at src/ with the other package entrypoints; it is coupled to its physical path by four non-import string references (rslib entry, config dev-mode sentinel, process-identity detection regex, daemon-client launch srcPath), so moving it is beyond a pure import codemod. Rewrote every from/import/import()/type-only specifier per importer (resolve-based path.relative recompute) across src and test, and renamed the fallow health-baseline key for http-server.ts. daemon-runtime's static platforms/ import is now inside the daemon-server seam the layering lint (#984 R3) allows. Verification: tsc --noEmit 0; layering check (branch script) unchanged (3 pre-existing R3 violations, 0 new); oxfmt clean; oxlint --deny-warnings 0; fallow audit --base origin/main clean (14 files); rslib build 0 (internal/daemon entry still emits); vitest 17 passed (daemon-entrypoint, http-server-rpc-validation, server-shutdown + 3 provider-integration).
Size Report
Startup median (7 runs, lower is better):
Top changed chunks: no changes in the largest emitted chunks. |
Member
Author
|
Reviewed #985 against |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Phase-5 §5.5 folder move (server side). The counterpart
daemon/client/split shipped in #962; this extracts the server-runtime / process-bootstrap cluster intosrc/daemon/server/. Pure, behaviorless path codemod — no logic changes.Moved into
src/daemon/server/(5 files — the server layer)These are the files that spin up the daemon process / set up the HTTP+socket servers / wire the runtime, and (directly or transitively) own the platform graph. Each is imported only by the bootstrap layer + each other:
src/daemon-runtime.tssrc/daemon/server/daemon-runtime.tsstartDaemonRuntime) — plan-nameddaemon-runtime.ts; opens/closes servers, wires the request handler, statically importsplatforms/for the runner leasesrc/daemon/http-server.tssrc/daemon/server/http-server.tscreateDaemonHttpServer); only importer was daemon-runtimesrc/daemon/transport.tssrc/daemon/server/transport.tscreateSocketServer,listenNetServer,listenHttpServer)src/daemon/server-lifecycle.tssrc/daemon/server/server-lifecycle.tssrc/daemon/server-shutdown.tssrc/daemon/server/server-shutdown.tscloseDaemonServers(pure rename — its only import stays a sibling)Left in
src/daemon/root (deliberately out of scope)request-router.ts,handlers/,session-store.ts,lease-registry.ts,context.ts, therequest-*/selector-*/session-*/screenshot-*modules.http-contract.ts(5 importers incl. cli/proxy, daemon/client, remote/*),http-health.ts(client + remote + server),http-errors.ts(shared by http-server + upload-http),config.ts(13 importers across cli/client/daemon/remote).src/daemon.ts— the thin process entry (void startDaemonRuntime()). It stays atsrc/alongside the other package entrypoints (index, io, batch, bin, …) and is coupled to its physical path by four non-import string references: the rslibinternal/daemonentry, the config dev-mode sentinel (config.tscheckssrc/daemon.tsexists), theprocess-identity.tsdaemon-detection regex, and the daemon-client launchsrcPath. Moving it is beyond a pure import codemod, so it was left and reported rather than guessed.Codemod
Every
from/import/import()/ type-only specifier was rewritten per importer via a resolve-basedpath.relativerecompute (acrosssrcandtest). The fallow health-baseline key forhttp-server.tswas renamed. No.fallowrc.json/ rslib / tsconfig / package.jsonexportschanges were needed (globs;daemon.tsentry unchanged).daemon-runtime.ts's staticplatforms/import now lives inside thedaemon/serverseam that the layering lint (#984, R3) permits — previously it was an un-scanned top-levelsrc/file.Verification
tsc -p tsconfig.json --noEmit→ 0oxfmt --writeclean;oxlint --deny-warnings→ 0fallow audit --base origin/main→ clean (14 changed files)rslib build→ 0;dist/src/internal/daemon.jsentry still emitsvitest→ 17 passed:daemon-entrypoint,http-server-rpc-validation,server-shutdown(unit) +daemon-http-server,daemon-lifecycle,daemon-transport(provider-integration)