Skip to content

PyDABs: support interface{} fields (cluster_policies, dashboards, genie_spaces) - #6585

Open
Sankalp-Mittal wants to merge 15 commits into
mainfrom
sankalp-mittal/pydabs-support-interfaces
Open

PyDABs: support interface{} fields (cluster_policies, dashboards, genie_spaces)#6585
Sankalp-Mittal wants to merge 15 commits into
mainfrom
sankalp-mittal/pydabs-support-interfaces

Conversation

@Sankalp-Mittal

Copy link
Copy Markdown
Collaborator

What

Adds PyDABs (Python) support for Go interface{} fields and onboards the three resources that were denylisted solely because of them: cluster policies, dashboards, and Genie spaces (definition / policy_family_definition_overrides, serialized_dashboard, serialized_space).

How

interface{} (schema ref #/$defs/interface) is modelled as typing.Any, following the same PRIMITIVES + RENAMES pattern already used for time.Time:

  • Codegen"interface" is a terminal primitive renamed to Any, so get_package returns None (no crash, no bogus AnyParam) and the import header gains Any.
  • Runtime_transform passes an Any-typed value through unchanged; there is no schema to normalize against. Validation (string or map) stays on the Go side in the existing configure_* config mutators.
  • Test synth_synth_scalar emits a fixed value for interface fields.

The RESOURCE_DENYLIST is kept (now empty) as the escape hatch for future resources that hit an unmodellable type.

Acceptance coverage

Each new resource has a <plural>-support/ fixture that exercises both authoring forms of the interface field: an inline map (YAML instance) and a serialized JSON string (Python instance). The golden shows them converging — the map is marshalled to a JSON string, the string passes through. This convention is documented in acceptance/bundle/python/README.md and the pydabs-acceptance-tests rule so future interface types are covered the same way.

Testing

  • databricks_tests unit suite (incl. _transform Any passthrough and the coverage guard), pyright, and the three acceptance tests all pass.
  • pydabs-codegen is idempotent on top of main.

This pull request and its description were written by Isaac.

Sankalp-Mittal and others added 15 commits September 9, 2026 12:45
interface{} fields will be generated as `Any`. There is no schema to
normalize against, so _transform must return the value unchanged;
otherwise it falls through to the "Unexpected type" error. Validation of
the value (string or map) stays on the Go side in the config mutators.

Co-authored-by: Isaac <no-reply@databricks.com>
Model interface{} fields (schema ref #/$defs/interface) as typing.Any,
following the same PRIMITIVES + RENAMES pattern used for time.Time:

- PRIMITIVES treats "interface" as a terminal type, so get_package returns
  None (no package split crash, no bogus AnyParam) and the reachability
  walk stops there.
- RENAMES maps it to "Any"; the generated-module import header gains Any
  (lint trims it where unused).
- _synth_scalar emits a fixed inline dict for interface fields, so a future
  required interface field has a value instead of crashing the generator.

No generated output changes yet; the resources with these fields are still
denylisted.

Co-authored-by: Isaac <no-reply@databricks.com>
These three resources were denylisted only because they carry interface{}
fields (definition, policy_family_definition_overrides,
serialized_dashboard, serialized_space). Now that interface{} generates as
Any, remove them from the denylist and regenerate.

The denylist itself is kept (empty) as the escape hatch for future
resources that hit an unmodellable type.

Co-authored-by: Isaac <no-reply@databricks.com>
…paces

Each fixture covers both authoring forms of the interface{} field: a YAML
instance sets it as an inline map, a Python instance sets it as a
serialized JSON string. The golden shows both converging to a JSON string
(the Go config mutator marshals the map; the string passes through).

Satisfies test_python_support_coverage, which requires one acceptance
fixture per PyDABs resource.

Co-authored-by: Isaac <no-reply@databricks.com>
Document that a fixture for a resource with an interface{}/Any field must
exercise both authoring forms (inline map in YAML, serialized JSON string
in Python), so every future interface type is covered the same way.

Co-authored-by: Isaac <no-reply@databricks.com>
PR link to be appended when the PR is opened.

Co-authored-by: Isaac <no-reply@databricks.com>
Regenerated public_api.txt to include add_cluster_policy / add_dashboard /
add_genie_space and the cluster_policy_mutator / dashboard_mutator /
genie_space_mutator decorators.

Co-authored-by: Isaac <no-reply@databricks.com>
Passing typing.Any as the `cls` argument (and as Variable.type) is
intentional in these tests but not expressible in the type signature.

Co-authored-by: Isaac <no-reply@databricks.com>
Main renamed the generated TestCase to ResourceTestCase; regenerate the
three new resources' test-case files so they match.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
A dict and a serialized JSON string take different _transform paths, so an
acceptance fixture must exercise both through add_<singular> (two Python
instances). Covering only one leaves the other path silently brittle. The
YAML instance exercises the loader, not the Python Any path, so it does not
substitute for either.

Co-authored-by: Isaac <no-reply@databricks.com>
Each fixture now adds a third instance (my_<name>_3) that passes the
interface field as an inline dict through add_<singular>, alongside the
existing serialized-string instance. The golden shows the dict marshalled
to the same compact JSON string, exercising the Any passthrough end to end.

Co-authored-by: Isaac <no-reply@databricks.com>
Spread the inline-dict instances across lines (trailing commas keep them
exploded through ruff) so the structured-dict case reads as visibly
distinct from the flat serialized-string case. No behavior change; goldens
are unchanged.

Co-authored-by: Isaac <no-reply@databricks.com>
@Sankalp-Mittal
Sankalp-Mittal marked this pull request as ready for review September 9, 2026 13:19
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

22 files changed
Suggested: @denik
Also eligible: @janniklasrose, @andrewnester, @shreyas-goenka, @anton-107, @lennartkats-db, @pietern

General files (require maintainer)

37 files changed
Based on git history:

  • @denik -- recent work in .nextchanges/bundles/, python/databricks/bundles/core/, python/codegen/codegen/

Any maintainer (@andrewnester, @anton-107, @denik, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db, @janniklasrose, @lennartkats-db, @rugpanov, @rclarey) can approve all areas.
See OWNERS for ownership rules.

@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

Integration test report

Commit: 7803a1a

Run: 34355675843

Env ✅​pass 🙈​skip Time
✅​ aws linux 276 18 6:25
✅​ aws windows 278 16 4:49
✅​ azure linux 275 18 7:20
✅​ azure windows 277 16 5:36
✅​ gcp linux 276 18 8:30
✅​ gcp windows 278 16 5:51
Top 6 slowest tests (at least 2 minutes):
duration env testname
3:50 aws windows TestAccept
3:47 gcp windows TestAccept
3:41 azure windows TestAccept
2:16 azure linux TestAccept
2:16 gcp linux TestAccept
2:06 aws linux TestAccept

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants