Skip to content

Move cluster policy matcher and loader to libs/clusterpolicy - #7409

Merged
ilyakuz-db merged 3 commits into
mainfrom
clusterpolicy-shared-matcher-loader
Nov 10, 2026
Merged

ilyakuz-db merged 3 commits into
mainfrom
clusterpolicy-shared-matcher-loader

Conversation

@ilyakuz-db

@ilyakuz-db ilyakuz-db commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Changes

Follow-up to #7170. The parts of the cluster policy handling that encode the policy definition language move from bundle/configsync into libs/clusterpolicy:

  • Definition.IsPolicyValue(path, value, applyDefaults): whether the value of a cluster attribute comes from the policy (fixed rules, opted-in defaults, indexed-over-wildcard precedence, dotted map keys, log-delivery aliases).
  • Loader / LookupError: reads effective definitions by ID over compute.ClusterPoliciesInterface and caches definitions and failures for its lifetime.

configsync keeps the sync-specific reconciliation (filterChanges, prune, authored-vs-remote checks) and the SkippedChange mapping. No behavior change.

Why

Other callers can rely on the shared matcher and loader instead of reimplementing policy semantics, and configsync no longer owns policy-language knowledge.

Tests

Moved code is covered by the existing configsync unit tests and the config-remote-sync / resources/jobs/cluster_policy acceptance tests, which pass unchanged. Added unit tests for IsPolicyValue (rule precedence, map wildcard exclusion, aliases) and Loader caching.

This pull request and its description were written by Isaac.

Co-authored-by: Isaac <no-reply@databricks.com>
@ilyakuz-db
ilyakuz-db requested review from a team as code owners November 9, 2026 14:18
@github-actions github-actions Bot added the DABs DABs related issues label Nov 9, 2026
ilyakuz-db and others added 2 commits November 9, 2026 14:28
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@eng-dev-ecosystem-bot

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 0b09b08

Run: 42636321476

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 271 15 5:44
✅​ aws-windows-latest-4core-16gb 273 13 4:10
✅​ azure linux-2core-8gb 270 15 5:07
✅​ azure-windows-latest-4core-16gb 272 13 3:49
✅​ gcp linux-2core-8gb 271 15 5:56
✅​ gcp-windows-latest-4core-16gb 273 13 5:05
Top 3 slowest tests (at least 2 minutes):
duration env testname
2:55 aws-windows-latest-4core-16gb TestAccept
2:51 gcp-windows-latest-4core-16gb TestAccept
2:27 azure-windows-latest-4core-16gb TestAccept

@pietern pietern left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mention the testserver, but it doesn't yet use this lib.

Is there opportunity to do so and reduce custom code in the testserver?

@ilyakuz-db

ilyakuz-db commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor Author

You mention the testserver, but it doesn't yet use this lib.

Is there opportunity to do so and reduce custom code in the testserver?

I think the PR description sounds more ambitious than this PR has to offer 🙂 I'll update the description

I checked what else can be reused, not too much, as remaining policy helpers are spec-to-policy (spec is cluster config, policy is the set of spec attributes), and the testserver is mostly interested in policy-to-spec

@ilyakuz-db
ilyakuz-db added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit d1fd7f0 Nov 10, 2026
27 checks passed
@ilyakuz-db
ilyakuz-db deleted the clusterpolicy-shared-matcher-loader branch November 10, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants