Skip to content

feat(api,db,ui): forecast champion selector slice C — forecast decision, business summary & promotion #362

@w7-mgfcode

Description

@w7-mgfcode

Slice C of 3 — Forecast Decision, Business Summary + Operationalization

Closes the champion-selection workflow after comparison (Slices A #356 + B #360 merged). Adds the decision half: accept the recommended winner or override to another candidate (warned + audited), train it, generate + read its forecast, surface a business-readable interpretation, and — through an explicit, approval-gated, audited path — promote the trained champion to a registry alias.

PRP: PRPs/forecast-champion-selector-slice-c-forecast-decision-operationalization.md

Backend (additive to model_selection slice)

  • POST /model-selection/{id}/train-selected — train a user-chosen candidate (override + audit); returns override_warning.
  • POST /model-selection/{id}/predict — KEEP existing behavior; ADD optional ForecastDecisionParams body; response gains peak/low + a decision block (safety stock, expected demand, bias-risk).
  • POST /model-selection/{id}/promote — approval-gated, audited registry orchestration (create_run → SUCCESS w/ verified artifact → create_alias); persists champion_run_id/promoted_alias/promotion_decision.
  • Pure app/features/model_selection/decision.py (z-table, King safety-stock heuristic, peak/low, bias-risk text).
  • One Alembic migration: 7 additive columns on model_selection_run (incl. feature_frame_version for V2 promotion).

Frontend (extends /visualize/champion)

  • Hooks: useTrainWinner/useTrainSelected/usePredictWinner/usePromoteChampion.
  • components/champion-selector/decision/* family (override panel, train/forecast actions w/ capability-limited state, summary card, chart, daily table, business-interpretation panel, safety-stock panel, promote dialog).
  • Additive types in the "Model Selection" section.

Docs + dogfood

  • docs/user-guide/champion-selector-guide.md + cross-link.
  • End-to-end manual dogfood (select → run → decide → train → forecast → promote) over localhost.

Success criteria

  • train-selected override persists is_override+override_reason, returns override_warning; non-candidate → 400.
  • predict returns peak/low + labeled decision; safety stock never feeds ranking; feature-aware → clean 400 + UI blocked state.
  • promote requires approved_by; non-recommended-no-ack → 422; before-train → 422; bad alias_name → 422; success creates SUCCESS registry run + alias + audit.
  • Migration adds 7 columns; promote carries REAL feature_frame_version (V2 → 2); downgrade clean.
  • All Level-1..4 gates pass; guide page exists; dogfood completes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions