Skip to content

feat(plan): bind dbt projects and refuse what apply would refuse - #1188

Merged
fas89 merged 19 commits into
mainfrom
feat/databricks-plan-dbt-checks
Dec 5, 2026
Merged

fas89 merged 19 commits into
mainfrom
feat/databricks-plan-dbt-checks

Conversation

@fas89

@fas89 fas89 commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Five Databricks and dbt changes, one commit or two each, in this order: the dbt job's per-rule report, the dbt job refusals' fixes, a fluid verify hint for dbt-built tables, fluid plan binding each dbt build's project, and fluid plan refusing what apply's OpenTofu emitter refuses. A sixth section lists a set of small CLI fixes around Databricks. Each was built and checked on its own first; this PR carries them together on current main. It includes the change from #1169 (closed), unchanged.

1. The dbt job's per-rule report says what it knows (fix)

After fluid apply --mode amend-and-build runs a Databricks dbt job, forge reports each contract rule from the dbt task's output. Two things in that report were wrong:

  • Unread output was blamed on dbt. When reading the dbt task's output (runs/get-output) failed after a run that succeeded, or after the dbt task passed and a later task failed, the error was dropped and the rules were reported from empty logs as "dbt stopped before running them". The report now says the output could not be read, with the (scrubbed, bounded) error, and that the run page lists each rule, as the failed-task path already did. A build with no contract rules prints nothing new.
  • A model line could give a rule its status. The report read any N of M <STATUS> <word> line as a test result, so ERROR creating sql table model main.orders or SKIP relation main.downstream gave a status to a test named creating or main. A result now counts only when the test name is followed by dbt's padding (dots, or the bracketed status), as dbt prints a test line.

Known limit: names with dots, hyphens or :: (singular tests, unit test versions) were never read and still are not; contract rule tests are named fluid_dq_<id>, so the rules are unaffected.

2. Two dbt job refusals name a fix that works (fix)

  • Local project problems with contract rules. A local dbt project too big for the workspace upload, or holding a file the upload cannot take (a link, an unreadable file, a file over the size cap, a *-paths entry outside the project), was told to use a Git source even when the build runs contract rules as dbt tests, which a Git checkout cannot take. With rules, the fix now says to upload fewer files, or to use a Git source and remove the contract rules from the tables the build writes. A build without rules keeps the Git source advice.
  • A project that fits only without its tests is told so, and a project over the limit alone is refused once instead of twice.
  • A selection that leaves the tested model out said "Select the model: properties.select: [m] (or properties.model)", which left the required properties.model of a hybrid-reference build unset. Now: "Add 'm' to properties.select, or drop properties.select.", and "Set properties.model to 'm' ..." first when it is missing.

A second commit corrects the planned_objects docstring: fluid diff reads it, fluid plan on a 0.7 contract does not.

3. fluid verify says where a dbt-built Databricks table's NOT NULL belongs (fix)

dbt's table materialization rebuilds the table from the model's SELECT, which carries no NOT NULL, and the OpenTofu module leaves a dbt-written table's columns to dbt, so a required: true column of such a table failed the constraints check with no reason and no fix. The finding now says why, names the dbt model (the build's properties.model when that build writes only this table, else the table's name, as the job's rule tests find it), and prints the model properties that keep the constraint: an enforced dbt model contract listing every column with its data_type, not_null on the required ones. The JSON report carries them as dimensions.constraints.hint and dimensions.constraints.dbt_model_yaml, and the hint is the first entry of severity.actions. The grade is unchanged; keys are only added. The text report now prints each action as plain text, since an action can quote a model name from the contract.

Known limits: with both properties.select and properties.model, the hint names properties.model, as the rule tests do; data_type is the contract's type as written, not checked against a live dbt-databricks run.

4. fluid plan of a contract file binds each dbt build's project (feature)

A plan made from a bundle bound the dbt code the bundle packs, but a plan made straight from a contract file bound nothing: a model edited between fluid plan and fluid apply plan.json ran without anyone having planned it.

  • The plan records each dbt build's project. The files dbt reads (dbtProjects, under planDigest) are selected and read as fluid bundle reads them, in the bundle's record shape (a root digest and a sha256 per file).
  • Planning does not fail over a project it cannot bind. A project not where the build runs it, a templated repository, a symbolic link, a file dbt reads in a hidden directory of a local build, a project over the size limits, a dbt build with no id, or two dbt builds sharing an id is recorded as {"unbound": why} with a warning, and the plan is still written. The exception is a dbt build that runs as a Databricks job from a local repository: fluid plan reads that project as apply's upload does, so a missing project, a symbolic link, an unreadable file or a project over the upload's limits fails the plan (exit 1, unsupported_binding), as apply would there. The reason names paths relative to the contract, so two plans of one contract made in two directories carry the same dbtProjects record.
  • fluid apply plan.json checks the checkout before anything runs. A changed, added or removed file is refused (apply_plan_digest_dbt_project_changed), naming paths only, never contents; a missing project is apply_plan_digest_dbt_project_missing; an unbound build, or a plan an older fluid made for a contract with a dbt build, is apply_plan_digest_dbt_project_unbound ("re-run fluid plan"). The gate runs in every apply mode, as the bundle's does.
  • Checked again at use. The dbt runner compares the directory dbt is about to read, and the Databricks job upload re-checks the bytes it reads (databricks-job-project-changed), for a bundle too. A Databricks job dbt build with a local repository is bound whatever its pattern, on both routes, and the upload refuses a project nothing bound while a binding is active.
  • A dry run warns instead of refusing: fluid apply plan.json --dry-run runs no dbt and uploads nothing, and fluid forge makes the dbt project after the plan. A real apply, the bundle route and every other binding check are unchanged.
  • --no-verify-plan-binding skips the gate with the existing warning. dbt_project.yml is read without blocking, so a FIFO in its place cannot hang fluid plan.

Hosts that plan in a temporary directory: a host that plans each contract alone in an empty temporary directory now records its dbt builds as unbound; a dbt build that runs as a Databricks job from a local repository fails the plan there (databricks-job-project-missing), as apply would. A host that applies contract files, never a stored plan.json, meets none of the apply_plan_digest_dbt_project_* refusals. Re-planning with inject_digests(force=True) and no bundle keeps the plan's dbtProjects.

Known limits: a plan applied from a checkout at another path than the one fluid plan ran in is refused (dbt-project-missing); a templated repository is recorded unbound and refused at apply, as fluid bundle refuses it; every apply mode refuses an unbound dbt project, a mode that runs no dbt included, as the bundle route does; a plan made by this fluid for a contract with a dbt build is refused by an older fluid's fluid apply plan.json (binding-mode-mismatch), so a plan job and an apply job need the same fluid version.

5. fluid plan refuses what apply's OpenTofu emitter refuses (feature)

fluid plan of a contract that fluid apply would refuse wrote a plan.json anyway; the refusal came only at apply, after review. Now fluid plan runs, before it writes plan.json, the refusals apply's OpenTofu emitter raises, for every provider that applies through OpenTofu.

  • A refusal fails the plan. Exit 1 with the error apply gives (unsupported_binding, its kind and fix), and no plan.json.
  • A refusal that depends on where apply runs is a warning: an unset DATABRICKS_WAREHOUSE_ID, an operator allowlist that does not list what the contract names, an unset FLUID_SPARK_GLUE_JARS_URL, or any refusal while a {{ env.* }} value is not set where the plan runs. The warning says what apply needs ("apply refuses unless ... is set"). plan.json keeps the placeholders as written.
  • A Spark setting or broker no operator list can allow, and a plan the provider's own validator rejects, fail the plan as they fail apply (plan_spark_refused, planner_failed).
  • Offline and in memory. Apply's own emit runs with no state backend, no tofu, no files. AWS uses a placeholder account (no STS), GCP looks up no Application Default Credentials, credentials come from the environment only (no keyring, no secret store), and the native provider's own log lines stay out of plan's output. A provider plugin may offer emit_refusals(contract), which reports its refusals without building the module: Databricks does, so the check reads no keys and runs no SQL.
  • A refusal the contract decides wins over one an unset variable causes. The plan reports the first refusal the emitter raises. For AWS, an unset FLUID_SPARK_GLUE_JARS_URL (a Glue build that decodes Avro) was raised while the Spark blocks were built, before the exposes or a later build were read, so a contract that also had a refusal of its own got a warning at plan and that refusal only at apply. The unset prefix is now raised last, by emit and emit_data, after every refusal the contract decides; a contract with only the unset prefix is still a warning.
  • Nothing else changes for apply. Apply's call to emit_module is the one it always made; streaming plans and fluid plan --tofu skip the check; any other error in the check is a warning and the plan goes on. A --provider that does not match the contract now fails the plan, as it fails apply.

For tools that run fluid plan: a pull-request job that plans each changed contract now shows a refused contract as a failed plan (exit 1, no plan.json). Nothing in plan.json changes shape.

Known limits: one unset {{ env.* }} value anywhere in the contract turns every refusal into a warning (apply still refuses); Databricks' refusals skip the sovereignty check that emit runs, which plan's own sovereignty check covers.

6. Smaller CLI fixes around Databricks (fix)

Each corrects a message or an order of checks; none changes what a valid contract does.

  • The job upload sizes each file before it reads it. It read every selected file (up to 64 MiB each) and only then compared it with its own 2 MiB limit, and kept reading after the project had passed the file and byte caps. It now takes each file's size without following links, refuses a file over the limit without opening it, and stops at the first file that would pass the file or byte cap, with one project-size refusal and no partial project. A file that cannot be examined gets the project-unreadable refusal a read error gets.
  • fluid test --results-alert checks a folder's permissions before it makes the folder. When the alert did not exist, the folder was made first and its permissions read after, so a folder that a group of every workspace user can edit (inherited from a parent) was left behind when the run was refused. It now finds the nearest folder that exists, applies the same rule to it, and makes the folder only when that passes. The refusal names the folder asked for and the parent whose permissions it would inherit. An existing folder is checked as before.
  • The shared-folder refusal stops advising a permission change. For /Workspace/Shared, which is refused by its path, taking edit rights away from the users groups cannot work; the guidance now points only at a folder the CI identity alone can edit. The permission-based refusal keeps its own advice, and the generated error reference follows.
  • fluid doctor's Databricks row no longer prints a period before the semicolon: a refused credential's text ends with one.
  • A dbt_project.yml value that is not text is named by its type. Messages about a path entry, an output directory or a build's repository printed the value, which echoes a large nested list or mapping; they now say a list, a mapping or an integer. A Databricks job build with a local repository is decided by the job rule before its pattern and properties types are read; valid contracts behave as before.
  • A project file's Databricks host over an operator profile. When a project dotenv file's DATABRICKS_HOST is ignored because the environment sets DATABRICKS_CONFIG_PROFILE, the warning now also says the profile can be unset for this run, so the project file's own host and credential are used.
  • A preflight failure repeats only an upper-case API error code (PERMISSION_DENIED). A refusal kind keeps its lower-case dash-joined shape, and anything else names the exception class alone. fluid diff prints the same text when it cannot read a Databricks table, so it follows.

On current main

  • fluid plan writes the cost-attribution block and then the dbt project record, both under planDigest, before the digests are taken.
  • The compatibility gate compares both sides' plans without the attribution keys, and accepts a planDigest that moved only by dbtProjects when the plan without that key digests to the old one; every other difference still fails.

Borrow

  • Report lines: dbt-core 1.10.latest core/dbt/events/types.py (the message formats of test, model, seed, snapshot, skip, freshness and hook lines); dbt-common format_fancy_output_line (dot padding, then [STATUS]); the repo's failed-task path in build_runners/_databricks_job_run.py and databricks_enforce.scrub, reused.
  • Refusal fixes: text and one flag on existing refusals; nothing to build or borrow.
  • NOT NULL hint: dbt docs, model contracts and constraints (https://docs.getdbt.com/reference/resource-properties/constraints): dbt adds NOT NULL only under an enforced model contract listing every column with its data type. Repo: databricks_dbt_tests._model, normalize_column_type, yaml.SafeDumper.
  • Plan binding: OpenTofu 1.13.11 (MPL-2.0) and Terraform 1.17.2 (BUSL) saved plans check state only, never the working directory; Atlantis 0.50.0 (Apache-2.0) undiverged checks git state; dbt-core 1.12.7 (Apache-2.0) FileHash selects, never refuses; Pulumi 3.278.0 update plans record no program digest; in-toto attestation v1 has the same per-file shape. The repo's bundle tree root (forge/core/bundle.py::merkle_root) is reused; no new format.
  • Plan-time refusals: repo, reused: the credential resolver's pinned mode (CLI argument, environment, project .env only) through a context variable for the check alone, native_actions(offline=True), contract_source, resolve_env_templates_in_contract(unset="defer"), apply's own emit_module and build_module. Process-wide switches (keyring 25.7.0's null backend, google-auth 2.63.1 NO_GCE_CHECK, botocore 1.44.17 AWS_EC2_METADATA_DISABLED) cannot scope to one check, hence context variables. OpenTofu tofu validate, TFLint 0.66.0 (MPL-2.0, offline by default), AWS CDK 2.278.0 Aspects, Pulumi policy packs, Checkov 3.4.14 and Trivy 0.77.0 check configurations or plans, not the apply engine's own refusals; splitting those into hard and environment-dependent ones is this repo's own.
  • CLI fixes: the repo's read_project_file (no symbolic link, regular files only) is reused after an os.stat, the stat-then-fstat idiom the repo already uses for credential files; the running totals follow read_project_files. Databricks CLI sync and state push, dbt-core and the Terraform archive provider set no per-file cap, so there was nothing to borrow. The folder check reuses check_folder and the workspace folder helpers; the Workspace API's mkdirs creates parents and says nothing of the new folder's access list, objects in a folder inherit its permissions (https://docs.databricks.com/aws/en/security/auth/access-control/), a status read of a missing path answers RESOURCE_DOES_NOT_EXIST (https://docs.databricks.com/api/workspace/workspace/getstatus), and the SDK has no helper for the nearest existing parent or effective permissions.

Validation on this head

  • Failing first: every item's tests were written first and failed on its base (counts in each item's own run: 11, 8, the hint tests plus 2 review fixes, 6 in the last round, 8 of 10 in the last round). The tests of each small CLI fix failed on the code before it, and so did the two ordering tests and the plan test of the AWS change and the fluid diff error-code test.
  • CI lint battery (ruff, dead-code sweep, black 26.10.1, product guardrail, detect-secrets on touched files), bare scripts/mypy_strict.py, both import contracts, license-header and source-fence tests: green on this head.
  • Touched suites on this head, 216 test paths (every file this branch changes, all of tests/iac/test_iac_databricks*, the tests of main's dialect column types change, the AWS, Spark, plan and diff suites, tests/agent_skills, the startup budget, and main's profile-privacy tests), after the rebase: 10,074 passed, 387 skipped, 14 xfailed, 4 failed. The four: two compat-gate cases that also fail on main (fluid bundle --env prints its compile events twice since main's profile-privacy change), an AWS endpoint dotenv test that passes alone, and a dotenv test that needs dbt installed.
  • Full suite (pytest -n 3, under the heavy lock), on this branch before it was rebased onto main's newest commits (the touched suites above ran after the rebase and cover every file where those commits meet this branch): 56,618 passed, 5 failed, 1,104 skipped in 68 minutes. None of the five comes from this change: two duckdb sandbox tests also fail on main on that machine (temp-dir classification), one hypothesis health check ran too slowly under load and passes alone, one AWS endpoint dotenv test passes alone, and one dotenv test needs dbt installed.
  • Perf suite 31 passed, 7 xfailed (startup budget: 317 modules for the slowest help path, budget 328); import cycles 2 passed; compat gate 55 passed. On this head two compat-gate cases (fluid bundle --env printing compile_start and compile_done twice) fail, and fail on main too; they come with the profile-privacy change that main gained since.
  • Quality delta (ripwire --quality-delta: the three-dot diff applied to a fresh worktree of the base; the control, a one-line CHANGELOG edit, exits 0). Measured on this head: the branch exits 2 on 178 rows: a gating row stays in every class below, and none of them is dead code. Production rows (fluid_build/), one by one:
    • _upload_files (complexity 7 to 16, verbosity 43 to 64): the loop holds the per-file size taken from the file entry, the file cap, the byte cap and the read-error path, each its own refusal with its own test; splitting it would spread one set of limits over two functions.
    • check_folder (complexity 12 to 28, verbosity 67 to 90) and ensure_alert (24 to 27): the early parent check is a mode of the same permission rule (a parent that is not a folder, cannot be read or is unclear passes; a plain all-users-edit finding refuses) and the call that picks it. The rule and the refusal text stay shared with the check of an existing folder on purpose.
    • _warn_unpaired_endpoints (complexity 17 to 20, verbosity 58 to 74): the advice for an ignored project host now names every Databricks credential the operator holds that unsetting the profile would leave, a set built from the refusals and a joined list.
    • run of fluid plan (50 to 53): one call each for the dbt project record and the emitter check, placed after the earlier steps and before the digests.
    • emit_module (parameters 4 to 6): gains the offline option that only plan's check passes; apply's call is unchanged.
    • IacProviderPlugin, DatabricksIacPlugin and _GUIDANCE (verbosity +12, +24, +35 lines): the documentation of the two new optional plugin capabilities and the guidance text of the new refusal fixes.
    • _GUIDANCE, _failure, compile_dbt_jobs (churn): lines edited by more than one commit of this branch, since each item was built and reviewed alone and is folded here.
    • env_only_credentials against _operator_supplied_uri, applied_bundle_scope, contract_as_written, destinations_as_written, speaking and use_environment (10 duplication and clone rows): the repo's idiom for a scoped switch (set a context variable, yield, reset in finally). Each switch keeps its own variable and reader; one shared helper would hide that.
    • 3 duplication rows pair the four-line test helper _Refused.__init__ (tests/cli/test_doctor_preflight.py) with existing exception classes' __init__.
      Test rows (145 duplication and clone rows, 2 complexity and 3 verbosity rows), by class: 59 pair _dbx_plain_contract, a small Databricks contract builder in tests/cli/test_plan_emitter_refusals.py, with the small contract builders of about 40 other test modules (dicts of one shape, not copies); 28 pair the small helpers _checkout, _write, _aws_contract and _contract of tests/cli/test_plan_dbt_project_binding.py, tests/forge/test_raw_plan_dbt_projects.py and tests/cli/test_plan_emitter_refusals.py with same-shaped private helpers of other modules; 19 pair the plan-binding tests with unrelated tests that arrange, call and assert a refusal; 26 are single pairs elsewhere; 7 are the dbt job report tests of tests/build_runners/test_databricks_job_run.py against each other; 6 pair the plan route's checks with the bundle route's tests in tests/cli/test_bundle_dbt_project_binding.py (gate_then_edit and five tests: the plan route needs the same checks). No fixture is copied across more than two files, so a shared helper would not remove a row without touching unrelated test modules.
  • Real fluid runs per item (each on its own base): the repro contracts for plan-time refusals exit 1 with no plan.json; a Databricks contract with no warehouse writes plan.json with one warning; AWS, GCP and Snowflake plans print nothing beyond the plan; a model edited after fluid plan is refused by fluid apply plan.json naming the file (real tofu stand-in run); each refusal fix applied alone clears its refusal (fluid validate --offline).
  • Real fluid plan runs for the AWS ordering change, with the environment cleared and only the operator lists set: a Glue Avro build whose contract also has a second expose naming an unknown catalog exits 1, writes no plan.json and names the unknown catalog; the same contract without that expose exits 0 and writes plan.json with one warning that apply needs FLUID_SPARK_GLUE_JARS_URL. The doctor details line and the preflight failure text were run through the real functions: no period before the semicolon, PERMISSION_DENIED repeated, a lower-case token-shaped error code not repeated.
  • Conflicts met when the items were folded onto main, both resolved by hand: (1) in fluid plan the cost-attribution block is written first and then the dbt project record, both before the digests are taken, and the dbt item's own copy of a helper main also carries was dropped (the two were identical); (2) in the compatibility gate test both helper sets are kept, and the two helpers that read a plan (_plan_digest_moved_only_by_dbt_projects, _plan_digest_of) read it without the attribution keys. The branch was then rebased onto newer commits of main twice; the one overlap that needed a hand (the CHANGELOG, where main's dialect column types entry and this branch's dbt project entry sit side by side) kept both, and every commit's change came through unchanged.

Reviews

Each item before this PR:

  • Report lines: verifier pass; defect scan, no critical, high or medium finding.
  • Refusal fixes: verifier blocked once (a fix that did not clear a local project's refusal), fixed and re-checked.
  • NOT NULL hint: verifier pass; defect scan found one high (a model name with Rich markup crashed the text report) and one medium (a build without outputs writing several tables named one model for each), both fixed and re-checked.
  • Plan binding: verifier failed once, fixed, pass; defect scan found one high and three medium, all fixed with tests written first; security review blocked once (a Databricks job dbt build of an embedded-logic or flink_sql pattern was uploaded but never bound; a FIFO named dbt_project.yml hung the plan), fixed, ship; final judge blocked once (CHANGELOG wording), fixed, ship.
  • Plan-time refusals: verifier pass with mutations; security review and judge blocked once (a Snowflake plan read the OS keyring and the secret store; an allowlist key's prefix), fixed, ship; defect scan round 1 four medium, all fixed with tests written first; round 2 nothing new.

This PR as a whole:

  • Combination of the five items on current main: verifier pass; one medium found and fixed (a bundle planned where its checkout is not got each emitter refusal as an exit 1, now a warning, with a failing-first test and a control), two lows fixed. Defect scan round 1: two real findings, both fixed (that bundle case, stale test-coverage rows); three refuted, among them one unset placeholder turning every refusal into a warning, which is a documented tradeoff. Security review: no findings.
  • Small CLI fixes and the AWS ordering change: security review no findings; verifier pass, with each fix's test failing when the fix is taken out; defect scan found two mediums, both fixed with tests written first (a folder check that refused a first run whose parent folder the identity cannot read, and dotenv advice that named only one of several credentials to unset).
  • Final judge: ship, after one round of wording fixes and a re-read of them. The plan's emitter check fails a plan for a Databricks dbt job whose local project is missing, a link, unreadable or over the upload's limits, which the item 4 text said never happens (apply refuses the same contract there); the CHANGELOG, AGENTS.md, that commit message and this body now say so, and a second pass fixed two CHANGELOG sentences that still read as if such a plan were written. No code change was needed. The rest held: the dbt record is covered by planDigest, the apply gate runs before the environment check and the OpenTofu route, a deferred jar prefix is raised by both emit and emit_data, and the early folder check refuses only on a plain edit grant.

Docs

  • forge_docs docs(databricks): plan binds dbt projects and refuses what apply refuses forge_docs#335 (draft) is the docs PR for this change: fluid plan (binds dbt projects; refuses what apply refuses; the environment warnings; an unset Glue jar prefix is reported after the contract's own refusals), fluid apply (the three dbt project refusals, the dry-run warning), fluid verify on dbt-built Databricks tables (the hint and the two JSON keys), the Databricks page (the refusal fixes, the per-rule report wording, the upload's size checks), fluid test (the results-alert folder check order), the credentials page (the profile advice) and the provider plugin guide (emit_refusals, environment_refusals). It merges after this PR.

fas89 added 16 commits December 4, 2026 10:03
After a Databricks dbt job run that succeeded, or whose dbt task passed
before a later task failed, fluid apply dropped the error from reading
the dbt task's output and reported the contract rules from empty logs:
"dbt stopped before running them". It now says the output could not be
read, with the error, and that the run page lists each rule, as the
failed-task path already did.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
The per-rule report read any "N of M <STATUS> <word>" line as a test, so
"ERROR creating sql table model main.orders" or "SKIP relation
main.downstream" gave a status to a test named "creating" or "main". A
result now counts only when the name is followed by dbt's padding (dots
or the bracketed status), as dbt prints it for a test; a model, seed,
snapshot, skipped relation or source freshness line carries more words
and is not read.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
…rules

A local dbt project that was too big, or held a file the upload could
not take, was told to use a Git source even when the build runs contract
rules as dbt tests, which a Git checkout cannot take: the advice led to
the next refusal. With rules, the fix now says to upload fewer files, or
to use a Git source and remove the rules from the tables the build
writes; a build without rules keeps the Git source. A project that fits
the upload only without its rules' tests is told so, and a project over
the limit alone is refused once instead of twice.

A selection that leaves out the model whose rules run as tests was told
to set properties.select or properties.model, which left the schema's
required properties.model unset. The fix now says to add the model to
properties.select or drop it, and to set properties.model first when it
is missing. Each fix, applied alone, clears its refusal.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
planned_objects said that fluid diff and --provider databricks see what
fluid apply creates. fluid plan on a 0.7 contract lists the contract's
provider actions and never reads it; fluid diff does, through
DatabricksProvider.plan. The docstring now names only fluid diff.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
A table a dbt build writes on Databricks is rebuilt by dbt's table
materialization from the model's SELECT, which carries no NOT NULL, and
the module leaves its columns to dbt. A required column of such a table
failed verify's constraints check with no reason and no fix.

The finding now says why, names the dbt model (properties.model of a
build that writes only this table, else the table's name, as the job's
tests find it), and prints the model properties that keep the
constraint: an enforced dbt contract listing every column with its data
type, not_null on the required ones. The JSON report carries them as
dimensions.constraints.hint and dbt_model_yaml, and the hint is the
first action. The grade is unchanged; a table only fluid apply creates
gets no hint. The text report prints each action as plain text, since
an action can now quote a model name from the contract.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
…act file

A plan made from a bundle bound the dbt code the bundle packs, but a plan
made straight from a contract file bound nothing: a model edited between
fluid plan and fluid apply plan.json ran unreviewed.

fluid plan of a contract file now records the files dbt reads in each dbt
build's project (dbtProjects, under planDigest), read as fluid bundle
reads them. A project it cannot bind (none where the build runs it, a
templated repository, a link, over the limits) is recorded as unbound
with a warning and the plan is still written. A dbt build that runs as a
Databricks job from a local repository is the exception: its project is
read as the upload reads it, so a missing project, a link, an unreadable
file or a project over the upload's limits fails the plan, as apply would
there. fluid apply plan.json checks the checkout against the record
before anything runs and refuses a changed, added or removed file, a
missing project, an unbound one, and a plan with dbt builds made before
plans bound them (apply_plan_digest_dbt_project_changed, _missing and
_unbound), naming paths only. The dbt runner re-checks the directory just
before dbt starts, and the Databricks job upload re-checks the bytes it
reads (databricks-job-project-changed), for a bundle too.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
fluid plan of a contract whose platform applies through OpenTofu now builds
the module in memory with apply's own emit, offline, before it writes
plan.json. A refusal fails the plan (exit 1, unsupported_binding, with the
kind and fix apply gives) and no plan.json is written. A refusal that
depends on the environment apply runs in (an unset Databricks warehouse, an
operator allowlist, an unresolved {{ env.X }} value) is a warning that
names what apply needs. A Spark setting or broker no operator list can
allow, and a plan the provider's own validator rejects, fail the plan as
they fail apply. Any other error in the check is a warning and the plan
goes on. Streaming plans and --tofu skip the check.

A provider plugin may offer emit_refusals, which reports its refusals
without building the module. Databricks does, so the check reads no keys
and runs no statements, and an unset warehouse does not hide its Genie
space refusals. The check reads credentials from the environment only (no
keyring, no secret store), reads no GCP Application Default Credentials,
calls no AWS STS and keeps the native provider's log lines out of plan's
output.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
The workspace upload read every selected file (up to 64 MiB each) and only then
compared it with its own 2 MiB limit, and kept reading after the project had
passed the file and byte caps.

It now takes each file's size without following links, refuses a file over the
limit without opening it, and stops at the first file that would pass the file or
byte cap with one project-size refusal and no partial project. A file that cannot
be examined gets the same project-unreadable refusal a read error gets.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
…king it

When the alert did not exist, fluid test created the folder first and read its
permissions after, so a folder that a group of every workspace user can edit
(inherited from a parent) was left behind when the run was refused.

It now finds the nearest folder that exists and, when that folder's permissions
plainly let every workspace user edit it, refuses before making the folder. The
refusal names the folder asked for and the parent whose permissions it would
inherit. A parent whose permissions this identity cannot read does not stop the
run: an identity that may create a folder need not manage its parent, and the
check after the folder is made reads the new folder's own permissions before any
alert is created. An existing folder is checked as before.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
The unsafe results-alert folder guidance also said to take edit rights away from the
users groups. For /Workspace/Shared, which is refused by its path, that cannot
work. The permission-based refusal already carries that advice in its own fix text,
so the shared guidance now only points at a folder the CI identity alone can edit.
The generated error reference follows.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
…the semicolon

A refused credential's text ends with a period, so the row read "...URL.; DATABRICKS_WAREHOUSE_ID ...". Each part now loses a trailing period before the parts are joined with a semicolon.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
… the job rule first

Messages about a dbt_project.yml path entry, an output directory or a build's
repository printed the value with str(), which echoes a large nested list or mapping.
A value that is not text is now named by its type (a list, a mapping, an integer).

binds_dbt_project read a build's pattern and properties types before asking whether
it is a Databricks job build. A job build with a local repository is now decided by
the job rule first, whatever those types are. Valid contracts behave as before.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
…r an operator profile

When a project dotenv file's DATABRICKS_HOST is ignored because the environment
sets DATABRICKS_CONFIG_PROFILE, the warning only said to export the endpoint. It now
also says the profile can be unset for this run so the project file's own host and
credential are used, and names every other Databricks credential the environment
holds, since unsetting the profile alone leaves those. Other refusals read as before.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
…failure

The preflight failure line repeated any server error_code shaped like a word, which
let a lower-case token-shaped value through. A refusal kind now keeps a lower-case
dash-joined shape, and an API error code must be upper-case words joined by
underscores (PERMISSION_DENIED); anything else names the exception class alone.
fluid diff prints the same text when it cannot read a Databricks table, so it
follows.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
…usals

fluid plan reports the first refusal the AWS emitter raises, and warns instead of
failing when only an operator's variable clears it. The emitter raised the unset
FLUID_SPARK_GLUE_JARS_URL refusal while it built the Spark blocks, before it read
the exposes or a later build, so a contract that also had a refusal of its own got a
warning at plan and that refusal only at apply. The Spark blocks now keep the
refusal and emit raises it last (emit_data too), after every refusal the contract
decides.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
@github-actions github-actions Bot added provider Changes or requests related to providers security Security-related changes or reports cli Changes to the CLI surface or implementation tests Test coverage or test infrastructure changes needs-docs Pull request needs a linked docs update or justification labels Dec 4, 2026
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

📄 Documentation Reminder

This PR appears to be missing a documentation reference. Our docs live in a separate repo.

Please update the PR description with one of:

  • Link a docs PR — check the "Docs PR linked" box and paste the URL
  • Mark as no docs needed — check "No docs needed" with a justification
  • Acknowledge docs TODO — check "Docs TODO" and create the docs PR before merge

See the Contributing Guide for details.

Comment thread fluid_build/cli/plan.py Fixed
@github-actions github-actions Bot removed the needs-docs Pull request needs a linked docs update or justification label Dec 4, 2026
…oject path

On Python 3.13 and later the loop is met while the repository path is looked up,
so the recorded reason reads "repository './loop' is not a usable path (OSError)"
where earlier versions record that the project could not be read. The plan is
still written and the build unbound either way, so the test accepts both reasons.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
@fas89
fas89 enabled auto-merge (squash) December 4, 2026 11:24
@fas89
fas89 disabled auto-merge December 4, 2026 11:26
fas89 added 2 commits December 4, 2026 12:30
The module already imports re at its top, so the import inside
_check_apply_emitter repeated it. The function now uses the module's name, as
the rest of the file does.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
CHANGELOG.md merged without a conflict: the entry main adds for the profile
history release follows this branch's entries in the Changed section, and
neither side's text changed.

Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
@fas89
fas89 merged commit 1775a73 into main Dec 5, 2026
79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Changes to the CLI surface or implementation provider Changes or requests related to providers security Security-related changes or reports tests Test coverage or test infrastructure changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant