feat(scheduler-core): define decision payload types and snapshot schema (task 7.3)
Adds DispatchDecision (wraps JobAlloc), PendDecision (wraps JobPendReason), PreemptVictim, PreemptDecision to controller.capnp. Replaces task 7.1's empty SnapshotData placeholder wholesale with the real 11-field struct (config/jobs/queues/workers/resources/resvals/ users/projects/prngSeed/internalState/internalVersion), in both the capnp schema and its typemap.h C mirror. Extends ReplayDecision's ts-only placeholder with a purely additive body union (dispatch@1/ pend@2/preempt@3). Deviates from design.md's literal SchedUser/SchedProject mapnames (xce_sched_user_t/xce_sched_project_t): those names are already real C structs in sched/types.h, which shares a translation unit with typemap.h in core_events.c/schedobj.c -- reusing them would be a genuine duplicate-typedef compile error, not a style choice. Used fresh mapnames (sched_snapshot_user_t/sched_snapshot_project_t) instead, field lists unchanged, documented in both files. Found and fixed a real bug mid-implementation: a doc comment's literal */ substring prematurely closed a C block comment, corrupting sched_snapshot_data_t and cascading into ~20 unrelated-looking compile errors (bug-1493). Five deep round-trip tests added to test_e2e_capnp.c. Full project build and controller_unit_test (1082/1082) verified clean, confirmed independently three times. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019dw5WnN3DXStaEaPYfACU1
This commit is contained in:
parent
755230705c
commit
bbb3972ae6
4 changed files with 755 additions and 33 deletions
|
|
@ -173,12 +173,13 @@
|
|||
- _Boundary: ReplayFormat — not (P): 7.2/7.3/7.4 all edit the same schema file (controller.capnp); run sequentially to avoid concurrent edits to one file, even though each adds a logically disjoint set of structs_
|
||||
- _Verified: 2026-08-04 — JobStateChangeEvent/JobUpdateEvent added to controller.capnp matching design.md's spec verbatim; JobUpdateEvent.job correctly reuses the full 12-field Job/xce_job_t record (not the narrower SchedJob sharing the same mapname — verified by field list). ReplayEvent.body's union extended with jobStateChange@10/jobUpdate@11, the only two valid next ordinals per task 7.1's baseline (capnp requires no gaps) — confirmed via a from-scratch capnp regeneration. Existing @0-@9 fields byte-identical. Deep round-trip tests (non-default values throughout, including 3-level nested Job substructs) prove the Observable; JOB_F_* bitmask values deliberately left undefined (later task's job). 1077/1077 controller_unit_test, full project build clean, review APPROVED first pass._
|
||||
|
||||
- [ ] 7.3 Define decision payload types and the snapshot schema
|
||||
- [x] 7.3 Define decision payload types and the snapshot schema
|
||||
- Add the dispatch, pend, and preempt decision payload message types, reusing existing allocation and pend-reason wire messages where they already carry the needed fields
|
||||
- Add the full snapshot message type covering configuration, jobs, queues, workers, resources, resource values, users, and projects, reusing existing wire messages for each domain object list; represent the two scheduler-internal-only caches and session/PRNG state as a versioned opaque payload with no external structure
|
||||
- Observable: encoding one of each decision type and a populated snapshot and decoding them back yields field-for-field equality; a snapshot encoded with one internal-state version and decoded expecting a different version is rejected rather than misinterpreted
|
||||
- _Requirements: 5.5, 5.20, 5.21, 6.5_
|
||||
- _Depends: 7.1_
|
||||
- _Verified: 2026-08-04 — DispatchDecision/PendDecision/PreemptVictim/PreemptDecision added, reusing JobAlloc/JobPendReason per spec. SnapshotData's task-7.1 empty placeholder replaced wholesale with the real 11 fields (config/jobs/queues/workers/resources/resvals/users/projects/prngSeed/internalState/internalVersion), both in the capnp schema and its typemap.h C mirror. ReplayDecision's ts-only placeholder gained a purely additive body union (dispatch@1/pend@2/preempt@3). One deviation from design.md's literal text: SchedUser/SchedProject use fresh mapnames (sched_snapshot_user_t/sched_snapshot_project_t) instead of design.md's literal xce_sched_user_t/xce_sched_project_t, since those names are already real C structs in sched/types.h that share a translation unit with typemap.h in core_events.c/schedobj.c — reusing them would be a genuine duplicate-typedef compile error, not a style choice. Field lists (name-only; name+priority) verified unchanged, deviation rigorously re-derived and confirmed necessary by independent review, documented in both files. Found and fixed a real bug mid-implementation (a doc comment's literal */ substring prematurely closing a C block comment) logged as bug-1493. ReplayEvent's union (tasks 7.1/7.2) and every other existing struct byte-identical. Five deep round-trip tests (all 11 SnapshotData fields populated, version-mismatch demonstrated). 1082/1082 controller_unit_test, full clean project build, confirmed independently three times (implementer, orchestrator, reviewer, all matching exactly), review APPROVED first pass._
|
||||
- _Boundary: ReplayFormat — not (P), same file as 7.2/7.4 (see 7.2)_
|
||||
|
||||
- [ ] 7.4 Add the scheduler admin opcode schema
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue