Repository navigation
Description
Why
ConnectionRequests.handle (src/daemon/server-requests.ts) has 46 case arms, and 37 of them are the same one call: return this.options.dispatcher.dispatch("<the case's own name>", frame.payload <maybe ?? {}>, this.#session(connection));. Today a new pass-through operation is written twice, and the arms have already drifted: 24 pass frame.payload ?? {} and 13 a bare frame.payload. That difference is empty, because runDispatch coalesces with rawInput ?? {} itself (src/daemon/dispatch.ts:331). Measured at 200afe5.
Target shape
- A module-private
PASSTHROUGH_OPERATIONS: ReadonlySet<OperationName>insrc/daemon/server-requests.tsholds the 37 names:lease.renew,lease.cancel,lease.get,lease.list,status.get,list.get,catalog.get,cleanup.run,doctor.run,nuke.run,warm.forget,baseline.list,baseline.remove,baseline.save,events.replay,usage.get,inbox.get,events.subscribe,events.unsubscribe,driver.passthrough,device.rotate,relay.cancel,config.get,identity.get,token.create,token.list,token.revoke,worker.list,worker.drain,worker.undrain,worker.remove,worker.update,alerts.test,component.list,component.remove,device.add,device.remove. handlegets one guard before thedefaultthrow. The guard widens the set only for the lookup, sinceframe.typeis astring(src/daemon-protocol/index.ts:16):(PASSTHROUGH_OPERATIONS as ReadonlySet<string>).has(frame.type). A member dispatchesthis.options.dispatcher.dispatch(frame.type as OperationName, frame.payload, this.#session(connection)).- The 37 arms go. These 9 arms and the
defaultstay as they are:lease.request,lease.release,lease.release-all,lease.release-run,device.exec,component.install,worker.install-component,relay.requestanddaemon.update. - The
why:comments of the moved arms move onto the set: the one insidedriver.passthrough(server-requests.ts:241-243) and theworker.*ADR 0005 §23 note (:297-300). Reword them so they are true of the new code: none may say the switch is the socket's whole surface. That applies to the Fallow suppression reason onhandle(:53) too, or the suppression goes if Fallow no longer flagshandle(.fallowrc.jsonfails a stale suppression). - The three comments that still name the old
#handleRequest(server-requests.ts:379,src/daemon/server-options.ts:165,src/daemon/server.ts:530) nameConnectionRequests.handleinstead.
Out of bounds
Every module but src/daemon. In src/daemon, only server-requests.ts changes code; server-options.ts and server.ts change only the comments above. The worker and gateway Dispatcher handler tables, the HTTP routes, and every test file stay as they are. The existing socket tests that drive set members (server-requests.test.ts:18-74, server-roles.test.ts:251-285) and the unknown-name case (server-leases.test.ts:43-53, lease.heartbeat → UNKNOWN_REQUEST) pass unchanged.
Done when
grep -cE 'case "' src/daemon/server-requests.tsprints 9 (46 at 200afe5, minus 37).PASSTHROUGH_OPERATIONShas one definition, insrc/daemon/server-requests.ts, holding the 37 names above.grep -rn 'handleRequest' src/daemon/prints nothing.- No comment in
src/daemon/server-requests.tssays the switch is the socket's whole surface. pnpm checkpasses.
Written by an agent.
Activity
V3RON commentedon Nov 24, 2026
Maintainer decision (2026-11-24)
Deliver it: replace the one-call
casearms with onePASSTHROUGH_OPERATIONSset, no behaviour change. Next: spec check, thentask:ready.Written by an agent.
docs(daemon): the complexity suppression reason no longer claims a ca…
V3RON commentedon Nov 25, 2026
Delivery run
Merged: #1851 (#1441)
Parked: none
Waiting: none
Decided: none
Written by an agent.
refactor(daemon): the socket's pass-through operations sit in one set (…