Skip to content

Skip the apply_mutators phase when no mutators are configured - #6294

Open
bjornkpu wants to merge 3 commits into
databricks:mainfrom
bjornkpu:skip-apply-mutators-when-none-configured
Open

Skip the apply_mutators phase when no mutators are configured#6294
bjornkpu wants to merge 3 commits into
databricks:mainfrom
bjornkpu:skip-apply-mutators-when-none-configured

Conversation

@bjornkpu

@bjornkpu bjornkpu commented Aug 17, 2026

Copy link
Copy Markdown

Changes

Skip the apply_mutators phase when no mutator functions are configured.

Why

getOpts receives the phase but decides enabled only from whether Python configuration is present. So apply_mutators starts a subprocess even when no mutator functions are declared. That subprocess loads every resource through the databricks-bundles dataclasses and returns them unchanged.

It is not only wasted work. Any resource the dataclasses cannot construct fails the phase, and therefore the command, even though the resource is defined in YAML and nothing was asked to be mutated. A SharePoint file-ingestion pipeline hits this:

TypeError: TableSpec.__init__() missing 1 required keyword-only argument: 'source_table'

source_table is required on TableSpec while a file-ingestion object has no source table. That is a separate problem, filed as #6295. This PR does not fix it. It stops such a bundle from failing in a phase it does not use.

Configuration errors this phase would report are unaffected. load_resources runs first and derives its options the same way.

Tests

Three unit tests on getOpts: apply_mutators with no mutators, with python.mutators, and with experimental.python.mutators.

No acceptance test changes. Nothing under acceptance/ observes this phase, and the output is identical either way, since the subprocess returned its input unchanged.

getOpts already receives the phase but only decides `enabled` from whether
Python configuration is present, so `apply_mutators` starts a subprocess even
when no mutator functions are declared. That subprocess loads every resource
through the databricks-bundles dataclasses and returns them unchanged, so the
work is wasted for bundles that use `python.resources` without
`python.mutators`.

It is also not harmless. Any resource the generated dataclasses cannot
construct fails the whole phase, and therefore the whole command, even though
the resource is defined in YAML and the user asked for nothing to be mutated. A
SharePoint file-ingestion pipeline hits this because TableSpec.source_table is
required while a file-ingestion object has no source table:

    TypeError: TableSpec.__init__() missing 1 required keyword-only argument:
    'source_table'

Configuration errors this phase would report are unaffected, because
load_resources runs first and derives its options the same way.
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/bundle/ - needs approval

Files: bundle/config/mutator/python/python_mutator.go, bundle/config/mutator/python/python_mutator_test.go
Suggested: @denik
Also eligible: @janniklasrose, @pietern, @andrewnester, @lennartkats-db, @shreyas-goenka, @anton-107

General files (require maintainer)

Files: .nextchanges/bundles/skip-apply-mutators-without-mutators.md
Based on git history:

  • @denik -- recent work in .nextchanges/bundles/

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.

@github-actions

Copy link
Copy Markdown
Contributor

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 6294
  • Commit SHA: eef1600cefd9b21736a72c32b1cb8e0f9a4e02ba

Checks will be approved automatically on success.

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.

1 participant