feat(scheduler-snapshot-job-allocation): construct schedobj for restored jobs

Task 1.2: snapshot_load.c gains a local, static field-for-field port of
core_events.c's core_build_schedobj()/core_build_primary_schedobj()/
core_build_compound_schedobj()/core_build_alter_schedobj() (the bug-1569
fix for the JOBS_PUSH path). Every job restored from a snapshot whose
resreq parsed successfully now gets a valid, non-NULL job->schedobj,
closing the same NULL-deref crash class for the snapshot-load path.

Guarded on job->resreq != NULL so the pre-existing, unrelated
resreq-parse-failure path is untouched (still leaves schedobj NULL,
same as today -- not fixed here, per design.md's documented boundary).

New tests prove non-NULL schedobj with correct tag/union member for
primary, compound, and alter resource requests, plus a regression test
confirming the parse-failure path's behavior is unchanged.

Requirements: 2.1, 2.2, 2.3, 2.4
This commit is contained in:
Rongsong Shen 2026-08-27 13:15:54 +00:00
parent 097e33ae34
commit 22353849f6
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
3 changed files with 335 additions and 1 deletions

View file

@ -9,7 +9,7 @@
- _Requirements: 1.1, 1.4_
- _Boundary: xcealloc (job allocation deep-copy)_
- [ ] 1.2 (P) Construct a valid scheduling representation for every job restored from a snapshot
- [x] 1.2 (P) Construct a valid scheduling representation for every job restored from a snapshot
- Write a failing test first (TDD red) asserting that a job reconstructed from a snapshot has a non-NULL, correctly-shaped internal scheduling representation for a primary, a compound, and an alternative resource request.
- Implement construction using only information already available by the time a restored job's resource request has been parsed (its queue, user, project, and resource request) — no new snapshot data is captured or required.
- Skip construction (leaving today's behavior unchanged) when a restored job's resource request itself failed to parse — do not attempt to fix that separate, pre-existing failure path as part of this task.