Skip to content

fix(conformance): unwrap formae.Value wrappers in CreateUnmanagedResource - #442

Open
naxty wants to merge 3 commits into
mainfrom
fix/conformance-flatten-value
Open

fix(conformance): unwrap formae.Value wrappers in CreateUnmanagedResource#442
naxty wants to merge 3 commits into
mainfrom
fix/conformance-flatten-value

Conversation

@naxty

@naxty naxty commented Apr 27, 2026

Copy link
Copy Markdown
Contributor

The discovery conformance harness creates resources directly through the plugin. A property authored as formae.Value previously reached that create request as an envelope instead of its payload, causing scalar provider fields to reject otherwise valid input.

Unwrap Value envelopes recursively after resolving resource references and before normalizing empty collections. Reject stored secret hashes before those transformations so a digest cannot be written as a live secret. Keep numeric precision in the added conversion step. The standalone conformance SDK implements this locally without importing the agent’s internal resolver.

Regression coverage captures the actual unmanaged-create coordinator request, verifies nested values and a dependent resource reference, and proves stored hashes never reach the request boundary. The request regression fails against current main and passes with this change; hash rejection and numeric conversion regressions failed before their fixes. The full conformance package passes with Go 1.26.2.

Refreshed against main while preserving its reference resolution, secret redaction, retry, and cleanup behavior. Fable source review found no blocking in-scope defect; the full conformance package also passes with the race detector. All final-head CI checks pass, including the property suite, main build/test job, and every E2E test plus cleanup. A live OVH conformance run has not been performed.

…urce

The discovery harness's CreateAllUnmanagedResources forwards the
evaluated PKL JSON to the plugin verbatim. The agent's apply path
runs resolver.ConvertToPluginFormat on properties first, which both
resolves resolvable references *and* collapses formae.Value wrappers
({"\$value": ..., "\$strategy": ..., "\$visibility": ...}) down to
their scalar payload. The harness only does the resolvable half, so
any field declared in PKL as

    field = new formae.Value { value = "x"; strategy = "SetOnce" }

reaches the plugin as the wrapper object and the cloud API rejects it
when the field is typed against the inner scalar (real example, OVH:

    [version] Given data is not valid for type cloud.kube.VersionEnum
    (code: InvalidRequest)

— sent during kube-cluster discovery once 1.33 was relaxed in the PKL
to (String|formae.Value)? to support SetOnce).

Adds flattenFormaeValuesInProperties / flattenFormaeValueWalk that
recursively replace any object carrying "\$value" with that key's
payload, while leaving "\$res": true resolvable markers intact (those
are owned by resolveResolvablesInProperties). Wired into
CreateAllUnmanagedResources right after the resolvable pass so plugins
authored against the apply-path contract no longer have to re-implement
this in every Create.
naxty added a commit to platform-engineering-labs/formae-plugin-ovh that referenced this pull request Apr 28, 2026
Sidesteps the conformance harness's missing Value-flatten step (fix is
in flight at platform-engineering-labs/formae#442). Plain "1.34" is
how the schema's (String|formae.Value)? union is consumed by every other
test that does not need SetOnce semantics, and OVH's GET still echoes
the full patch ("1.34.6-1") so Verify is unaffected.
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.

2 participants