Add References tab + resolve mutators in Desired State#6900
Draft
edvgui wants to merge 6 commits into
Draft
Conversation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
bartv
marked this pull request as draft
July 1, 2026 09:44
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
Surfaces the
referencesandmutatorscarried on a resource's desired state in the resource details page.New "References" tab
Lists every entry in
details.attributes.referencesas an expandable row showing the reference'stypeandid. Expanding a row reveals its arguments in a Desired-State-lookalikelayout:
type: "reference"/"resource") render as blue clickable chips. Clicking areferencechip expands and scrolls to the target row in the same table.arg.references(JSONPath → reference id) are substituted in place and rendered as inline clickable chipsinside the JSON text.
AttributeClassifier+AttributeListpipeline so JSON / XML / multi-line formatting matches the Desired State tab exactly.Expansion state is URL-backed (
useUrlStateWithExpansion) so it survives reloads and cross-tab navigation.Mutator resolution on the Desired State tab
core::Replacemutators are interpreted client-side (seeinmanta_core.references.ReplaceValue):(destination, referenceId)pairs fromattributes.mutators.destination(JSONPath) in a clone of the attributes with a printable sentinel string.mutatorsandreferenceskeys are hidden from the Desired State tab (they have dedicated rendering / the References tab).Cross-tab navigation
Clicking a chip in the Desired State tab switches to the References tab and auto-expands the target row. A small
useEffect-based dance defers the expansion to a follow-up render so thetwo URL writes (active tab + expansion) don't clobber each other — each
useUrlStatewrite captureslocation.searchat render time and would otherwise overwrite the sibling key.Structured / JSON toggle
A toggle above the Desired State card lets the user flip between the structured view (with mutator chips) and a read-only
CodeEditorshowingdetails.attributesverbatim — useful as anescape hatch when something looks off.
Implementation notes
CodeEditor. Instead we substitute reference holes with printable sentinels(
@@INMANTA_REF_START@@<uuid>@@INMANTA_REF_END@@),JSON.stringify, then split the resulting text on the sentinel regex and interleave<Label>chips between text chunks. Earlier draftused a real null byte —
JSON.stringifyescapes it to a 6-char\u0000sequence, which broke the regex; printable ASCII sidesteps that.$root,[<n>],[<"key">],.key, and bare-name paths (value,foo.bar). No wildcards / filters / recursive descent — sufficient forwhat the orchestrator currently emits via
jsonpath_ng. If/when we see richer expressions, swap tojsonpath-plus.core::Replaceis interpreted. Other mutator types are ignored (the original attribute value is rendered as-is) until a use case appears.Preview
Screencast.From.2026-05-21.23-23-53.mp4
Test plan
attributes.referencespopulated; References tab appears between Desired State and Requires.type · idchips for linked args; literal args use the standard formatting.mjson-bearing reference — clickable chips appear inline in the JSON block at eachreferencesJSONPath.core::Replacemutators (seeresource.json) — mutated attribute renders as a chip in the Desired State tab; clicking it switches to References tab with thetarget row expanded.
details.attributesis shown in a read-only editor, includingmutatorsandreferencesarrays.🤖 Generated with Claude Code