fix(jobs,ui): reach model_exogenous + block empty assumption dates in the planner#236
Conversation
Add a regression branch to JobService._execute_train so a train job can train a regression model and complete with result.run_id set. Rewire the What-If Planner baseline picker to train jobs and read the artifact key from job.result.run_id, making the model_exogenous re-forecast path reachable from the browser.
Add a pure assumptionDateErrors helper (unit-tested) and use it in the What-If Planner to disable Run simulation and Save as plan while any enabled Price/Promotion assumption has a blank date, with inline Required hints. The empty-string-date 422 is now structurally unreachable from the form.
There was a problem hiding this comment.
Sorry @w7-mgfcode, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Two related What-If Planner bug fixes (
/visualize/planner), landed on one branch perPRPs/planner-model-exogenous-and-empty-dates.md.#229 —
model_exogenousreachable from the UIThe headline PRP-27 capability (a genuine model-driven re-forecast of a
regressionbaseline) was reachable only via raw API calls or agent tools. Root cause: the planner picked apredictjob and readparams.run_id, butregressionis rejected byPOST /forecasting/predict, so no completed regression predict job can ever exist.regressionbranch toJobService._execute_train, so atrainjob can train a regression model and complete withresult.run_idset.trainjobs and read the artifact key fromjob.result.run_id. Aregressiontrain job now routesPOST /scenarios/simulatedown themodel_exogenousre-forecast branch.#228 — empty assumption dates blocked
Enabling Price/Promotion without filling both From/To dates submitted empty strings → backend RFC 7807 422. Added a pure, unit-tested
assumptionDateErrors()helper; the planner now disables Run simulation + Save as plan and shows inlineRequiredhints while any enabled assumption has a blank date. The empty-date 422 is now structurally unreachable from the form.Testing
ruff check+ruff format --check— cleanmypy app/+pyright app/— 0 errorspytest -m "not integration"— 1290 passed (2 newjobstests)lint+tsc --noEmit+test --run— 109 passed (5 newscenario-utilstests)trainjob completes withrun_id; that baseline →simulatereturnsmethod="model_exogenous"; naive baseline still returnsmethod="heuristic"; blank dates showRequired+ disable Run/Save (browser-verified)Notes
Resolves #229 and #228.
Follow-up (out of scope here): the
model_exogenousre-forecast is reachable but returns a0.0units/revenue delta for a price assumption regardless of magnitude — pre-existing PRP-27 behaviour inscenarios/feature_frame.py/_simulate_model_exogenous. A separate issue will track it.