Repository navigation
Conversation
Importing data_designer.engine.models.errors or .registry as the first Data Designer import in a process raised ImportError: errors.py loads the clients package, whose factory imported FormattedLLMErrorMessage back from the still partially initialized errors.py. Move FormattedLLMErrorMessage into engine/models/utils.py, which does not import the clients package, and import it from there in both clients/factory.py and models/errors.py. errors.py still exposes the name, so existing imports keep working. Fields and formatting are unchanged. Add fresh-process import tests for models.errors and models.registry, check that both import paths give the same class and that the clients package still exports create_model_client, and pin the exact type and text of the unsupported-provider error. Fixes NVIDIA-NeMo#990 Signed-off-by: Yashvardhan Thanvi <[email protected]>
|
All contributors have signed the DCO ✍️ ✅ |
|
I have read the DCO document and I hereby sign the DCO. |
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryMoves
|
|
Thanks for putting this together, @Thanatos9404! SummaryMoving FindingsNo actionable findings. What Looks Good
Residual RiskValidation covered 122 targeted tests across import order, client factory, model errors, utilities, registry, and lazy imports; all passed. Ruff lint and formatting checks passed for all five changed files. An additional ten-pass review exercised all 741 model tests: 739 passed in the sandbox, and the two tests blocked by loopback socket permissions passed on rerun with permission. All 41 model modules imported first in fresh processes, all 24 tested import-order permutations passed, and formatter equivalence and legacy pickle checks passed. The full repository suite was not run. The PR head was reconfirmed before posting. A focused security review found no issues introduced by this patch: no dependency or workflow changes, new credential access, outbound requests, or shell execution. VerdictShip it — no changes requested. This review was generated by an AI assistant. |
📋 Summary
Importing
data_designer.engine.models.errorsordata_designer.engine.models.registryas the first Data Designer import in a fresh process raisesImportError, becauseclients/factory.pyimportsFormattedLLMErrorMessageback frommodels/errors.pywhileerrors.pyis still loading theclientspackage. This movesFormattedLLMErrorMessageintoengine/models/utils.py, following the approach in the issue, so that back edge goes away and every import stays at module level.🔗 Related Issue
Fixes #990
🔄 Changes
FormattedLLMErrorMessagefromengine/models/errors.pytoengine/models/utils.py, which does not import theclientspackage. Fields and__str__are unchanged; the only addition is a one-line docstring.engine/models/utils.pyin bothengine/models/clients/factory.pyandengine/models/errors.py.errors.pykeeps the name, sofrom data_designer.engine.models.errors import FormattedLLMErrorMessagestill works.tests/engine/models/test_import_order.py: fresh-subprocess imports ofmodels.errorsandmodels.registry, a check that both import paths give the same class, and a check that theclientspackage still exportscreate_model_client.test_unknown_provider_type_raises_data_designer_errornow pins the exact error type (DataDesignerError) and the full formatted message.🧪 Testing
Before the fix (main at 7760799 with only the new tests applied):
Both fresh-process imports fail with the
ImportErrorfrom the issue, and the identity check fails becauseutilshas noFormattedLLMErrorMessageyet. The export, unsupported-provider and health-check tests pass before and after, as guards.With the fix, the same command gives
6 passed.Importing every module under
packages/*/srcas the first import in its own fresh process: 2 of 312 fail on main (models.errorsandmodels.registry), 0 of 312 on this branch.No inline imports were added,
create_model_clientis still exported fromdata_designer.engine.models.clients, and the health-check import regression inpackages/data-designer/tests/test_lazy_imports.pyis unchanged and still passes.import data_designer.configplusfrom data_designer.interface import DataDesignerloads the same 1783 modules on main and on this branch.make check-allandmake testpass locally, apart from 8 tests that fail the same way on main in my environment (7 needjq,test_import_perf.pytimed out).make testpasses (apart from the 8 environment-only failures above, which also fail on main locally)✅ Checklist
triaged