fix(apiserver): jobs list -l/-o validates against the wrong struct (bug-1674, gitea #41)

GetJobsInfo/GetJobByIDs validated the -o/-l field list against
models.JobSubmitRequest{} -- the job-submission payload -- instead of
models.JobInfo{}, the query/response model (the already-correct
pattern used elsewhere in this file at line 1131). Response-only
fields like pending_reason don't exist on JobSubmitRequest, so any
such field made the whole listing fail outright with "unsupported
query field", not just omit that column.

core_limit/mem_limit exist on JobSubmitRequest but not on JobInfo --
switching wholesale would have newly broken those two previously-valid
fields. Added CoreLimit/MemLimit to JobAdditionalFields, the existing
merge-in bucket already used for pids/pgids/interactive_job_url.

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 14:23:38 +00:00
parent 643741fad5
commit 88c7c05daf
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
3 changed files with 54 additions and 2 deletions

View file

@ -612,6 +612,13 @@ type JobAdditionalFields struct {
Pids []int `json:"pids"` // List of process IDs associated with the job
Pgids []int `json:"pgids"` // List of process group IDs associated with the job
InteractiveJobURL string `json:"interactive_job_url"`
// CoreLimit/MemLimit: JobInfo has no equivalent field (these are
// submission-time resource limits, not job-state fields), but xcecli's
// JobFieldsMap accepts them as valid -o/-l display fields (bug-1674) --
// merged in here rather than validating against JobSubmitRequest itself,
// which lacks response-only fields like pending_reason.
CoreLimit CustomLimit `json:"core_limit"`
MemLimit CustomLimit `json:"mem_limit"`
}
type JobSubmitRequest struct {