fix(config): validate subcategory parent sampler type#628
Conversation
(cherry picked from commit ec9eeea) Signed-off-by: Johnny Greco <jogreco@nvidia.com>
Greptile SummaryTightens the
|
| Filename | Overview |
|---|---|
| packages/data-designer-config/src/data_designer/config/data_designer_config.py | Extends subcategory-parent validator to reject non-category sampler parents with a precise error message; logic is correct and handles both non-sampler and wrong-sampler-type parents distinctly. |
| packages/data-designer-config/tests/config/test_data_designer_config.py | Adds a regression test for a subcategory column whose parent is a uniform sampler; regex matches the actual error message emitted by the updated validator. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[_validate_subcategory_parents] --> B{column_type == 'sampler'\nAND sampler_type == SUBCATEGORY?}
B -- No --> C[skip]
B -- Yes --> D[lookup parent by col.params.category]
D --> E{parent found?}
E -- No --> F[defer to schema validator]
E -- Yes --> G{parent.column_type == 'sampler'\nAND parent.sampler_type == CATEGORY?}
G -- Yes --> H[valid ✓]
G -- No --> I{parent.column_type == 'sampler'?}
I -- Yes --> J[error: sampler column with wrong sampler_type]
I -- No --> K[error: non-sampler column type]
Reviews (1): Last reviewed commit: "validate subcategory parent sampler type" | Re-trigger Greptile
PR #628 Review —
|
andreatgretel
left a comment
There was a problem hiding this comment.
LGTM. Nice follow-up to my recent PR - this makes the config validator match the error message by rejecting non-category sampler parents too.
📋 Summary
This PR tightens
DataDesignerConfigvalidation so subcategory sampler parents must be category samplers, not just any sampler column. This matches the existing error message and prevents invalid configs from pairing subcategory sampling with non-category parent values.🔗 Related Issue
N/A — split out from plugin catalog PR review cleanup.
🔄 Changes
sampler_typeis notcategory.subcategorycolumn whose parent is auniformsampler.🧪 Testing
uv run --package data-designer-config pytest packages/data-designer-config/tests/config/test_data_designer_config.py -quv run ruff format --check packages/data-designer-config/src/data_designer/config/data_designer_config.py packages/data-designer-config/tests/config/test_data_designer_config.pyuv run ruff check --output-format=full packages/data-designer-config/src/data_designer/config/data_designer_config.py packages/data-designer-config/tests/config/test_data_designer_config.py✅ Checklist