fix(lib): thread from_host through the wire format and the job-submit interning object (bug-1676, gitea #44)

- src/schema/controller.capnp: JobSubmitData gains
  fromHost @10: Text $C.mapname("from_host") -- auto-regenerates
  controller.capnp.c/h via the existing meson capnpc-c custom_target.
- src/include/xce/types.h: job_submit_data_t gains char* from_host.
- src/lib/jobj.c: jobsub_init/jobsub_destroy (the hand-written,
  ref-counted, content-deduped job-submit interning object -- not
  auto-generated) thread from_host through the deep-copy, the dedup
  identity comparison, and the destroy path.

Closes the wire-format half of the round-trip: from_host now survives
from the apiserver's submission all the way through the controller and
back on every subsequent job-state push, and rides along for free in
the existing WAL_JOB_SUBMIT persistence across a controller restart.
Did not need to touch job.c's build_job_submit_payloads() (bare
pointer borrow of the already-decoded submit struct) or any WAL
apply-path code (capnp_encode_job/decode_Job already generically
handle the whole xce_job_t including its full .submit sub-struct).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AgYRU3zDTqNGV5Jk8aiKLg
This commit is contained in:
Rongsong Shen 2026-08-24 15:14:42 +00:00
parent fe8818b19b
commit 363709b032
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
4 changed files with 65 additions and 6 deletions

View file

@ -148,6 +148,7 @@ static int jobsub_init(meta_obj_t* obj, va_list ap)
dst->user_group = makeString(src->user_group);
dst->job_description = makeString(src->job_description);
dst->resreq = makeString(src->resreq);
dst->from_host = makeString(src->from_host);
if (!(EQUAL_STRING(dst->queue, src->queue)
&& EQUAL_STRING(dst->user, src->user)
@ -155,7 +156,8 @@ static int jobsub_init(meta_obj_t* obj, va_list ap)
&& EQUAL_STRING(dst->project_name, src->project_name)
&& EQUAL_STRING(dst->user_group, src->user_group)
&& EQUAL_STRING(dst->job_description, src->job_description)
&& EQUAL_STRING(dst->resreq, src->resreq))) {
&& EQUAL_STRING(dst->resreq, src->resreq)
&& EQUAL_STRING(dst->from_host, src->from_host))) {
jobsub_destroy(obj);
return -ENOMEM;
}
@ -177,6 +179,7 @@ static void jobsub_destroy(meta_obj_t* obj)
dereference(jobsub->user_group);
dereference(jobsub->job_description);
dereference(jobsub->resreq);
dereference(jobsub->from_host);
if (jobsub->start_info != NULL) {
dereference(jobsub->start_info);
}