Skip to content

feat(multitask)!: 19.0.0 — remove RunState mirror shim, config.task write, get_target_data config-window fallback#340

Merged
bartzbeielstein merged 2 commits into
developfrom
feat/remove-config-task-write-and-window-fallback
Jun 7, 2026
Merged

feat(multitask)!: 19.0.0 — remove RunState mirror shim, config.task write, get_target_data config-window fallback#340
bartzbeielstein merged 2 commits into
developfrom
feat/remove-config-task-write-and-window-fallback

Conversation

@bartzbeielstein
Copy link
Copy Markdown
Collaborator

@bartzbeielstein bartzbeielstein commented Jun 7, 2026

The 19.0.0 train (tbb-skills4agents work item #2)

Two commits, both feat!:

  1. 0ee7a1ff — drop the vestigial config.task write and the get_target_data config-window fallback (start_train_ts/end_train_ts now required keyword-only; NoneValueError). Dependency-scanned: zero callers relied on either.
  2. 1ddbfa47remove 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 raises AttributeError; the pipeline emits no DeprecationWarning anymore. Everything lives on task.run_state (now @dataclass(slots=True) — field typos raise instead of silently creating attributes). 7 docstring examples un-wrapped; shim tests inverted (TestNoConfigMirror over all 8 fields, TestNoDeprecationWarning).

config.targets continues to hold the user input unchanged; the resolved list lives on task.run_state.targets.

Verification

  • Full suite: 2352+ passed (re-verified after review fixes), ruff clean
  • uv run quarto render --no-cache: green (all {python} docstring examples execute)
  • Code-reviewed: blocker (8-field test coverage) + slots=True hardening applied

Downstream (sequenced in work item #2)

  • sf2 6.0.0 follows immediately: pin spotforecast2-safe>=19,<20 + rewrite 4 config.task-after-init test assertions. sf2 has zero derived-field reads (scanned).
  • Consumers bump in round 3 after both releases. Never yank 18.1.0/5.1.1/0.12.8 (leaderboard repro ZIP).

🤖 Generated with Claude Code

bartzbeielstein and others added 2 commits June 7, 2026 19:19
…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>
@bartzbeielstein bartzbeielstein changed the title feat(multitask)!: drop config.task write and get_target_data config-window fallback feat(multitask)!: 19.0.0 — remove RunState mirror shim, config.task write, get_target_data config-window fallback Jun 7, 2026
@bartzbeielstein bartzbeielstein marked this pull request as ready for review June 7, 2026 18:41
@bartzbeielstein bartzbeielstein merged commit d13f20b into develop Jun 7, 2026
9 checks passed
@bartzbeielstein bartzbeielstein deleted the feat/remove-config-task-write-and-window-fallback branch June 7, 2026 18:44
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