Skip to content

useXPackageGenSdk leaks <span pulumi-lang-*> chooser markup into Go/Node/Python SDKs for bridged providers #2240

Description

@pose

Summary

For a Terraform-bridged provider, enabling the per-language useGoPackageGenSdk / useNodejsPackageGenSdk / usePythonPackageGenSdk flags (which switch SDK codegen from the bridge's pulumi-tfgen-<provider> path to pulumi package gen-sdk) leaks raw Pulumi language-chooser markup (<span pulumi-lang-nodejs="…" pulumi-lang-go="…">…</span>) into the generated Go/Node.js/Python SDKs — in doc comments, deprecation messages, @deprecated decorators, and runtime deprecation warnings.

The bridge's tfgen-based SDK codegen resolves that chooser markup per language (clean output). pulumi package gen-sdk resolves it for C# but not for Go/Node.js/Python, so those three SDKs ship the literal <span …> HTML to end users.

useDotnetPackageGenSdk is not affected.

Affected flags

  • useGoPackageGenSdk: true
  • useNodejsPackageGenSdk: true
  • usePythonPackageGenSdk: true
  • useDotnetPackageGenSdk: true ✅ (clean)

useProviderBinarySchemaGen is unrelated (was false in the repro; the schema is still tfgen-generated).

Where the markup originates

It is normal/expected in a bridged provider's schema.json: description and deprecationMessage fields carry the per-language chooser so each SDK can render the language-appropriate token. Example field from the repro provider's schema:

resources["coreweave:index/networkingVpc:NetworkingVpc"].properties.hostPrefix.deprecationMessage
=> "<span pulumi-lang-nodejs=\"`hostPrefix`\" pulumi-lang-dotnet=\"`HostPrefix`\" pulumi-lang-go=\"`hostPrefix`\" pulumi-lang-python=\"`host_prefix`\" pulumi-lang-yaml=\"`hostPrefix`\" pulumi-lang-java=\"`hostPrefix`\">`hostPrefix`</span> is deprecated. Use <span …>`hostPrefixes`</span> instead. …"

The schema is identical before and after the flag change; only the SDK codegen path differs.

Expected vs actual (Go SDK, networkingVpc.go)

Expected (bridge tfgen codegen — the pre-flag baseline):

// Deprecated: `hostPrefix` is deprecated. Use `hostPrefixes` instead. The field will be removed in a future version. …

Actual (pulumi package gen-sdk):

// Deprecated: <span pulumi-lang-nodejs="`hostPrefix`" pulumi-lang-dotnet="`HostPrefix`" pulumi-lang-go="`hostPrefix`" pulumi-lang-python="`host_prefix`" pulumi-lang-yaml="`hostPrefix`" pulumi-lang-java="`hostPrefix`">`hostPrefix`</span> is deprecated. Use <span …>`hostPrefixes`</span> instead. …

Python emits it into warnings.warn(...), pulumi.log.warn(...), and @_utilities.deprecated(...); Node.js into @deprecated JSDoc.

Leak counts in the NetworkingVpc resource alone (schema has ~10 chooser-bearing fields total):

SDK occurrences
Go 6
Python 7
Node.js 3
.NET 0

Reproduction

  1. Take a TF-bridged provider whose upstream has a deprecated/renamed field, so the schema's deprecationMessage/description contains <span pulumi-lang-*> chooser markup (any bridged provider with renamed fields qualifies; observed on pulumi/pulumi-coreweave).
  2. Add to .ci-mgmt.yaml:
    useDotnetPackageGenSdk: true
    useGoPackageGenSdk: true
    useNodejsPackageGenSdk: true
    usePythonPackageGenSdk: true
  3. make ci-mgmt then make generate.
  4. Inspect sdk/go, sdk/nodejs, sdk/python: deprecation/doc strings contain literal <span pulumi-lang-…> markup. sdk/dotnet is clean.

Environment

  • pulumi/ci-mgmt provider-ci v0.0.0-20260515094716-a6f5a248a2e5 (@master via make ci-mgmt)
  • Pulumi CLI v3.230.0
  • pulumi-terraform-bridge/v3 v3.127.0

Root-cause hypothesis / questions

The bridge SDK codegen runs a documentation pass that resolves the per-language chooser; pulumi package gen-sdk only does so for the C# generator, not Go/Node.js/Python. Either:

  • the useXPackageGenSdk path should run the same chooser-resolution doc pass for all languages (likely a pulumi/pulumi codegen gap for Go/Node/Python deprecationMessage/description), or
  • ci-mgmt should document that these flags are unsafe for bridged providers whose schema carries chooser markup until the codegen gap is closed, or
  • the schema fed to pulumi package gen-sdk should be pre-processed to strip/resolve choosers.

For now this makes useGoPackageGenSdk/useNodejsPackageGenSdk/usePythonPackageGenSdk unusable for bridged providers without visibly degrading three of the four SDKs. Happy to provide a full repro branch / diff.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions