Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests and fix for StackReference output type checking #600

Merged
merged 3 commits into from
Jul 11, 2024
Merged

Conversation

AaronFriel
Copy link
Contributor

Ensures that Pulumi YAML programs are able to use StackReference outputs as "any" typed values. Allows "any" values to be assigned to any value, expanding the set of valid programs.

Blocked on:

Using a Go workspace with that PR applied to Pulumi, the test suite passes.

@AaronFriel AaronFriel requested a review from iwahbe July 11, 2024 05:28
@AaronFriel AaronFriel requested a review from a team as a code owner July 11, 2024 05:28
github-merge-queue bot pushed a commit to pulumi/pulumi that referenced this pull request Jul 11, 2024
Part of pulumi/pulumi-yaml#599.

Pulumi YAML uses the schema defined here to type check outputs from the
`pulumi:pulumi:StackReference` resource. This changes the type of
`outputs` from `map[string]string` to `map[string]any`, permitting list,
map, and numeric outputs to be used as inputs to other resources.

To release this fix, we will need to release Pulumi twice and YAML once
if we are to use our ordinary release process:

1. Merge this PR.
2. Release sdk and pkg dependencies with this update applied.
3. Merge pulumi/pulumi-yaml#600
4. Create and merge a PR to update Pulumi YAML's dependency on
`github.com/pulumi/pkg/v3`, as YAML links to the schema loader and will
read the updated schema here:

https://github.com/pulumi/pulumi/blob/7f48ca370d12e6d7fee29b7e1b6f87c9f558351e/pkg/codegen/schema/loader.go#L136-L140
 
5. Release Pulumi YAML
6. Create and merge a PR to update the YAML language plugin shipped with
Pulumi
7. Release Pulumi
github-merge-queue bot pushed a commit to pulumi/pulumi that referenced this pull request Jul 11, 2024
Part of pulumi/pulumi-yaml#599.

Pulumi YAML uses the schema defined here to type check outputs from the
`pulumi:pulumi:StackReference` resource. This changes the type of
`outputs` from `map[string]string` to `map[string]any`, permitting list,
map, and numeric outputs to be used as inputs to other resources.

To release this fix, we will need to release Pulumi twice and YAML once
if we are to use our ordinary release process:

1. Merge this PR.
2. Release sdk and pkg dependencies with this update applied.
3. Merge pulumi/pulumi-yaml#600
4. Create and merge a PR to update Pulumi YAML's dependency on
`github.com/pulumi/pkg/v3`, as YAML links to the schema loader and will
read the updated schema here:

https://github.com/pulumi/pulumi/blob/7f48ca370d12e6d7fee29b7e1b6f87c9f558351e/pkg/codegen/schema/loader.go#L136-L140
 
5. Release Pulumi YAML
6. Create and merge a PR to update the YAML language plugin shipped with
Pulumi
7. Release Pulumi
Ensures that Pulumi YAML programs are able to use StackReference outputs as
"any" typed values. Allows "any" values to be assigned to any value, expanding
the set of valid programs.

Blocked on:
- pulumi/pulumi#16625

Using a Go workspace with that PR applied to Pulumi, the test suite passes.
@AaronFriel AaronFriel added impact/no-changelog-required This issue doesn't require a CHANGELOG update and removed impact/no-changelog-required This issue doesn't require a CHANGELOG update labels Jul 11, 2024
@AaronFriel AaronFriel merged commit 021ac5e into main Jul 11, 2024
5 checks passed
@AaronFriel AaronFriel deleted the friel/599 branch July 11, 2024 19:37
AaronFriel added a commit to pulumi/pulumi that referenced this pull request Jul 11, 2024
@pulumi-bot
Copy link

This PR has been shipped in release v1.9.1.

@@ -229,6 +229,10 @@ func (tc *typeCache) isAssignable(fromExpr ast.Expr, to schema.Type) *notAssigna
return nil
}

if from == schema.AnyType || to == schema.AnyType {
Copy link
Member

Choose a reason for hiding this comment

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

Allowing an implicit cast from any to T is unsound. I would have liked to have more discussion about introducing a checked cast instead of just weakening the type checker.

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.

4 participants