Skip to content

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

Merged
w7-mgfcode merged 1 commit into
devfrom
feat/champion-selector-slice-c
Jun 1, 2026
Merged

feat(api,db,ui): forecast champion selector slice C — forecast decision, business summary & promotion (#362)#363
w7-mgfcode merged 1 commit into
devfrom
feat/champion-selector-slice-c

Conversation

@w7-mgfcode
Copy link
Copy Markdown
Owner

Summary

Slice C of the Forecast Champion Selector — Forecast Decision, Business Summary & Promotion. Closes the A→B→C series (tracking issue #362). Additive to the model_selection slice; extends the existing /visualize/champion page (no new route/nav).

Backend

  • decision.py (new, pure) — z_for_service_level (fixed table, no scipy), compute_forecast_decision (King safety-stock z·σ·√L), forecast_peak_low, BIAS_EXPLANATION.
  • schemas.pyTrainSelectedRequest, ForecastDecisionParams, ForecastDecision, PromoteRequest, PromoteResponse; extended ForecastSummary/TrainWinnerResponse/PredictWinnerResponse.
  • models.py — 7 additive columns on ModelSelectionRun (trained_model_type, is_override, override_reason, champion_run_id, promoted_alias, promotion_decision, feature_frame_version).
  • service.pytrain_selected (override, validated against candidate models), promote (lazy RegistryService: create_run→RUNNING→register artifact→SUCCESS→create_alias + audit), predict_winner returns the decision tuple; feature_frame_version persisted at run-creation.
  • routes.pyPOST /train-selected, POST /promote, optional decision body on /predict.
  • Migration e4f5a6b7c8d9 — 7 additive cols; up/down round-trip verified.

Frontend

  • Slice C types + extended forecast summary in types/api.ts.
  • useTrainWinner/useTrainSelected/usePredictWinner/usePromoteChampion hooks.
  • New components/champion-selector/decision/DecisionSection orchestration root (keyed by selectionId) + 8 presentational panels, each with tests.
  • champion.tsx renders <DecisionSection> below Slice B results when terminal + winner.

Docs

  • New docs/user-guide/champion-selector-guide.md + cross-link from feature-reference.md.

Validation

  • ruff + format clean; mypy/pyright clean (except documented lightgbm/xgboost optional-dep noise — CI installs the extras).
  • Backend 1839 unit + 17 model_selection integration green.
  • Frontend tsc/lint clean + 319 vitest green.
  • Migration up/down clean. Full dogfood passed (Level 1–4).

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @w7-mgfcode, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 94ab359f-da0b-4619-8e51-7717b5e2f2de

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/champion-selector-slice-c

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@w7-mgfcode w7-mgfcode merged commit 0602a86 into dev Jun 1, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant