fix(scheduler): snapshots save a job's resreq text, not its debug dump (bug-1888)

build_wire_job() filled the saved job's submit->resreq with
format_resreq()'s human-readable dump ("Primary:\n  Tasks: ..."). The
loader's parser accepted that as a primary with neither select nor
rusage, so every job restored from a snapshot (a replay's start snapshot,
REPL snapshots) lost both.

A scheduler job now keeps the text its resreq was parsed from
(xce_sched_job_t.resreq_str, set at ingest, JOB_UPDATE and snapshot load,
freed at teardown) and the snapshot saves that; a job without it restores
as the loader's "type == any" default.

Test: test_snapshot_round_trip_keeps_job_resreq_text RED before (saved
text was the dump), GREEN after.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-09-29 10:26:21 +00:00
parent 3e873f0a66
commit 077b1213d3
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
7 changed files with 83 additions and 9 deletions

View file

@ -139,6 +139,10 @@ typedef struct xce_sched_job_ {
* Owned by the job: replaced on each JOB_RUSAGE update, freed in
* kill_sched_job. NULL until the first rusage report. */
xce_job_rusages_t* rusages;
/* bug-1888: the resreq text `resreq` was parsed from (after the
* "type == any" default), saved by snapshots so a restored job gets the
* same request back. Owned; NULL for a job built without one. */
char* resreq_str;
} xce_sched_job_t;
typedef struct {