perf(daemon-client): send opted-in standalone remote commands as one checked RPC

Merged
TH
1d ago
+1807-100

Summary

Stacked on #5144. Replaces closed #5134. A connection whose remote-config profile sets daemonRpc: "checked" sends a standalone command's dispatch as one POST /rpc/checked. Without it, the client path is unchanged.

  • connect probes the endpoint, requires a proxy's upstream to be the daemon itself, and records only a fingerprint of the exact checked target.
  • daemon-client sends checked only when that fingerprint names the request's own target, the request uploads nothing, it is not a lease allocate/heartbeat, and the process holds no instance-pinned /health answer. After a lease call, the command reuses that answer on fenced /rpc with no extra round trip.
  • A non-JSON-RPC 404 fails typed (remote_checked_rpc_unsupported, dispatched: unknown), never resent.

Security

  • Only resend trigger: client-internal proof the socket never connected; recovery then probes /health live.
  • No checked error or timeout diagnostic names the endpoint; unknown refusal values become unknown.
  • Pre-send refusals and recovery skew set dispatched: no.
  • retryAfterRemoteInstanceMismatch stays in the resend module: moving it back puts the transport over the 1000-line cap.

Before / after

session list after connect, n=10, http daemon behind a 50 ms each-way delay proxy:

variant                  requests/call  routes           mean   median
base 7d392e6214          2              /health + /rpc   373ms  374ms
head, no daemonRpc       2              /health + /rpc   376ms  371ms
head, daemonRpc checked  1              /rpc/checked     268ms  266ms

Validation

Head 5217b08462. New tests fail without their fixes (checked by mutation). daemon-client, connection, remote, wire-compat, eager-closure, layering and fallow audit pass locally. CI pending.

šŸ¤– Generated with Claude Code