Skip to content

fix(forecast): model_exogenous re-forecast is inert to price assumptions (0.0 delta) #237

@w7-mgfcode

Description

@w7-mgfcode

Summary

The model_exogenous scenario re-forecast path is now reachable from the What-If Planner (#229, PR #236), but the re-forecast appears inert to price assumptions — it returns a 0.0 units/revenue delta regardless of the price change magnitude.

Observed behaviour

Verified during Level-3 validation of PR #236 against a freshly seeded DB (store 332 / product 456, regression train job run_id=dc6dc4aaea18, n_observations=356):

POST /scenarios/simulate
{"run_id":"dc6dc4aaea18","horizon":14,
 "assumptions":{"price":{"change_pct":-0.15,"start_date":"2026-05-16","end_date":"2026-05-22"}}}
→ method="model_exogenous"  units_delta=0.0  revenue_delta=0.0

# same baseline, stronger change:
{"...":"...","price":{"change_pct":-0.40,"start_date":"2026-05-16","end_date":"2026-05-29"}}
→ method="model_exogenous"  units_delta=0.0  revenue_delta=0.0

Every per-day point comes back with delta=0.0, applied_factor=1.0, baseline == scenario. The heuristic path on a naive baseline reacts correctly to the same assumption (units_delta≈203.5).

Expected behaviour

A genuine model-driven re-forecast through a regression baseline should produce a non-zero demand delta when a price assumption is applied — otherwise method="model_exogenous" is indistinguishable from a no-op.

Likely root cause (to confirm)

Pre-existing PRP-27 code, not introduced by PR #236. Two hypotheses:

  1. The price assumption's change_pct is not flowing into the future feature frame — the exogenous price column built by app/features/scenarios/feature_frame.py is not adjusted before _simulate_model_exogenous re-runs the model.
  2. The seeded regression model genuinely learned ~zero price elasticity (the model leans entirely on autoregressive lag features), so a future-window price change has no effect.

Hypothesis 1 should be checked first: confirm whether the price-adjusted column reaches X_future, and whether the model has any non-lag price feature to respond to.

Scope / references

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingscope:forecastTouches the forecast area (commit-format scope)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions