myxce/src
lei.chen c90e63ec0f fix(frontend): job control no longer returns HTTP 500 (bug-1490)
Two stacked defects in the apiserver job-control link, both of which kept
hold/release/cancel from ever reaching the controller:

1. controllers/jobs.go: validateJobControl and foundJob asserted
   jobinfo.Data["array_idx"].(int64), but StoreToOrderMaps produces
   array_idx as int (models.JobInfo.ArrayIdx is declared int) -> panic
   -> Gin Recovery -> HTTP 500 before backend.ControlJob ran. Add
   normalizeJobInt64 / jobArrayIdx helpers and use them in both
   functions (job_status already had this fix via normalizeJobStatus;
   array_idx was missed).

2. backend/clib.go: backend.ControlJob set xce_jobctrl_t.action to the
   models.JOB_* constant (JOB_STOP=1 / JOB_RESUME=2 / JOB_KILL=3 /
   JOB_CHKPNT=8), but that field is the capnp JobControl union
   discriminant (JobControl_u_siginfo=0 / JobControl_u_ckptoption=1).
   The controller's job_ctrl() selected the wrong union branch (or
   none, since encode_JobControl drops the union pointer for
   non-0/1 discriminants) and rejected every control with -EINVAL.
   Add jobCtrlDiscriminant() and use it.

Also: resolveExecUser was defined in the cgo-only convert.go but is
exercised by a non-cgo test, so `make test` (CGO_ENABLED=0) failed to
build the backend package. Move it to convert_pure.go so it compiles in
both modes.

Tests: 3 controller regression tests (validateJobControl allowed /
not-allowed branches, foundJob array-child branch) + 1 backend
jobCtrlDiscriminant test. make test fully green. Cluster E2E verified:
hold -> PSUSP, release -> PEND, cancel -> EXIT on a PEND job, no 500,
no -EINVAL, all daemons healthy.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-08-07 07:35:51 +00:00
..
autoscaler fix: nix build environment fixes 2026-07-24 07:03:18 +00:00
configs fix(apiserver): carry exec_user on job submit so jobs don't run as nobody (bug-1500) 2026-08-04 07:38:43 +00:00
controller fix(controller,worker): dual-state worker loss + resend actual job state (bug-1509 P3) 2026-08-06 06:49:24 +00:00
docs fix(configs): add worker-builtin load indices missing from resources.yaml 2026-08-02 07:36:03 +00:00
frontend fix(frontend): job control no longer returns HTTP 500 (bug-1490) 2026-08-07 07:35:51 +00:00
include feat(raft-adapter-conformance): add term field to ReplConfigPushReply schema 2026-07-29 09:09:56 +00:00
lib fix(libxce): swallow nop reply so heartbeat can't poison shared wbuf (bug-1508) 2026-08-05 09:41:00 +00:00
nixSupport fix(nix): pin capnpc source to immutable commit, not mutable main ref 2026-07-24 08:25:38 +00:00
scheduler fix(scheduler): stop re-dispatching running jobs (bug-1498) + resval double-free (bug-1497) 2026-08-04 01:20:38 +00:00
schema feat(raft-adapter-conformance): add term field to ReplConfigPushReply schema 2026-07-29 09:09:56 +00:00
tools fix: nix build environment fixes 2026-07-24 07:03:18 +00:00
worker fix(controller,worker): dual-state worker loss + resend actual job state (bug-1509 P3) 2026-08-06 06:49:24 +00:00
xceadmin wip(admin-config-tool): task 6.3 HA E2E test (blocked, flaky primary-push) 2026-07-31 08:09:36 +00:00
flake.lock fix librtti package leak issue 2026-07-27 15:31:50 +08:00
flake.nix chore(nix): drop redundant capnpc override from flake.nix overlay 2026-08-01 03:04:10 +00:00
meson.build feat(admin-config-tool): wire xceadmin into meson + nix build 2026-07-22 10:46:45 +00:00
meson.options Merge Go frontend (apiserver + xcecli) into meson build 2026-04-14 11:23:18 +08:00