feat(multitask)!: 19.0.0 — remove RunState mirror shim, config.task write, get_target_data config-window fallback#340
Merged
bartzbeielstein merged 2 commits intoJun 7, 2026
Conversation
…indow fallback
Remove two pieces of deprecated bridging code that were retained for
backward compatibility during the RunState extraction (v18.0.0) but are
now confirmed to have zero callers:
1. `get_target_data` config-window fallback
(`src/spotforecast2_safe/manager/features.py`): the function formerly
tried `getattr(config, "start_train_ts"/"end_train_ts", None)` when
the explicit parameters were `None`, emitting `DeprecationWarning`.
The fallback blocks (~lines 825-866 pre-removal) are deleted. When
either explicit parameter is `None` the function now raises
`ValueError` unconditionally. The `warnings` import is removed as it
is no longer used. Docstring updated: the Args sections for
`start_train_ts`/`end_train_ts` no longer mention the deprecated
fallback; they state the parameter is keyword-only, required, and
`None` → raises `ValueError`. The paragraph mentioning the config
fallback for backward compatibility is replaced with a note that both
parameters are required. The function signature now enforces this at
the language level: everything after `config` is keyword-only (bare
`*` separator), and `start_train_ts`/`end_train_ts` have no default.
The runtime `if ... is None: raise ValueError` guards are kept so that
callers who pass `None` explicitly get a clear error message rather
than a `TypeError`.
2. `config.task` write in `MultiTaskBase.__init__`
(`src/spotforecast2_safe/multitask/base.py`, line 361 pre-removal):
the assignment `config.task = self.TASK` and its comment ("Propagate
the task identifier so config-aware helpers know the mode.") are
removed. `ConfigMulti.task` retains the value set by the caller at
construction or via `set_params`/direct assignment and is no longer
mutated as a side effect of task-class instantiation.
Also: revert ruff-collapsed mi_sample_size f-string at features.py
~line 495 back to the original two-line form (cosmetic, out of scope of
the breaking change); add parametrized regression test
`test_none_window_timestamp_raises_value_error` to
`tests/test_manager_features.py` (covers both `start_train_ts` and
`end_train_ts`); update stale fixture comment in same file.
BREAKING CHANGE: `get_target_data` no longer accepts `None` for
`start_train_ts` or `end_train_ts` and will no longer fall back to
`config.start_train_ts` / `config.end_train_ts` — callers must pass
explicit `pd.Timestamp` values (e.g. from `task.run_state.start_train_ts`
/ `task.run_state.end_train_ts`). Both parameters are now keyword-only
(bare `*` separator after `config`); positional passing of
`data_with_exog`, `exog_feature_names`, or `exo_pred` is also no longer
accepted. Additionally, constructing any `MultiTask` subclass no longer
mutates `config.task`; code that relied on `config.task` reflecting the
active task type after task instantiation must read `task.TASK` from the
task object instead.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Derived pipeline fields are no longer mirrored onto the config object
after pipeline runs. Reading `config.data_start`, `config.data_end`,
`config.cov_start`, `config.cov_end`, `config.start_download`,
`config.end_download`, `config.end_train_ts`, or `config.start_train_ts`
now raises AttributeError — these values exist only on `task.run_state`.
No DeprecationWarning is emitted by the pipeline anymore.
Changes:
- Delete `_set_derived` method and its "Derived-state helpers" banner.
- Delete `_run_state_deprecation_warned` instance flag.
- Replace all 8 `_set_derived(...)` call sites with direct
`self.run_state.<field> = value` assignments.
- Remove `warnings.catch_warnings()`/`simplefilter("ignore", DeprecationWarning)`
wrappers from 5 docstring `{python}` examples in `base.py` and 2 in
`defaults.py`; dedent the wrapped statements.
- Remove dead `import warnings` (module-level) from `base.py`.
- Harden `RunState` against silent typo assignments: changed to
`@dataclass(slots=True)` so any write to an undeclared attribute raises
`AttributeError` immediately.
- Rewrite `TestMirrorShim` → `TestNoConfigMirror`: asserts all 8 derived
fields (including `end_train_ts`/`start_train_ts`) are NOT set on config
after `prepare_data()` + `_setup_training_window()`.
- Rewrite `TestDeprecationWarning` → `TestNoDeprecationWarning`: asserts
zero DeprecationWarnings emitted during the pipeline.
- Remove `warnings.catch_warnings()` suppression wrappers from all other
test classes in `test_run_state.py` (they existed only to silence the
shim warning).
- Update `tests/multitask/test_prepare_data_clamp.py` and
`tests/multitask/test_prepare_data_target_corruption.py` to read
`task.run_state.data_end` / `task.run_state.cov_end` instead of
`task.config.data_end` / `task.config.cov_end`.
- Fix stale "mirror" prose in `base.py` comments.
BREAKING CHANGE: The following 8 fields no longer exist on the config
object after pipeline runs and will raise AttributeError if accessed
there: `start_download`, `end_download`, `data_start`, `data_end`,
`cov_start`, `cov_end`, `end_train_ts`, `start_train_ts`. Read all of
them from `task.run_state` instead. `config.targets` still holds the
user-supplied input (unchanged); the resolved target list is available
as `task.run_state.targets`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 19.0.0 train (tbb-skills4agents work item #2)
Two commits, both
feat!:0ee7a1ff— drop the vestigialconfig.taskwrite and theget_target_dataconfig-window fallback (start_train_ts/end_train_tsnow required keyword-only;None→ValueError). Dependency-scanned: zero callers relied on either.1ddbfa47— remove the RunState mirror shim: derived pipeline fields (start_download,end_download,data_start,data_end,cov_start,cov_end,end_train_ts,start_train_ts) are no longer mirrored onto the config; reading them from the config raisesAttributeError; the pipeline emits noDeprecationWarninganymore. Everything lives ontask.run_state(now@dataclass(slots=True)— field typos raise instead of silently creating attributes). 7 docstring examples un-wrapped; shim tests inverted (TestNoConfigMirrorover all 8 fields,TestNoDeprecationWarning).config.targetscontinues to hold the user input unchanged; the resolved list lives ontask.run_state.targets.Verification
uv run quarto render --no-cache: green (all{python}docstring examples execute)slots=Truehardening appliedDownstream (sequenced in work item #2)
spotforecast2-safe>=19,<20+ rewrite 4config.task-after-init test assertions. sf2 has zero derived-field reads (scanned).🤖 Generated with Claude Code