myxce/.wolf/bugs/bug-1953.md
Rongsong Shen 19be145d6f
docs(buglog): record Gitea sync for bug-1936..bug-1957
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 10:14:39 +00:00

3.7 KiB

id status status_updated status_note component severity timestamp last_seen occurrences files tags related fix_commits gitea_issue gitea_synced_status gitea_synced_hash
bug-1953 fixed 2026-10-10 apiserver wrong-result 2026-10-10T08:42:56Z 2026-10-10T08:42:56Z 1
src/frontend/apiserver/controllers/jobs.go
apiserver
submit
validation
bug-1936
e00526f9
384 fixed 9ca87695edca

bug-1953: apiserver skips submit validation and limit conversion for any job submitted with a job name

Description

Observed: (source reading, confirmed against the code on 2026-10-10) preCheckJobRequest() (src/frontend/apiserver/controllers/jobs.go:1308) returns from inside its job-name branch, before the rest of the checks run:

if req.JobName != "" {
    if strings.ContainsAny(req.JobName, "[]") {
        ...
        return count, true, nil      // jobs.go:1346, array name
    }
    ...
    return 1, false, nil             // jobs.go:1366, plain name
}

Everything after the branch is skipped for every named job (and every array job): the job-description, project-name and resreq length checks, resreq validation, the shell_limit → limit conversion (jobs.go:1405-1434), and the later env / launch-type validation and transfer-file parsing. Reported by the bug-1936 fix: a named job with transfer files fails with failed to parse ExtendData JSON.

Expected: every submission gets the same validation and conversions, named or not; the name only decides array handling. Impact: wrong result and missing validation: named and array jobs bypass length and resreq checks (bad input reaches the controller and scheduler), lose their shell limits, and fail at the worker when they carry transfers. Found by: fix of bug-1936 (submit exdata), 2026-10-10.

Environment

  • OS: no /etc/os-release; Docker container; NixOS kernel; kernel Linux 6.18.33 x86_64
  • libc: glibc 2.42-47 (interpreter /nix/store/wb6rhpznjfczwlwx23zmdrrw74bayxw4-glibc-2.42-47/lib/ld-linux-x86-64.so.2)
  • Toolchain: gcc (GCC) 15.2.0, meson 1.9.1
  • Build: asan (xce.build)
  • Code: scheduler-framework @ b9747ad2-dirty
  • Deployment: any (apiserver request validation; no cluster needed to show it)

Reproduction

  1. Submit xcecli jobs submit -J myjob --cpu_limit 60000 sleep 1 and the same job without -J.
  2. Without a name the CPU limit is converted into the job's limits; with -J myjob it is not. Likewise an over-long resreq or project name is rejected only for the unnamed job.
  • Frequency: deterministic (code path)
  • Evidence: the code quoted in Description; no logs kept.

Root cause

preCheckJobRequest() (controllers/jobs.go) returned from inside its job-name branch (return count, true, nil / return 1, false, nil), so everything after it was skipped for named and array jobs. Pre-existing.

Fix

The name branch now only sets n/isArray; the function continues through every check and conversion and returns n, isArray, nil at the end.

Verification

  • Test: TestPreCheckJobRequest_NamedJobsGetFullValidation (controllers/jobs_test.go): RED name "myjob": cpu limit not converted: got 0 s, want 60 and an over-long project name was accepted (same for arr[1-3]), GREEN after; whole controllers package ok.
  • Suites: xce-build.sh all asan xce.build --incremental on the merged branch, 2026-10-10: all C suites Ok 155 / Fail 0, frontend Go unit tests ok, xceadmin tests ok; apiserver CGO_ENABLED=0 go test ./... (incl. middleware, router, cmd) ok
  • Live: n/a: unit/fixture-level verification only; no live deployment was run (follow-up)

References

  • Fix commit: e00526f9 (on scheduler-framework; worker-branch original in the merge)
  • Review: .kiro/reviews/project-gap-review-2026-10-10.md