Skip to content

Shared helper: PASSTHROUGH_OPERATIONS for the daemon socket's one-call request arms #1441

Done

Description

@V3RON

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> in src/daemon/server-requests.ts holds 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.
  • handle gets one guard before the default throw. The guard widens the set only for the lookup, since frame.type is a string (src/daemon-protocol/index.ts:16): (PASSTHROUGH_OPERATIONS as ReadonlySet<string>).has(frame.type). A member dispatches this.options.dispatcher.dispatch(frame.type as OperationName, frame.payload, this.#session(connection)).
  • The 37 arms go. These 9 arms and the default stay as they are: lease.request, lease.release, lease.release-all, lease.release-run, device.exec, component.install, worker.install-component, relay.request and daemon.update.
  • The why: comments of the moved arms move onto the set: the one inside driver.passthrough (server-requests.ts:241-243) and the worker.* 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 on handle (:53) too, or the suppression goes if Fallow no longer flags handle (.fallowrc.json fails 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) name ConnectionRequests.handle instead.

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.ts prints 9 (46 at 200afe5, minus 37).
  • PASSTHROUGH_OPERATIONS has one definition, in src/daemon/server-requests.ts, holding the 37 names above.
  • grep -rn 'handleRequest' src/daemon/ prints nothing.
  • No comment in src/daemon/server-requests.ts says the switch is the socket's whole surface.
  • pnpm check passes.

Written by an agent.

Activity

  1. added
    task:draft
    on Nov 7, 2026
  2. V3RON commented on Nov 24, 2026

    @V3RON
    ContributorAuthor

    Maintainer decision (2026-11-24)

    Deliver it: replace the one-call case arms with one PASSTHROUGH_OPERATIONS set, no behaviour change. Next: spec check, then task:ready.

    Written by an agent.

  3. added
    refactor:ready
    and removed
    task:draft
    on Nov 25, 2026
  4. self-assigned this
    on Nov 25, 2026
  5. V3RON commented on Nov 25, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1851 (#1441)
    Parked: none
    Waiting: none
    Decided: none

    Written by an agent.

  6. added a commit that references this issue on Nov 25, 2026
    16b85fc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

refactor:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions