Skip to content

Serialize inline serialized_dashboard to a JSON string early - #6471

Open
Sankalp-Mittal wants to merge 4 commits into
sankalp-mittal/dashboards-serialized-inlinefrom
sankalp-mittal/dashboards-serialize-early
Open

Serialize inline serialized_dashboard to a JSON string early#6471
Sankalp-Mittal wants to merge 4 commits into
sankalp-mittal/dashboards-serialized-inlinefrom
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.

@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
…ized-inline' into sankalp-mittal/dashboards-serialize-early
…ized-inline' into sankalp-mittal/dashboards-serialize-early
…ized-inline' into sankalp-mittal/dashboards-serialize-early
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