[Bug]: controller: include the unset sweep_config state in its return annotation
Describe the bug
The controller returned by wandb.controller() declares sweep_config -> dict | sweeps.SweepConfig, but returns None during its supported deferred-creation lifecycle. This remains true after configuring search and metric, before a sweep has been created/read.
The constructor initializes the backing field to None and explicitly supports deferred creation. The public property returns that state unchanged. The adjacent sweep_id property already includes None.
Local reproduction
Install the optional sweeps package. The API factory below is simulated to avoid authentication; no controller fields or methods are replaced and no API methods are called.
from unittest.mock import patch
import inspect
import wandb
with patch("wandb.Api") as api:
controller = wandb.controller()
print(inspect.signature(type(controller).sweep_config.fget))
print(controller.sweep_config)
controller.configure_search("random")
controller.configure_metric("loss")
print(controller.sweep_config)
assert not api.return_value.method_calls(self) -> 'dict | sweeps.SweepConfig'
None
NoneMypy accepts wandb.controller().sweep_config.get("metric"), which fails in this supported state.
Expected behavior
Represent the unset state in the property's return contract, without requiring creation of a remote sweep just to inspect a newly configured controller.
Environment
- W&B SDK: 0.30.0; also reproduced on main
8f93d444e29e4d1a50a888899f51051012ee2679 - Python: 3.12.12; sweeps: 0.2.0; mypy: 2.3.1
- OS: macOS 26.1, arm64
- W&B server: not applicable to local checks
Source: wandb/wandb