fix(engine): validate processor plugin impls#609
Conversation
Greptile SummaryThis PR refactors
|
| Filename | Overview |
|---|---|
| packages/data-designer-engine/src/data_designer/engine/testing/utils.py | Table-driven refactor of assert_valid_plugin; adds Processor validation and module-level PluginType completeness guard. Logic is correct and future-safe. |
| packages/data-designer-engine/tests/engine/testing/test_plugin_testing_utils.py | New parametrized test suite covering all three plugin types for both valid and invalid impl checks, plus a targeted regression test for TaskButNotProcessor. Coverage is complete and assertions are well-scoped. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[assert_valid_plugin called] --> B{config_cls subclass of ConfigBase?}
B -- No --> C[raise AssertionError: config not ConfigBase]
B -- Yes --> D[lookup implementation_base\nfrom _PLUGIN_IMPLEMENTATION_BASES]
D --> E{impl_cls subclass of\nimplementation_base?}
E -- No --> F[raise AssertionError: wrong impl base]
E -- Yes --> G[validation passes]
subgraph "Module import guard"
H[utils.py imported] --> I{_PLUGIN_IMPLEMENTATION_BASES\ncovers all PluginType members?}
I -- No --> J[raise AssertionError at import time]
I -- Yes --> K[module ready]
end
subgraph "_PLUGIN_IMPLEMENTATION_BASES"
L[COLUMN_GENERATOR → ConfigurableTask]
M[SEED_READER → SeedReader]
N[PROCESSOR → Processor]
end
Reviews (5): Last reviewed commit: "test(engine): require plugin base map co..." | Re-trigger Greptile
Review of PR #609 —
|
e466d03 to
8f2b375
Compare
Add the processor implementation base to assert_valid_plugin so processor plugins are checked against Processor instead of only the generic config contract. Keep plugin type validation table-driven and raise explicit AssertionError messages so checks are not skipped under optimized Python. Signed-off-by: Johnny Greco <[email protected]>
8f2b375 to
1b110f2
Compare
|
Addressed the optional follow-ups:
Validation run locally:
CI is green for the substantive checks after the update. |
|
(posting as a regular comment because GitHub is currently failing new inline review threads, see status) nit on |
andreatgretel
left a comment
There was a problem hiding this comment.
LGTM! added one nit only for future-proofing.
|
All contributors have signed the DCO ✍️ ✅ |
|
@andreatgretel good call, addressed in ef37911. I added the coverage check after |
c72f2cd to
ef37911
Compare
📋 Summary
assert_valid_pluginnow validates processor plugin implementations against theProcessorbase class. This catches malformed processor plugins before they reach the processor registry and keeps plugin-type implementation checks in one maintainable mapping.🔗 Related Issue
N/A
🔄 Changes
PluginType.PROCESSORimplementation validation inengine/testing/utils.py.assertstatements with explicitAssertionErrorraises so validation still runs under optimized Python.ConfigurableTaskimplementation that is not aProcessorsubclass.🧪 Testing
uv run --package data-designer-engine pytest packages/data-designer-engine/tests --collect-only -quv run --package data-designer-engine pytest packages/data-designer-engine/tests/engine/testing/test_plugin_testing_utils.py packages/data-designer-engine/tests/engine/processing/processors/test_registry.pyuv run --package data-designer-engine ruff check packages/data-designer-engine/src/data_designer/engine/testing/utils.py packages/data-designer-engine/tests/engine/testing/test_plugin_testing_utils.pyuv run --package data-designer-engine ruff format --check packages/data-designer-engine/src/data_designer/engine/testing/utils.py packages/data-designer-engine/tests/engine/testing/test_plugin_testing_utils.py✅ Checklist