Minor refactoring of PyDABs autogen code - #6575
Merged
Merged
Conversation
- Use _STAGE_RANK.get(prop.stage, 0) so an unknown/absent launch stage is treated as GA instead of raising KeyError and killing codegen. - Route _synth_ref's module resolution through _module_of to avoid duplicating the get_package + assert logic. - Add __test__ = False to TestCase so pytest stops trying to collect it. Co-authored-by: Isaac <no-reply@databricks.com>
The four GeneratedField branches differed in only a couple of kwargs; build one base field and override the per-branch deltas via replace(), keeping pyright's type checking intact. Co-authored-by: Isaac <no-reply@databricks.com>
generate_type only models dict[str, str]; any other map ref (map/int, map/<object>) previously fell through and silently generated the bare value type instead of a dict. Fail loudly instead, matching the guard in generated_test_cases._synth_ref. Co-authored-by: Isaac <no-reply@databricks.com>
Collaborator
Integration test reportCommit: 4bbdf6c
Top 6 slowest tests (at least 2 minutes):
|
Sankalp-Mittal
marked this pull request as ready for review
September 9, 2026 08:10
Renaming avoids pytest trying to collect it as a test class (its name no longer starts with "Test"), so the __test__ = False marker is no longer needed. Addresses review nit. Co-authored-by: Isaac <no-reply@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Minor follow-up refactoring on the PyDABs autogen code, addressing non-blocking review comments left on earlier PRs (#6421, #6528).
Details
generate_typeagainst unsupported map refs: onlydict[str, str]is modelled today; any other map ref (map/int,map/<object>) previously fell through and silently generated the bare value type instead of a dict. It now fails loudly, matching the existing guard ingenerated_test_cases._synth_ref.create_func_type_name/create_func_defaultfields (and the now-orphanedoptional_typehelper): scaffolding for a staticcreate()factory that was never implemented — set but never read since codegen was first added.generate_field: collapse the four near-duplicateGeneratedField(...)branches into one base value plus per-branchdataclasses.replace(...)deltas.TestCase→ResourceTestCase: pytest no longer tries to collect it as a test class (its name no longer starts withTest), so the__test__ = Falsemarker is unnecessary. The rename propagates throughtest_case.py.tmplintotest_resources.pyand the generated per-resource files.KeyErroron an unknown launch stage: use_STAGE_RANK.get(prop.stage, 0)instead of a bare dict lookup, so an absent/unknown stage is treated as GA rather than killing codegen (matches the GolaunchStageRanksemantics)._synth_ref's module lookup through_module_ofto drop the duplicatedget_package(...) + assertlogic.All changes are behavior-preserving: regenerating the PyDABs output produces a byte-identical tree (aside from the
ResourceTestCaserename propagating into the generated files). Codegen unit tests (38) andtest_resources.py(232) pass.Supersedes #6573 (auto-closed when the stack it was based on merged to
main).This pull request and its description were written by Isaac.