resource/pingone_davinci_flow: form node theme reference (theme.value / themeId.value) not resolved as embedded reference - #129
Merged
Conversation
…p, and UUID-format guard Adds PreconditionKeyPath/PreconditionValue (gate a rule on a sibling JSON key's value) and UnwrapMode "rich_text" (extract/re-embed a UUID nested inside a Slate-style rich-text wrapper) to EmbeddedReferenceRule, plus an unconditional looksLikeUUID guard (backed by github.com/google/uuid) applied before any Strategy branch runs. This replaces a hardcoded sentinel denylist approach with a general check: only UUID-shaped strings are ever resolved as references/fallback variables, so future DaVinci sentinel values (beyond "useThemeId"/"activeTheme") are rejected without further code changes. Both new fields are zero-value-safe — existing subFlowId/form.value rules are unaffected. Corrects non-UUID-shaped placeholder fixtures in embedded_references_test.go that are asserted to resolve, and adds tests for precondition match/no-match/absent-key, rich-text unwrap resolving to both a variable and a graph reference, malformed wrapper shapes, and the UUID-format guard's no-op behavior across all three Strategy values. Lays groundwork for registering pingone_branding_theme rules against theme.value/themeId.value on DaVinci showForm nodes in a follow-up change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ed reference rules for theme.value and themeId.value Adds two EmbeddedReferenceRule registrations mirroring the existing form.value rule: theme.value (case 1, direct UUID) and themeId.value (case 3, rich-text-wrapped UUID gated on theme.value == "useThemeId"). Both target pingone_branding_theme with reference_with_fallback so the UUID resolves to a graph reference when available, otherwise a Terraform variable — matching the form.value/pingone_davinci_form bootstrap precedent. The unconfirmed "activeTheme" sentinel and the theme-absent case require no special-casing: they're rejected by Task 1's unconditional UUID-format guard. Adds a registration-presence test in dispatch_test.go and end-to-end behavioral tests in resource_flow_test.go covering all six plan acceptance criteria (fallback/reference resolution for both cases, theme-absent unchanged, activeTheme-without-themeId unchanged, form.value independence, customForm unaffected).
Regression Test Results
✅ No regressions detectedAll export configurations produced compatible output. Generated by regression workflow • View run |
Regression Test Results
✅ No regressions detectedAll export configurations produced compatible output. Generated by regression workflow • View run |
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 Was Built
Resolve
pingone_davinci_flowform-node theme/UI-template references (theme.valueandthemeId.value) as embedded Terraform references or fallback variables, closing #128.pingOneFormsConnectorshowFormnodes can embed a theme/UI-template reference in three shapes — a direct UUID attheme.value, an absentthemekey, or an indirect mode flag (theme.value == "useThemeId") pointing at a rich-text/Slate-wrapped UUID in a siblingthemeId.valuefield. None of these were resolved before this change; they were emitted as inert raw strings in the exported HCL. This mirrors the treatment already given toform.value, which resolves via the existingEmbeddedReferenceRulemechanism.This change extends that generic mechanism with two new optional, zero-value-safe fields (
PreconditionKeyPath/PreconditionValuefor cross-key gating,UnwrapModefor the rich-text/Slate wrapper) plus an unconditional UUID-format validation guard, then registers two new declarative rules againstpingone_branding_theme(currently unexported, so both rules fall back to a Terraform variable until that resource is added, matching theform.value/pingone_davinci_formprecedent).Key Decisions
pingone_branding_theme, confirmed real and not-yet-exported (contributing/RESOURCE_COVERAGE.md), withStrategy: "reference_with_fallback"— same bootstrapping pattern used forform.valuebeforepingone_davinci_formexisted.SkipValues []stringlist ("useThemeId","activeTheme") to stop the fallback strategy from corrupting the mode-flag sentinel. Replaced with a general, self-maintaining fix: an unconditional UUID-format guard (viagithub.com/google/uuid, already a direct dependency) applied to every extraction, regardless of strategy. Any non-UUID-shaped string is left untouched — no enumeration required, and any future sentinel DaVinci might add is automatically covered.propertiesmap is marshaled, so quotes inside it are backslash-escaped in the raw HCL text. A new sibling helper (replaceRichTextInRawHCL) re-derives escaping viajson.Marshalrather than reusing the existing plain substring-replace helper."useThemeId"gates case 3;"activeTheme"is left alone — not via a special case, but because it fails the general UUID-format guard like any other non-UUID string.mfaPolicyId/userId(same rich-text wrapper shape elsewhere inshowForm's properties) are explicitly out of scope for this change.Changes
internal/core/embedded_references.go— newPreconditionKeyPath/PreconditionValue/UnwrapModefields onEmbeddedReferenceRule, unconditionallooksLikeUUIDguard,unwrapRichText/replaceRichTextInRawHCLhelpers.internal/core/embedded_references_test.go— corrected ~10 existing non-UUID-shaped fixtures to valid UUIDs (needed by the new guard); added tests for precondition, rich-text unwrap, malformed wrappers, and the guard across all strategies.internal/platform/pingone/resource_flow.go— two new rule registrations targetingpingone_branding_theme.internal/platform/pingone/resource_flow_test.go,dispatch_test.go— behavioral and registration-presence tests.contributing/ARCHITECTURE.md,contributing/DEVELOPER_HANDBOOK.md— documented the new fields and guard..changelog/pr-128.txt— enhancement changelog entry.Test plan
themeabsent → byte-for-byte unchanged — Verified by Polaris QAtheme.valueuntouched — Verified by Polaris QAtheme.valueuntouched — Verified by Polaris QAtheme.value == "activeTheme"sentinel, nothemeId, unchanged — Verified by Polaris QAform.valueresolves independently of theme case — Verified by Polaris QAcustomFormnodes unaffected, no capability-aware branching — Verified by Polaris QAsubFlowId/form.valuetests pass unchanged with zero-value new fields — Verified by Polaris QApingone_branding_themeneed not exist as an exported resource for this change to be complete — Verified by Polaris QA🤖 Generated with Claude Code