Shared helper: PASSTHROUGH_OPERATIONS for the daemon socket's one-call request arms
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 72/100
- Issue-Typ
- Refactoring
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
Rechercherichtung
Lies src/daemon/server.ts im Bereich von DaemonServer.#handleRequest sowie das angeführte Dispatch-Verhalten in src/daemon/dispatch.ts. Verschiebe die 37 aufgeführten Fälle mit einem Aufruf nach PASSTHROUGH_OPERATIONS und füge den abgesicherten Dispatch vor dem Standardfall hinzu. Behalte die acht Fälle bei, die zusätzliche Arbeit ausführen, sowie ihre dokumentierten Ausnahmen; führe die Socket-Tests und anschließend pnpm check aus und bestätige, dass der Switch 11 Case-Fälle enthält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Scope
One shared list for the daemon socket server's pass-through request names.
Every identical one-call case arm of DaemonServer.#handleRequest moves to
it. No behaviour change.
In short
DaemonServer.#handleRequest (src/daemon/server.ts) has 45 case arms; 37
of them do exactly one thing: return this.#dispatcher.dispatch("<the case's own name>", frame.payload <maybe> ?? {}, this.#session(connection));. They are
37 hand-written copies of "this socket request is a thin client of exactly one
contract operation, with no per-connection bookkeeping". The shared shape is a
module-level PASSTHROUGH_OPERATIONS: ReadonlySet<OperationName> in
server.ts plus one guarded line before the default throw. The 37 arms
occupy 185 lines today; the set and guard are about 45, so about 140 lines go.
Technical spec
Facts
| # | Fact | Source |
|---|---|---|
| F1 | 37 arms are that one call and nothing else (case label and call name equal in all 37; a script over the switch reported 0 name mismatches): 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. They occupy 185 lines. 23 span 6 lines with frame.payload ?? {}, 14 are one-line or 2-line with a bare frame.payload. |
src/daemon/server.ts:956-1160, every arm read at e4599cf2; the script over the switch printed the 37 names, their line spans and the totals |
| F2 | The ?? {} adds nothing over a bare payload: runDispatch coalesces itself — const input = parseDispatchInput(definition.input, rawInput ?? {}); — which is how the 14 bare arms already call it. |
src/daemon/dispatch.ts:331 at e4599cf2 |
| F3 | All 37 names are registered operations in both dispatchers (src/daemon/dispatcher.ts, src/gateway/dispatcher.ts) and in OPERATIONS; runDispatch answers DispatchError("UNKNOWN_REQUEST", ...) for a name with no handler, and the switch's own default answers ProtocolError("UNKNOWN_REQUEST", ...) for any name the set does not hold. |
grep of the 37 names in the three files (e4599cf2); src/daemon/dispatch.ts:325-328; src/daemon/server.ts:1162-1163 |
| F4 | The arms that stay each do real work before or around the dispatch: lease.request, lease.release and lease.release-all (per-connection release bookkeeping), device.exec and component.install and worker.install-component (per-call push wiring), relay.request (link channel), daemon.update (the second frozen call: skips the version gate, and query skips readiness — kept explicit). |
src/daemon/server.ts:910-1160, 829-830; daemon/AGENTS.md Rules → Start and stop (e4599cf2) |
| F5 | Two arms carry a why: comment inside the arm (driver.passthrough, and the worker.* group's ADR 0005 §23 note above worker.list); moving an arm to the set moves its comment onto the set. |
src/daemon/server.ts:1066-1068,1109-1111 at e4599cf2 |
| F6 | Socket tests already drive named set members end to end through createClient(...).request(...) (status.get, lease.renew, events.subscribe, role matrices), so the refactor runs under existing coverage. |
src/daemon/server.test.ts, server-roles.test.ts, dispatcher-status.test.ts (grep of the names, e4599cf2) |
| F7 | #session(connection) and #dispatcher are already the same receiver in every one of the 37 arms; nothing varies except the name. |
F1 spans, read at e4599cf2 |
Modules touched
Only src/daemon, one file: a module-private constant and one guard. No other
module imports server.ts past the daemon index, and the index does not
change. Found by grep -n 'this.#dispatcher.dispatch(' (45 hits in
server.ts; the 37 of F1 are inside #handleRequest).
flowchart LR
socket[socket frame] --> host[#handleRequest switch]
host -->|name in PASSTHROUGH_OPERATIONS| run[dispatch.ts runDispatch]
host -->|8 arms with real work| run
host -->|name in neither| unk[ProtocolError UNKNOWN_REQUEST]
Contract and event changes
None. OperationName already exists in the contract and the set only reads it;
no wire shape moves, so no protocol bump.
Rules in play
- architecture rule 10 — "A rule is enforced in exactly one place": today a
new pass-through operation is written twice (case label plus a duplicated
call), and the 14 bare-payload arms have already drifted from the 23
?? {}ones over a difference F2 shows is empty. - architecture rule 1 — no platform knowledge enters the switch.
daemon/AGENTS.mdDispatch — every frame still goes through the same
dispatchpipeline; parse, role check and the converge park are untouched,
and the frozen-call exceptions stay explicit (F4).
Done when
PASSTHROUGH_OPERATIONSholds the 37 names of F1 insrc/daemon/server.ts,
with the comments of F5 moved onto the set, and one guard before the
defaultthrows none: a member dispatches
this.#dispatcher.dispatch(frame.type as OperationName, frame.payload, this.#session(connection)).- The 37 arms are gone; the 8 arms of F4 and the
defaultstay. grep -cE 'case "' src/daemon/server.tsprints 11 (48 today, minus 37).- A socket test sends one set member (say
status.get) and one unknown name,
pinning the dispatch and theUNKNOWN_REQUESTanswer at the transport. pnpm checkpasses.
Out of scope
The worker and gateway Dispatcher handler tables (same operation names,
different handlers by mode — they are meant to diverge). The HTTP frontend's
routes.
Depends on
Written by an agent.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 705
- Forks
- 40
- Ø Merge
- 12 Std. 9 Min.
- Gemergte PRs (30 T.)
- 376
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus callstackincubator/simlock
-
request:new
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
callstackincubator/simlock#1806 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug:new
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
callstackincubator/simlock#1780 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug:new
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 45/100
callstackincubator/simlock#1805 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug:new
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 45/100
callstackincubator/simlock#1804 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug:new
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
callstackincubator/simlock#1803 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in callstackincubator/simlock
Ähnliche Issues
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
Update project links after the repository renamesEvtl. vergeben @JonathanTSilva hat das heute übernommen. Offenai-generated priority: p2 size: xs type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
JonathanTSilva/jts-website#119 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
promplate/code-review#158 · 1 Kommentar · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
[Docs] CONTRIBUTING points the Backend Remake milestone at a branch that does not existEvtl. vergeben @franpts2 hat das heute übernommen. Offendocs
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
Maintainer antworten meist innerhalb von 3 Tagen