fix(generate): treat partial deck-gen as success and surface per-slide outcomes #40
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "development_partial_job_success"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #39.
Summary
Stops reporting deck-generation jobs as
failedwhen most slides succeeded and the PDF was produced. The Rhai child script now exits 0 on partial success; the server merges a per-run manifest into the job-status response so callers can tell partial-success apart from clean success and from catastrophic failure.Behavior matrix
phaseexit_codepartial_successsucceededfalsesucceededtruefailedfalseChanges
generate_deck.rhai— throws only on catastrophic failure (generated == 0 && !pdf_created). Per-slide errors are always printed for diagnosability.hero_slides_lib::deck::deck_generate— populates a per-slide outcome list and writes<deck>/output/.last_generate.json(best-effort; never propagates IO errors).hero_slides_lib::types— addsSlideOutcomeandGenerateResult.per_slidewith#[serde(default)]so older deserializations still work.hero_slides_server::generate_job::GenerateJob— gains optionalmanifest_path.status()reads the manifest on terminal phase and mergestotal / generated / skipped / failed / has_pdf / errors / per_slide / partial_successinto the response. Other submitters (slide async, pdf async, agent jobs) keepmanifest_path: Noneand produce the unchanged base shape.dashboard.js—pollGenerateProgressadds a partial-success branch (warning toast, error log lines, 4s modal hold) BEFORE the clean-success branch. Failure path also iteratesstatus.errors.Test plan
succeeded,exit_code0,partial_success: true,failed: 1,has_pdf: true(orfalseif PDF blocked), warning toast in the dashboard.failed, non-zero exit,partial_success: false, error toast.succeeded,partial_success: false, success toast.cargo test --workspaceis green (97 passing, 1 ignored).phase/done/exit_codestill work (other job types unchanged).Backward compatibility
All new status fields are additive.
GenerateResultgains a field with#[serde(default)]. Older callers that don't parse the new fields keep working. Slide-async and pdf-async job statuses are unchanged.Notes
total == 0) hits the catastrophic branch (generated == 0 && !pdf_created). That seems right — generating an empty deck is a no-op error — but flagging in case reviewers prefer otherwise.crates/hero_slides_lib/src/slide_ops.rs:219and:448(unrelatedunnecessary_sort_by) were not touched. They're already ondevelopmentand pass CI there.dashboard.jsis a static file. Users may need a hard refresh after deploy to pick up the partial-state branch.Follow-up (not this PR)
- generate_deck.rhai throws only on catastrophic failure (0 slides + no PDF). Partial failures now exit 0; hero_proc reports phase=succeeded as it should. - deck_generate writes <deck>/output/.last_generate.json with per-slide outcomes, counts, and pdf_created so the server can read run results back after the child exits. - GenerateJob gains an optional manifest_path; status() reads the manifest on terminal phase and merges total/generated/skipped/failed/has_pdf/errors (capped 50) /per_slide/partial_success into the response. Slide-async and pdf-async submitters keep manifest_path=None (no shape drift). - dashboard.js renders the partial state distinctly: warning toast, per-slide error lines from status.errors, 4s modal hold. Failure path also dumps status.errors so users see which slide blew up. - types.rs gains SlideOutcome { name, ok, error } and GenerateResult.per_slide with #[serde(default)] for back-compat. #39