Skip to content

Serialize inline serialized_dashboard to a JSON string early - #6471

Open
Sankalp-Mittal wants to merge 29 commits into
mainfrom
sankalp-mittal/dashboards-serialize-early
Open

Serialize inline serialized_dashboard to a JSON string early#6471
Sankalp-Mittal wants to merge 29 commits into
mainfrom
sankalp-mittal/dashboards-serialize-early

Conversation

@Sankalp-Mittal

Copy link
Copy Markdown
Collaborator

Summary

Marshal an inline (structured) serialized_dashboard to a JSON string in phases.Initialize, mirroring ConfigureGenieSpaceSerializedSpace, so the value is always a plain string by the time the deploy engine sees it.

Why: a map left in config versus a JSON round-trip in state decode integers differently (Go int vs float64), so the direct engine reported false serialized_dashboard drift on every plan. The remote also comes back serialized, so a deep diff of a map against a string can never converge. Normalizing to a string up front makes config-side and state-side carry the same value.

Changes

  • configure_dashboards_serialized_dashboard.go — reject setting both file_path and serialized_dashboard; switch on the inline value kind (string/nil/invalid pass through, map/sequence → json.Marshal, other → error). Keeps the existing file_path read.
  • New test configure_dashboards_serialized_dashboard_test.go — the first test for this mutator (7 cases, mirroring the genie mutator's test).
  • dashboard.go prepareDashboardRequest — dropped the map-marshal branch; a nil/string/default type switch, mirroring prepareGenieSpaceRequest.
  • convert_dashboard.go — removed the now-dead marshalSerializedDashboard (convert.Normalize maps the string straight onto the schema's string field) and its call.
  • Test fixtures in convert_dashboard_test.go and all_test.go updated to the always-string reality.

Plan-output change

The direct-engine plan for the change-serialized-inline acceptance test now shows serialized_dashboard as a JSON string in new_state.value and changes.old/new, instead of a structured map — so they're comparable to the remote string and the false drift is gone. The terraform variant and the create-path test are unchanged (tfdyn already marshaled to a string).

Notes

This pull request and its description were written by Isaac.

Sankalp-Mittal and others added 6 commits September 1, 2026 14:01
Prove that a dashboard whose serialized_dashboard is an inline YAML map
(not a string) plans and deploys correctly, and record that the map is
sent to the API as a JSON string. Both engines produce identical output.

Co-authored-by: Isaac <no-reply@databricks.com>
Deploy a dashboard whose serialized_dashboard is an inline YAML map, then
change a value inside the map and show the plan: the change is detected as
an update (not a recreate). Capture the update request the direct engine
sends, which serializes the inline map to a JSON string.

Co-authored-by: Isaac <no-reply@databricks.com>
Show the machine-readable plan (per engine) for the serialized_dashboard
change instead of recording the update request.

Co-authored-by: Isaac <no-reply@databricks.com>
The direct-engine destroy 404s on the injected stale GET and reports
"0 deleted" while terraform reports "1 deleted". That divergence is only
in the cleanup step, so route destroy output to a LOG file instead of
disabling the inherited stale-GET simulation.

Co-authored-by: Isaac <no-reply@databricks.com>
- Change the inline serialized_dashboard value with update_file.py, which
  asserts if the target text is missing instead of silently no-op-ing.
- Deploy the change and test the READPLAN matrix (in-memory vs saved plan);
  both send the same update request.
- Capture the direct-engine update request alongside the per-engine JSON plans.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

Files: acceptance/bundle/resources/dashboards/change-serialized-inline/out.plan.direct.json
Suggested: @denik
Also eligible: @pietern, @janniklasrose, @shreyas-goenka, @andrewnester, @lennartkats-db, @anton-107

/bundle/ - needs approval

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

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.

Marshal an inline (structured) serialized_dashboard to a JSON string in
phases.Initialize, mirroring ConfigureGenieSpaceSerializedSpace, so the value is
always a plain string downstream. A map left in config vs a JSON round-trip in
state decode ints differently (Go int vs float64), which made the direct engine
report false serialized_dashboard drift on every plan; the remote also comes
back serialized, so a deep diff can't converge.

- ConfigureDashboardSerializedDashboard now rejects setting both file_path and
  serialized_dashboard, and marshals an inline map/sequence to a JSON string
  (string/nil pass through, other kinds error). Keeps the file_path read.
- prepareDashboardRequest and the tfdyn converter now assume a string; the
  map-marshal branches are removed.

Co-authored-by: Isaac <no-reply@databricks.com>
@Sankalp-Mittal
Sankalp-Mittal force-pushed the sankalp-mittal/dashboards-serialize-early branch from c319d46 to 484300e Compare September 1, 2026 19:30
Sankalp-Mittal and others added 11 commits September 1, 2026 19:56
- Use replace_ids.py instead of bundle summary + add_repl for the dashboard ID.
- Add the READPLAN matrix; the create request is identical in-memory and from
  a saved plan.

Co-authored-by: Isaac <no-reply@databricks.com>
Encode "update, not recreate" as an executable check instead of a prose comment.

Co-authored-by: Isaac <no-reply@databricks.com>
Drop the direct-only guard and record out.requests.$DATABRICKS_BUNDLE_ENGINE.txt
for both engines. This documents terraform's OUTPUT_ONLY-field echoing instead of
hiding it, following the repo's per-engine-file convention for divergent output.

Co-authored-by: Isaac <no-reply@databricks.com>
…ized-inline' into sankalp-mittal/dashboards-serialize-early
The direct plan dumped remote_state (etag, timestamps, and the API's
pretty-printed serialized_dashboard string), which a real workspace formats
differently than the local fake, breaking the cloud run. Project the golden to
just the resource action and the serialized_dashboard old/new diff; keep the
full plan in a tmp file for the READPLAN=1 deploy.

Co-authored-by: Isaac <no-reply@databricks.com>
The real Lakeview API pretty-prints serialized_dashboard and returns a
differently-shaped etag, which the recorded plan golden can't match on a real
workspace. Mark the test Cloud=false and drop the jq projection, dumping the
full plan again (stable against the local fake).

Co-authored-by: Isaac <no-reply@databricks.com>
…ized-inline' into sankalp-mittal/dashboards-serialize-early
The inherited MSYS_NO_PATHCONV=1 stops Git-Bash from converting a helper
script's own /c/... path when handing it to python3.exe, so replace_ids.py /
update_file.py / print_requests.py fail to open on Windows. These tests pass no
absolute paths to the CLI (print_requests.py uses the // form), so unset it.

Co-authored-by: Isaac <no-reply@databricks.com>
…ized-inline' into sankalp-mittal/dashboards-serialize-early
@Sankalp-Mittal
Sankalp-Mittal requested review from denik and removed request for denik September 2, 2026 07:54
@Sankalp-Mittal
Sankalp-Mittal requested a review from denik September 2, 2026 09:02
Sankalp-Mittal and others added 2 commits September 2, 2026 09:10
Co-authored-by: Isaac <no-reply@databricks.com>
Comment thread bundle/deploy/terraform/tfdyn/convert_dashboard_test.go Outdated
Comment thread bundle/deploy/terraform/tfdyn/convert_dashboard_test.go Outdated
Base automatically changed from sankalp-mittal/dashboards-serialized-inline to main September 2, 2026 11:56
…ards-serialize-early

# Conflicts:
#	acceptance/bundle/resources/dashboards/change-serialized-inline/out.plan.direct.json
@Sankalp-Mittal
Sankalp-Mittal requested a review from denik September 2, 2026 14:56
Sankalp-Mittal and others added 5 commits September 2, 2026 16:40
The "inline sequence is rejected" case was missing the trailing comma after
its struct literal, a syntax error that failed to compile the whole
resourcemutator_test package and broke lint and every task test job.

Co-authored-by: Isaac <no-reply@databricks.com>
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.

3 participants