ipc: one helper for the list reads on the wire (V-575)

Fourteen table entries carried the same four lines: call the CoreAPI method,
return early on error, swap a nil slice for an empty one so the wire says []
and not null. withParamsSlice holds that once and each entry is now the call
it makes.

Three id-only request types were the same struct under three names, so the
routine transitions use the idReq that was already declared and unused. The
revert reply was a map literal on one side and an anonymous struct on the
other; revertResp names it. Both are wire-identical.
This commit is contained in:
2026-08-06 01:30:41 +04:00
parent 70b32af8a7
commit 43dc487113
3 changed files with 55 additions and 131 deletions
+6 -9
View File
@@ -594,7 +594,7 @@ type setTaskFieldsReq struct {
BlockedOn string `json:"blocked_on,omitempty"`
}
// idReq — methods keyed by a single id.
// idReq — methods keyed by a single id, which is every routine transition.
type idReq struct {
ID int64 `json:"id"`
}
@@ -652,6 +652,11 @@ type calendarEventsReq struct {
type revertReq struct {
Key string `json:"key"`
}
// revertResp — the id of the voiding fact the revert wrote.
type revertResp struct {
NewID int64 `json:"new_id"`
}
type writeNoteReq struct {
Ts time.Time `json:"ts"`
Text string `json:"text"`
@@ -780,14 +785,6 @@ type listProposedRoutinesResp struct {
Routines []ProposedRoutine `json:"routines"`
}
type dismissProposedRoutineReq struct {
ID int64 `json:"id"`
}
type acceptProposedRoutineReq struct {
ID int64 `json:"id"`
}
// IntakeEvent — one entry of the unified intake journal on the wire. Mirrors
// event.Event field for field; the ipc package does not import internal/event
// so the wire shape stays independent of the in-process type.