feat(scheduler-core): add scheduler admin opcode schema (task 7.4)

Adds SchedAdminAction (recordStart/recordStop/recordStatus),
SchedAdminRequest (action/recordFile), SchedAdminReply (ok/error/
recording/file/eventCount/startedAt) to controller.capnp, matching
requirements.md Req 5 AC 10 verbatim. Adds schedAdmin@42 to OPCode,
schedadminmsg@31 to Request.body, schedadminreplymsg@19 to
RequestReply.data -- the exact next-available ordinals, verified live
before implementation and re-verified byte-identical against every
existing value/member.

Deliberately schema-only, per this task's own scope -- the controller
dispatch logic (cluster.c's case OPCode_schedAdmin:) is task 10.1's
job. cluster.c, src/frontend/, src/xceadmin/, src/scheduler/ all
untouched.

Round-trip tests cover all 3 SchedAdminAction values and both
ok=true/ok=false SchedAdminReply cases, including an asymmetric
ok=false/recording=true combination that rules out a Bool-field
bit-packing mixup at the wire level.

Closes out Group 7 (Foundation: Replay Wire Format) entirely.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dw5WnN3DXStaEaPYfACU1
This commit is contained in:
Rongsong Shen 2026-08-04 14:00:16 +00:00
parent bbb3972ae6
commit 5cd8687b32
Signed by: rshen
SSH key fingerprint: SHA256:8Vf2pZ3h6rJa7EhGK+WaAQ9Mta/apZvteW6g9U/WKKk
4 changed files with 217 additions and 1 deletions

View file

@ -50,6 +50,7 @@ enum OPCode {
preVoteReply @39;
ctrlstatus @40;
fetchfile @41;
schedAdmin @42;
}
struct PeerInfo $C.mapname("xce_peerinfo_t") {
@ -591,6 +592,7 @@ struct RequestReply $C.mapname("xce_reply_t"){
walackreplymsg @16: WalAckReply $C.mapname("walackreplymsg"); # WAL apply ACK from standby
ctrlstatus @17: CtrlStatus; # ctrlstatus reply: identity/health snapshot
fetchfilereply @18: FetchFileReply;
schedadminreplymsg @19: SchedAdminReply;
}
redirectHost @11: Text $C.mapname("redirect_host");
@ -642,6 +644,38 @@ struct FetchFileReply $C.mapname("xce_fetchfile_reply_t") {
jobid @4: UInt64 $C.mapname("jobid");
}
# ── Scheduler admin opcode (scheduler-core task 7.4, Req 5 AC 10) ────
# OPCode_schedAdmin request/reply pair: start/stop/query a scheduler-side
# `.replay` recording session. The actual controller-side dispatch
# (cluster.c's myreq_handler forwarding this opcode to the scheduler) is a
# LATER task, out of this schema-only task's scope -- this struct trio is
# purely the wire contract.
enum SchedAdminAction {
recordStart @0;
recordStop @1;
recordStatus @2;
}
struct SchedAdminRequest $C.mapname("sched_admin_req_t") {
action @0: SchedAdminAction;
recordFile @1: Text; # filename (not a path) for recordStart; empty = auto-generate.
# See AC 10 "Record file path validation" — the scheduler
# resolves this beneath a configured recording directory;
# it is never used as a caller-controlled absolute path.
}
struct SchedAdminReply $C.mapname("sched_admin_reply_t") {
ok @0: Bool;
error @1: Text; # human-readable error if !ok
# Fields populated for recordStatus (also returned by recordStart/recordStop
# for confirmation — caller can verify state after each action):
recording @2: Bool; # true between start and stop
file @3: Text; # record file path (auto-generated name returned by start)
eventCount @4: UInt64; # events written since recording started
startedAt @5: UInt64; # logical time recording started (nanoseconds since epoch)
}
struct Request $C.mapname("xce_request_t"){
opcode @0: OPCode;
seq @1: UInt64;
@ -675,6 +709,7 @@ struct Request $C.mapname("xce_request_t"){
walcatchupentrymsg @28: WalCatchupEntry;
snapshottransfermsg @29: SnapshotTransfer;
fetchfilemsg @30: FetchFileMsg;
schedadminmsg @31: SchedAdminRequest;
}
}