Skip to content

feat(STEF-2702): openstef-meta cleanup & release pipeline fixes#822

Merged
egordm merged 9 commits intorelease/v4.0.0from
feature/STEF-2702-cleanup-iteration-2
Mar 5, 2026
Merged

feat(STEF-2702): openstef-meta cleanup & release pipeline fixes#822
egordm merged 9 commits intorelease/v4.0.0from
feature/STEF-2702-cleanup-iteration-2

Conversation

@egordm
Copy link
Collaborator

@egordm egordm commented Mar 4, 2026

Cleanup Iteration 2 — STEF-2702

Second round of code quality improvements for the v4.0.0 release.

Changes

1. Polymorphic refactoring

  • Eliminate isinstance patterns from MLflow callback
  • Push behavior into BaseForecastingModel / EnsembleModelFitResult via polymorphic methods
  • Delete 3 protocol classes that were only used for isinstance checks

2. Extract normalize_to_unit_sum()

  • Move shared normalization logic to openstef-core
  • Deduplicate across 4 forecasters that computed feature importances identically

3. AvailableAt Windows-safe fix

4. Make openstef-models/meta optional for beam baselines

  • Add DataSaveCallback with 5 boolean toggles to extract debug/contributions save logic
  • Add [baselines] optional extra to openstef-beam
  • Remove re-exports from baselines/__init__.py; import models at top level in openstef4.py

5. Replace workflow factory with template + model_copy

  • Replace workflow_factory: Callable with workflow_template: CustomForecastingWorkflow
  • Add with_run_name() method for type-safe deep copy
  • Add kind discriminator field: Literal["single"] on ForecastingWorkflowConfig, Literal["ensemble"] on EnsembleForecastingWorkflowConfig
  • Simplify factory: kind-based narrowing eliminates both pyright: ignore suppressions
  • Delete WorkflowCreationContext class (no longer needed)

6. Smoke tests for template pattern

  • test_fit_does_not_mutate_template — verifies template immutability after fit
  • test_fit_then_predict_returns_forecast — e2e smoke test for fit→predict path

7. Add openstef-meta to release pipeline

  • Add missing [build-system] section to openstef-meta pyproject.toml
  • Add openstef-meta to poe version task (version bump + root pinning)
  • Fix baselines extra version range: >=4.0.0.dev0,<5 (was >=0.0.1,<1)
  • Add openstef-meta to root [all] optional extra and licensecheck ignore list

8. Extend test utility + review feedback

  • Add include_atmosphere, include_price, include_available_at options to create_synthetic_forecasting_dataset
  • Simplify test fixture to use the shared utility
  • Remove verbose parenthetical comments per review feedback

…nce protocols

- SubsetMetric.to_flat_dict() for metrics self-serialization
- ModelFitResult.metrics_to_flat_dict() with component_fit_results override
- BaseForecastingModel: component_hyperparams, get_explainable_components()
- ForecastCombiner extends ExplainableForecaster (gains plot_feature_importances)
- EnsembleForecastingModel/EnsembleModelFitResult override all polymorphic methods
- MLflow callback: delete 3 protocols, 5 isinstance checks -> polymorphic calls
- Fix penalty bug: lower_is_better now multiplies (was dividing)
@github-actions github-actions bot added the feature New feature or request label Mar 4, 2026
egordm added 6 commits March 5, 2026 09:46
…ortances

- Add normalize_to_unit_sum() pipe-compatible utility in openstef_core.utils.pandas
- Replace duplicated normalization logic in 4 forecasters (xgboost, gblinear, lgbm, lgbmlinear)
- All now use weights_df.pipe(normalize_to_unit_sum)
Change DnTHH:MM format to DnTHHMM (e.g. D-1T0600 instead of D-1T06:00).
Colons are illegal in Windows file paths, breaking benchmark output directories.

from_string() now accepts both formats for backward compatibility.
- Replace workflow_factory Callable with workflow_template field
- Add with_run_name() method for type-safe deep copy
- Add kind discriminator to ForecastingWorkflowConfig (single) and
  EnsembleForecastingWorkflowConfig (ensemble)
- Simplify factory: use kind-based narrowing, raise MissingExtraError
- Delete WorkflowCreationContext (no longer needed)
- Remove both pyright: ignore[reportArgumentType] suppressions
…stForecaster

- test_fit_does_not_mutate_template: verifies template immutability after fit
- test_fit_then_predict_returns_forecast: e2e smoke test for fit→predict path
- Add missing [build-system] section to openstef-meta pyproject.toml
- Add openstef-meta to poe version task (version bump + root pinning)
- Fix baselines extra version range: >=4.0.0.dev0,<5 (was >=0.0.1,<1)
- Add openstef-meta to root [all] optional extra
- Add openstef-meta to licensecheck ignore_packages
@egordm egordm changed the title refactor(STEF-2702): cleanup iteration 2 — polymorphism over isinstance feat(STEF-2702): openstef-meta cleanup & release pipeline fixes Mar 5, 2026
@egordm egordm marked this pull request as ready for review March 5, 2026 12:24
@egordm egordm requested a review from a team March 5, 2026 12:24
…F-2702-cleanup-iteration-2

# Conflicts:
#	pyproject.toml
#	uv.lock
bartpleiter
bartpleiter previously approved these changes Mar 5, 2026
Copy link
Collaborator

@bartpleiter bartpleiter left a comment

Choose a reason for hiding this comment

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

Nice fixes!

- Add include_atmosphere/price/available_at options to
  create_synthetic_forecasting_dataset for realistic test data
- Simplify test fixture to use the shared utility
- Remove verbose parenthetical comments per review feedback
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 2026

@egordm egordm merged commit 5fb490a into release/v4.0.0 Mar 5, 2026
4 checks passed
@egordm egordm deleted the feature/STEF-2702-cleanup-iteration-2 branch March 5, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants