direct: store serialized_dashboard in state as a content hash - #6103
Closed
Sankalp-Mittal wants to merge 12 commits into
Closed
direct: store serialized_dashboard in state as a content hash#6103Sankalp-Mittal wants to merge 12 commits into
Sankalp-Mittal wants to merge 12 commits into
Conversation
…ash but full content is always sent to the API
Sankalp-Mittal
marked this pull request as ready for review
July 30, 2026 12:13
Contributor
Approval status: pending
|
Contributor
|
An authorized user can trigger integration tests manually by following the instructions below: Trigger: Inputs:
Checks will be approved automatically on success. |
Sankalp-Mittal
marked this pull request as draft
July 30, 2026 12:29
Collaborator
Author
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.
Summary
Store a dashboard's
serialized_dashboardin direct-engine state as asha256_hashed_in_state:<hex>content hash instead of the full multi-MB blob. The saved copy is only ever compared for equality (never read back), so a hash is sufficient and the state file stays small. The full contents are still sent to the API on every deploy.This reimplements the approach from #5609 on current
main.What's included
libs/hash— newOfJSONhelper (deterministic sha256 of a value's JSON), withlibs/cachererouted through it (previously a privatefingerprintToHash).hashed_in_statelifecycle rule — new[]stringfield onResourceLifecycleConfig, declared fordashboards.serialized_dashboardinresources.yml.CompactState/hashStateValue(state_compaction.go) — replace declared fields with content hashes; idempotent, never mutates the caller's value.apply.goviacompactAndSaveState,bind.go,migrate/build_state.go) and on all three diff sides inbundle_plan.go(saved, local config, remapped remote), so comparisons stay hash-vs-hash.hashed_in_statesection in the dresources README; unit tests forlibs/hash,CompactState, and the dashboard wiring.bundle/resources/dashboard-state-shacase: verifies the state file holds the hash while the API receives the full content, across create / re-plan (no-op) / edit / update. Runs on the direct engine withREADPLANin["", "1"].[[Repls]]rule inacceptance/bundle/test.tomlmasks the hash as[HASH](withDistinct, so equal hashes collapse to one token and a differing remote gets another) atOrder = -1, ahead of the generic numeric/id rules that would otherwise nibble hex out of the digest.Notes
hashed_in_stateis orthogonal toignore_remote_changes;serialized_dashboardneeds both, for independent reasons (large blob / server normalizes the content).This pull request and its description were written by Isaac.