fix(apiserver): thread from_host through the CGO conversion layer (bug-1676, gitea #44)

modelJobToSubmit/freeJobSubmit (submit direction) and
cJobToModel/cJobArrayToModels (receive direction, both single-job and
array-job paths) now carry from_host across the CGO boundary.
rawSubmitData/rawJobToModel (the pure-Go, CGO-free mapping layer) gain
the field too, completing the round-trip so JobInfo.FromHost reflects
whatever the controller actually has -- which, as of the prior two
commits, is now always the client-asserted hostname. backend/handler.go
needs no change: its existing blind overwrite in OnJobUpdated is
correct by construction once every controller push genuinely carries
the right value.

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:49 +00:00
parent 363709b032
commit 1a61b04ab6
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
3 changed files with 28 additions and 0 deletions

View file

@ -127,6 +127,7 @@ type rawSubmitData struct {
minTasks int
maxTasks int
startInfo *rawStartInfo
fromHost string
}
// rawJobData mirrors the C xce_job_t fields used by the Go model.
@ -197,6 +198,7 @@ func rawJobToModel(r rawJobData) *models.JobInfo {
info.ResReq = s.resReq
info.NumProcessors = s.minTasks
info.MaxNumProcessors = s.maxTasks
info.FromHost = s.fromHost
if s.startInfo != nil {
si := s.startInfo
info.Command = si.cmdline