fix(schema): rename struct Data -> XceData to unshadow capnp builtin blob type
controller.capnp declared `struct Data $C.mapname("xce_data_t")` (an
OPCode_get query-result tagged union) at file scope, which shadows
Cap'n Proto's builtin Data blob type for every later `: Data` field in
the same file. This silently miscompiled 7 fields across 6 structs as
a struct-pointer type instead of a raw byte blob: UpgradeConfigRequest
.sha256/.bytes, ReplConfigReply.sha256/.bytes, ReplConfigPushRequest
.sha256/.bytes, ReplEnvelope.payload, SnapshotTransfer's chunk
payload, WalCatchupEntry.payload/.batchPayloads, and CtrlHelloRequest
.key. Production C code had already routed around it for years via
hand-rolled raw capn_ptr manipulation (see request.c's own comments);
nothing before now needed the generated codec/accessors to actually
work for these fields.
Renamed the local struct to XceData (capnp-level name only; the
$C.mapname("xce_data_t") C typedef is unchanged) and explicitly
repointed getdata/pushmsg at XceData by name, since those two fields
correctly want the local tagged union. Updated every derived
generated-identifier reference across 19 hand-written files spanning
controller, lib, scheduler, and the Go apiserver/xcecli CGo bindings.
Fixed 5 call sites in lib/request.c that had been typed against the
old workaround alias but now legitimately receive the correct
capn_data type (a pure type-name swap -- Data_ptr/XceData_ptr and
capn_data share the identical {capn_ptr p} layout).
Verified via full rebuild+test: lib (1/1), controller (3/3, incl. the
job-array push regression tests), scheduler (15/15), Go apiserver +
xcecli (all packages green), and a direct pycapnp round-trip proving
UpgradeConfigRequest.sha256/.bytes now encode/decode correctly.
Bug: bug-1461 (.wolf/buglog.json). Unblocks admin-config-tool task 3.3.
This commit is contained in:
parent
7ed3a3941f
commit
e53c086ec5
21 changed files with 144 additions and 144 deletions
|
|
@ -23,7 +23,7 @@
|
|||
* scheduler-internal externs handler.c references but this file does not
|
||||
* exercise are stubbed below: sched_init_config (config-init request path)
|
||||
* and sched_get_job (job-array-single-wal-record task 5.3's per-element
|
||||
* dedup check, Data_data_jobArray — not tested here, see
|
||||
* dedup check, XceData_data_jobArray — not tested here, see
|
||||
* test_job_array_expand.c for the real kvmgr-backed sched_get_job). */
|
||||
int sched_init_config(xce_scheduler_t* s, xce_conf4sched_t* c)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ static void seed_existing_job(xce_scheduler_t* sched, uint64_t jobid)
|
|||
/* Builds a heap-allocated, heap-owned-strings (jobArray, submit) pair -- the
|
||||
* same shape decode_JobSubmit_ptr() produces on the real wire-decode path
|
||||
* (controller.capnp.c), not a stack/string-literal stand-in. Task 7.3 made
|
||||
* sched_handle_dataset()'s Data_data_jobArray case free_JobSubmit_ptr() its
|
||||
* sched_handle_dataset()'s XceData_data_jobArray case free_JobSubmit_ptr() its
|
||||
* dataset->rows unconditionally, so any fixture routed through that handler
|
||||
* must be genuinely heap-owned or the free segfaults on stack memory /
|
||||
* string literals. Caller owns the returned pointer until it hands it to
|
||||
|
|
@ -154,7 +154,7 @@ static void test_job_array_push_expands_into_n_tasks(void)
|
|||
ja = init_job_array(5000, 3);
|
||||
|
||||
memset(&dataset, 0, sizeof(dataset));
|
||||
dataset.table = Data_data_jobArray;
|
||||
dataset.table = XceData_data_jobArray;
|
||||
dataset.rows = (void*)ja;
|
||||
|
||||
/* sched_handle_dataset() owns and frees dataset.rows on return (task
|
||||
|
|
@ -195,7 +195,7 @@ static void test_job_array_redelivery_does_not_duplicate(void)
|
|||
fixture_init(&sched);
|
||||
|
||||
memset(&dataset, 0, sizeof(dataset));
|
||||
dataset.table = Data_data_jobArray;
|
||||
dataset.table = XceData_data_jobArray;
|
||||
dataset.rows = (void*)init_job_array(6000, 2);
|
||||
|
||||
/* first delivery: 2 new tasks enqueued. sched_handle_dataset() owns and
|
||||
|
|
@ -309,7 +309,7 @@ static void test_wire_dispatch_chain_delivers_n_tasks(void)
|
|||
job_array.submit = &submit;
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.table = Data_data_jobArray;
|
||||
data.table = XceData_data_jobArray;
|
||||
data.data.job_array = &job_array;
|
||||
|
||||
memset(&request, 0, sizeof(request));
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
* it: via xce_decode()'s output, never a hand-built dataset_t.
|
||||
*
|
||||
* Bug-catching demonstration (this task's "RED phase"): temporarily
|
||||
* reverting extract_data()'s `case Data_data_jobArray:` (task 5.3b's fix)
|
||||
* reverting extract_data()'s `case XceData_data_jobArray:` (task 5.3b's fix)
|
||||
* back to falling through to `default: rc = -EINVAL` makes this test's first
|
||||
* assertion (`callnext != 0` while dataset->rows stays NULL) fail loudly,
|
||||
* and the subsequent job-count assertions fail too (zero tasks created) --
|
||||
|
|
@ -244,7 +244,7 @@ static void build_encoded_push(io_packet_t** out_pkt, uint64_t base_jobid,
|
|||
job_array.submit = submit_storage;
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
data.table = Data_data_jobArray;
|
||||
data.table = XceData_data_jobArray;
|
||||
data.data.job_array = &job_array;
|
||||
|
||||
memset(&request, 0, sizeof(request));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue