fix(interface): don't leak YAML default provider into user-supplied list#591
Conversation
When a caller passes ``model_providers`` to ``DataDesigner.__init__``, the YAML's ``default:`` key from ``~/.data-designer/model_providers.yaml`` was still being applied to the resulting ``ModelProviderRegistry``. This caused two related problems: 1. Hard failure: if the YAML default named a provider absent from the user-supplied list, construction raised ``ValidationError: Specified default 'X' not found in providers list``. 2. Silent override: if the YAML default matched a non-first user-supplied provider, the documented "first wins" behavior was silently overridden. Gate the YAML lookup on ``model_providers is None`` so that user-supplied lists own their own default. Also expose ``model_provider_registry`` and ``run_config`` as public read-only properties on ``DataDesigner``, paired with the existing ``secret_resolver`` property and ``set_run_config`` setter; tests now use these instead of the underscore-prefixed attributes. Closes #588. Made-with: Cursor
Greptile SummaryThis PR fixes a bug where
|
| Filename | Overview |
|---|---|
| packages/data-designer/src/data_designer/interface/data_designer.py | Core fix: gates YAML default provider lookup on model_providers is None; adds model_provider_registry and run_config public properties — logic is correct and well-commented. |
| packages/data-designer/tests/interface/test_data_designer.py | Three new regression tests pin both failure modes from #588 and the unchanged YAML-fallback path; existing tests updated to use public run_config property instead of _run_config. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[DataDesigner.__init__ called] --> B{model_providers is None?}
B -- Yes --> C[resolve from YAML providers list]
C --> D[get_default_provider_name from YAML]
D --> E[resolve_model_provider_registry with YAML default]
B -- No --> F[use caller-supplied providers list]
F --> G[default_provider_name = None, first wins]
G --> H[resolve_model_provider_registry, default=None]
E --> I[ModelProviderRegistry ready]
H --> I
Reviews (2): Last reviewed commit: "fix(interface): tighten model_provider_r..." | Re-trigger Greptile
Code Review: PR #591 —
|
|
Thanks for the thorough write-up on this one, @nabinchha — the issue analysis in #588 made the fix easy to verify against intent. SummaryThe PR gates the YAML FindingsSuggestions — Take it or leave it
What Looks Good
VerdictShip it (with nits). Fix is correct, minimal, and well-tested. The suggestions above are all optional polish. This review was generated by an AI assistant. |
…allback path Address review feedback on PR #591: - Clarify ``model_provider_registry`` docstring so it reflects the full fallback chain: user-supplied first → YAML default (when set) → first provider in the YAML list. - Add ``test_init_no_user_providers_uses_yaml_default`` to lock the YAML-fallback contract that the #588 fix preserved but didn't pin. Made-with: Cursor
|
Thanks for the review @johnnygreco — pushed 5a9fc27 addressing the two suggestions I took:
Skipped:
|
Summary
Fix for #588.
`DataDesigner.init` was always reading the `default:` key from `~/.data-designer/model_providers.yaml` and applying it to the runtime `ModelProviderRegistry` — even when the caller supplied their own `model_providers` list. That caused:
This PR gates the YAML lookup on `model_providers is None` so a user-supplied list owns its own default. It also exposes `model_provider_registry` and `run_config` as public read-only properties on `DataDesigner`, paired with the existing `secret_resolver` property and `set_run_config` setter.
Changes
No public-API removal or breaking changes — only the two new `@property` additions.
Test plan
Made with Cursor