From d1a3e158ae40fce3c7ce2aaf28f783a8cb617e9b Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Fri, 4 Sep 2026 13:26:18 +0000 Subject: [PATCH] docs(scheduler-allocation): fix xce_host_iter_t.next() return type Found during task 1.1 implementation: the Data Structure Changes Summary declared next() returning xce_worker_t* (the wire/config type), but the Composition Algorithm pseudocode in the same document already used xce_sched_worker_t* (the scheduler-internal type with resvals/resInUse/host_eval_ctx) for the identical call -- these are genuinely different types in this codebase, confirmed via make_sched_worker()'s xce_worker_t* -> xce_sched_worker_t* conversion. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01XYdtrEWWZfKRRGED7raEYg --- .kiro/specs/scheduler-allocation/design.md | 8 +++++++- .kiro/specs/scheduler-allocation/requirements.md | 12 +++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.kiro/specs/scheduler-allocation/design.md b/.kiro/specs/scheduler-allocation/design.md index 5a15d744..8c1dc9e4 100644 --- a/.kiro/specs/scheduler-allocation/design.md +++ b/.kiro/specs/scheduler-allocation/design.md @@ -276,9 +276,15 @@ struct xce_alloc_plan_iter_s { ##### Service Interface ```c +/* Correction (found during task 1.1 implementation): next() returns + * xce_sched_worker_t* (sched/types.h -- resvals/resInUse/host_eval_ctx), + * not xce_worker_t* (xce/types.h -- the wire/config type make_sched_worker() + * converts FROM). requirements.md's own Composition Algorithm pseudocode + * already used xce_sched_worker_t*; this struct declaration was out of + * sync with it. */ struct xce_host_iter_s { int (*init)(xce_host_iter_t* iter, xce_alloc_plan_t* plan, var workers); - xce_worker_t* (*next)(xce_host_iter_t* iter); + xce_sched_worker_t* (*next)(xce_host_iter_t* iter); void (*fini)(xce_host_iter_t* iter); void* private; }; diff --git a/.kiro/specs/scheduler-allocation/requirements.md b/.kiro/specs/scheduler-allocation/requirements.md index 3fad431a..1969b799 100644 --- a/.kiro/specs/scheduler-allocation/requirements.md +++ b/.kiro/specs/scheduler-allocation/requirements.md @@ -425,6 +425,16 @@ typedef struct { ```c typedef struct xce_host_iter_s xce_host_iter_t; +// Correction (found during task 1.1 implementation): next() returns +// xce_sched_worker_t* (sched/types.h -- the scheduler-internal type +// carrying resvals/resInUse/host_eval_ctx), NOT xce_worker_t* (xce/types.h +// -- the wire/config type make_sched_worker() converts FROM). This +// Composition Algorithm's own pseudocode already uses +// `xce_sched_worker_t* w = host_iter->next(host_iter)` -- this struct +// declaration was simply out of sync with it. sched_check_host_satisfy()/ +// sched_meet_host_selection() (resource.c), which any real host_iter +// implementation must call, both take xce_sched_worker_t*, not +// xce_worker_t*. struct xce_host_iter_s { // Initialize the iterator for a given plan and worker set. // Returns 0 on success, nonzero on error. @@ -434,7 +444,7 @@ struct xce_host_iter_s { // Return the next candidate worker matching the plan's host filter, // or NULL when exhausted. The returned worker pointer is valid until // the next next() or fini() call. - xce_worker_t* (*next)(xce_host_iter_t* iter); + xce_sched_worker_t* (*next)(xce_host_iter_t* iter); // Release all resources held by the iterator. void (*fini)(xce_host_iter_t* iter);