Repository navigation
fix(bundle,plan): one compile for bundle --env, lighter plan attribution, profiling --env bundles - #1191
Merged
Conversation
…ibility gate in CI The privacy-overlay check composed the base contract through the same path as the bundle itself, so `fluid bundle --env` logged compile_start and compile_done twice. The base is now composed without those events, and the output reads as v0.24.0's again. The compatibility gate extracts v0.24.0 with git archive and skipped on every CI leg because the checkout is shallow. The Python 3.12 leg now fetches that tag alone and sets FLUID_COMPAT_GATE_REQUIRED=1, which turns a missing tag into a failure instead of a skip. Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
…tters only fluid plan built its attribution block by importing and running every cloud's IaC emitter, whatever the contract targets, which cost about 20 ms and a dozen imports on every plan. The block now runs the emitters of the clouds the contract declares, plus the plan's provider. Every emitter still runs for a contract that declares no platform and names no provider, and for one whose bindings cannot be read. plan.json is byte-identical on 42 of the 45 template and example contracts. The three AWS Iceberg examples lose the GCS bucket and bucket IAM entries the GCP emitter used to list for their AWS exposes: apply on AWS never creates them, so the block no longer bills them. Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
…udit take an --env bundle A bundle holds its overlay merged in, so fluid profile and fluid privacy-audit refused every bundle built with --env whose contract carries a privacy block, even when the overlay left the block alone. fluid bundle --env now compares the overlaid contract with the contract alone and, when the block and every tie to a column it lists are unchanged, records privacyBlock: unchanged in the MANIFEST source block. Profile and audit take a bundle with that record; one without it (an earlier bundle, or an overlay that takes a tie away) is still refused, now with a hint to rebuild it. Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
…xpose, in every bundle format fluid bundle --env refused an overlay that changes the privacy block, but an overlay that rewrote a relationship's fromColumns, and so took away the tie that withholds a column, was written into a yaml or json bundle, and a profile of that file published the column. fluid bundle --env now refuses such an overlay in every format, as fluid profile --env does. An overlay that adds an expose or a column the contract does not declare could carry what the block withholds under a name it does not list. fluid profile, fluid privacy-audit and fluid bundle now refuse it when the contract carries a privacy block. The three checks live in one helper the commands share. Signed-off-by: Speculator55005 <50082482+fas89@users.noreply.github.com>
📄 Documentation ReminderThis PR appears to be missing a documentation reference. Our docs live in a separate repo. Please update the PR description with one of:
See the Contributing Guide for details. |
fas89
marked this pull request as ready for review
December 5, 2026 09:08
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.
What this changes
Four commits.
1.
fluid bundle --envreports one compile againThe privacy-overlay check composed the base contract through the same function as the bundle itself, so
fluid bundle --envloggedcompile_startandcompile_donetwice. The base is now composed withloader.compose_contractdirectly, with no compile events.tests/fragments/test_compat_gate.py(output byte-identical to v0.24.0) passes again: its twotest_m01_...[overlay-075|overlay-076]cases failed on main.The compat gate extracts v0.24.0 with
git archiveand skipped on every CI leg, because the checkout is shallow. The Test (Python 3.12) leg now fetches that tag alone (depth 1: its tree, no history) and setsFLUID_COMPAT_GATE_REQUIRED=1, which makes a missing tag fail the gate instead of skipping it. A second test that needs no tag,test_a_bundle_built_with_an_env_reports_one_compile, pins the event count everywhere.2.
fluid planno longer runs every cloud's emitter for the attribution blockbuild_attribution_blockimported and ran the IaC emitter of every cloud (AWS, GCP, Snowflake, Databricks) on every plan, whatever the contract targets. It now runs the emitters of the clouds the contract declares (iac.provider_match.detect_clouds, the same detectionfluid generate iacuses) plus the plan's provider. A contract that declares no platform and names no provider still gets every emitter, and so does one whose bindings cannot be read.plan.json(planDigestand the attribution block) is byte-identical on 42 of the 45 template and example contracts, base 1775a73 vs head.examples/aws-glue-data-lake/contract-etl-job,contract-iceberg,examples/aws-iceberg-lakehouse). The GCP emitter used to list agoogle_storage_bucketand its IAM entries for their AWS Iceberg exposes. Apply on AWS never creates those, so the block no longer bills them.fluid planon the customer-360 template: v0.44.0's set plusfluid_build.attribution.*andfluid_build.iac.naming(the key registry's identifier helper). The GCP provider package,databricks_genieanddatabricks_foldersare gone from the plan path.fluid generate artifactsbuilds its MANIFEST attribution block through the same function (with no plan provider), so its block changes the same way: only the declared clouds' emitters run.fluid generate iacis unchanged.3. A bundle built with
--envcan be profiled when its overlay left the privacy block alonefluid profileandfluid privacy-auditrefused every bundle built with--envwhose contract carries a privacy block, because a bundle holds its overlay merged in and could not say what the overlay changed.fluid bundle --envnow compares the overlaid contract with the contract alone. When the block, every tie to a column it lists and the exposes and columns it was written for are unchanged, and the block is enforceable on both, it records"privacyBlock": "unchanged"in the MANIFESTsourceblock. Profile and audit take a bundle with that record. A bundle without it (one from an earlier version) is refused as before, with a hint to rebuild it. The record sits besideenvin thesourceblock, outside the merkle root, asenvdoes. Bundles of contracts without a privacy block are unchanged.4. An overlay may not take a tie away or add an expose, in any bundle format
fluid bundle --envrefused an overlay that changes the privacy block, but an overlay that rewrote a relationship'sfromColumns(and so took away the tie that withholds a column) was written into a yaml or json bundle, and a profile of that file published the column. An overlay that adds an expose or a column the contract does not declare could also carry withheld data under a name the block does not list.fluid bundle --env(every format),fluid profile --envandfluid privacy-audit --envnow refuse all three, through one shared check (_privacy_overlay.overlay_privacy_refusal). The refusal applies to anyfluid bundle --envof a contract with a top-levelprivacyblock, whatever the output format. For a contract without the block, only the existing refusal of an overlay that adds one applies.Performance
fluid plancustomer-360, wall, min of 21 alternating runsbuild_attribution_blockinsidefluid plan, customer-360 (local engine)fluid plancustomer-360Whole-command timings: macOS, M-series, all three trees byte-compiled first, each run in its own tree, alternating order, run alone. Block timings:
time.perf_counteraround the call in a realfluid planprocess, best of 7 to 9 runs.fluid planis back within 0.3% of v0.44.0 (main was 2.7% over).Borrow before build
Checked locally:
iac.provider_match.detect_cloudsalready detects the clouds a contract declares forfluid generate iac; reused as is._privacy_overlay.block_changedandwithholding_droppedare the checksfluid profile --envran; the bundle and the new shared refusal reuse them.forge_datamodel.semantics_builder.declared_columnsandpolicy._common.iter_exposesgive the declared exposes and columns.forge.core.bundle.make_bundle_source/read_bundle_sourcecarry the new field.loader.compose_contractis the composition every command reads; the base check now calls it directly.Searched:
required_providers). https://developer.hashicorp.com/terraform/cli/plugins, https://developer.hashicorp.com/terraform/language/providers/requirements (Terraform BUSL-1.1; OpenTofu MPL-2.0, same behaviour).Reuse strategy:
envfield it sits beside.Tests (failing first)
tests/fragments/test_compat_gate.py::test_m01_...[overlay-075|overlay-076]failed on main, pass now.tests/profiler/test_cli_profile_policy.py, failing before:test_a_bundle_built_with_an_env_reports_one_compile,test_a_bundle_whose_overlay_leaves_the_block_and_its_ties_alone_is_profiled,test_a_bundle_built_with_an_env_that_records_no_check_is_refused_by_the_profile,test_a_bundle_whose_overlay_takes_a_tie_away_is_not_written[yaml|json],test_an_overlay_that_adds_an_expose_is_refused_by_the_profile,test_a_bundle_whose_overlay_adds_an_expose_is_not_written. Also new:test_a_bundle_of_a_contract_without_a_block_records_no_privacy_check.tests/attribution/test_block.py: new tests that only the declared clouds' emitters run, that a local-engine contract runs none and loads no cloud emitter module, that a platform-less contract runs the plan's provider, and that unreadable bindings run every emitter; each fails before. One pins that a contract declaring nothing still runs every emitter (passes before and after). Two existing tests updated to the new rule.Checks
-n 3, macOS: 56624 passed, 8 failed. All 8 come from this machine's environment, in files this change does not touch: 5 intests/iac/test_iac_databricks_alerts_fake_e2e.py(nodatabricks-sdklocally), 2 intests/providers/test_duckdb_sandbox_workspace_root.py(macOS temp dir), 1 intests/test_dotenv_unfiltered_readers.py(nodbtlocally).tests/attribution, the profile, privacy-audit, plan and bundle dbt-project tests,tests/perf/test_startup_budget.pyandtests/test_import_cycles.py: 409 passed, 1 skipped.