Skip to content

Reject root-module provider resources resolved through moduleFormat - #25020

Merged
iwahbe merged 1 commit into
pulumi:masterfrom
KR-Ravindra:fix/provider-resource-module-format
Oct 5, 2026
Merged

iwahbe merged 1 commit into
pulumi:masterfrom
KR-Ravindra:fix/provider-resource-module-format

Conversation

@KR-Ravindra

Copy link
Copy Markdown
Contributor

Summary

Problem

The binder already treats provider as a reserved name in the root module, but it checks the raw module segment of the token. With moduleFormat: "(.*)(?:/[^/]*)", a token like databricks:index/provider:Provider resolves to the root module, passes validation, and then every SDK generator panics with duplicate file: provider.*.

Fix

Run the existing reserved-name check after moduleFormat is applied, so it sees the resolved module.

Fixes #17034

Test plan

How tested

  • Added appropriate unit tests - new bad-type-5.json case in TestInvalidTypes

Before the fix:

--- FAIL: TestInvalidTypes/bad-type-5.json (0.00s)
    Error: An error is expected but got nil.

After:

--- PASS: TestInvalidTypes/bad-type-5.json (0.00s)
ok  github.com/pulumi/pulumi/pkg/v3/codegen/schema

Validation

  • go test ./codegen/schema/..., plus TestGeneratePackage* for go and python
  • golangci-lint on pkg/codegen/schema — clean

Changelog

  • Changelog entry added

Risk

Such schemas already failed SDK generation. Newly refused: YAML-only providers using this, and root-module types/functions named provider via moduleFormat.

Prepared with an AI agent operated by KR-Ravindra, who reviewed and tested it. The agent is pointed only at issues maintainers have confirmed and problems he has hit, not at producing contributions.

The reserved-name check for "provider" in the root module only looked at the raw module segment of the token, so a token like "pkg:index/provider:Provider" with moduleFormat "(.*)(?:/[^/]*)" passed schema validation and then crashed every SDK generator with a duplicate provider file. Apply the check after moduleFormat resolution.
@KR-Ravindra
KR-Ravindra marked this pull request as ready for review October 4, 2026 04:21
@KR-Ravindra
KR-Ravindra requested a review from a team as a code owner October 4, 2026 04:21
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

PR is now waiting for a maintainer to take action.

Note for the maintainer: Commands available:

  • /run-acceptance-tests - used to test run the acceptance tests for the project
  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@iwahbe

iwahbe commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

/run-acceptance-tests
Please view the results of the acceptance tests Here

@iwahbe iwahbe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Assuming tests pass, I'll merge this later today.

@iwahbe
iwahbe added this pull request to the merge queue Oct 5, 2026
Merged via the queue into pulumi:master with commit 41b09ab Oct 5, 2026
7 checks passed
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.

Python codegen panics when a resource is called provider

2 participants