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

[go/sdk] Delegate alias computation to the engine #11935

Merged
merged 1 commit into from
Jan 26, 2023

Conversation

Zaid-Ajaj
Copy link
Contributor

Description

This PR removes the use of collapseAliases from the go SDK which used to calculate aliases of resources from ResourceOptions and their inherited child aliases (a.k.a. alias explosion) and starts using the new alias specification pulumirpc.Alias that is handled by the engine in a language-agnostic manner.

This PR removes aliases: []URNOutput from resourceState because we no longer have to keep track of them in makeResourceState but instead calculate them in prepareResourceInputs.

Fixes #11066
Potentially addresses #11697

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have run make changelog and committed the changelog/pending/<file> documenting my change
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

@pulumi-bot
Copy link
Contributor

pulumi-bot commented Jan 20, 2023

Changelog

[uncommitted] (2023-01-25)

Bug Fixes

  • [sdk/go] Delegate alias computation to the engine
    #11935

@Zaid-Ajaj Zaid-Ajaj force-pushed the zaid/go-alias-including-root-stack branch from fd8b7f5 to 3ad9a40 Compare January 20, 2023 17:58
@Zaid-Ajaj Zaid-Ajaj added language/go kind/enhancement Improvements or new features labels Jan 20, 2023
@Zaid-Ajaj Zaid-Ajaj force-pushed the zaid/go-alias-including-root-stack branch from e217164 to 59fb438 Compare January 20, 2023 18:43
Copy link
Contributor

@abhinav abhinav left a comment

Choose a reason for hiding this comment

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

RE: the question about testing:
Someone with more familiarity with the codebase might have a better answer but besides the integration tests, you may be able to install a fake ResourceMonitorClient, intercept RegisterResource calls, and verify that they contain the right Aliases information.

sdk/go/pulumi/context.go Outdated Show resolved Hide resolved
sdk/go/pulumi/context.go Outdated Show resolved Hide resolved
sdk/go/pulumi/context.go Outdated Show resolved Hide resolved
sdk/go/pulumi/context.go Outdated Show resolved Hide resolved
sdk/go/pulumi/context.go Outdated Show resolved Hide resolved
sdk/go/pulumi/context.go Outdated Show resolved Hide resolved
@Zaid-Ajaj Zaid-Ajaj force-pushed the zaid/go-alias-including-root-stack branch 3 times, most recently from 6fc4d5d to 4379808 Compare January 23, 2023 13:08
Copy link
Contributor

@abhinav abhinav left a comment

Choose a reason for hiding this comment

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

No issues on the implementation end.
Thanks for making all the fixes!
Is there a better way to test this than the ResourceMonitor mock I suggested earlier?

@Zaid-Ajaj Zaid-Ajaj force-pushed the zaid/go-alias-including-root-stack branch from 9a22567 to b5691ab Compare January 24, 2023 20:23
@Zaid-Ajaj
Copy link
Contributor Author

bors merge

bors bot added a commit that referenced this pull request Jan 26, 2023
11935: [go/sdk] Delegate alias computation to the engine r=Zaid-Ajaj a=Zaid-Ajaj


# Description

This PR removes the use of `collapseAliases` from the go SDK which used to calculate aliases of resources from `ResourceOptions` and their inherited child aliases (a.k.a. alias explosion) and starts using the new alias specification `pulumirpc.Alias` that is handled by the engine in a language-agnostic manner. 

This PR removes `aliases: []URNOutput` from `resourceState` because we no longer have to keep track of them in `makeResourceState` but instead calculate them in `prepareResourceInputs`. 

Fixes #11066
Potentially addresses #11697 

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Zaid Ajaj <zaid.naom@gmail.com>
@bors
Copy link
Contributor

bors bot commented Jan 26, 2023

Build failed:

@Zaid-Ajaj
Copy link
Contributor Author

bors retry

@bors
Copy link
Contributor

bors bot commented Jan 26, 2023

Build succeeded:

@bors bors bot merged commit 30b04f5 into master Jan 26, 2023
@bors bors bot deleted the zaid/go-alias-including-root-stack branch January 26, 2023 17:52
bors bot added a commit that referenced this pull request Jan 26, 2023
11997: Revert "[go/sdk] Delegate alias computation to the engine" r=Zaid-Ajaj a=Zaid-Ajaj

Reverts #11935 because we removed the correct fallback behaviour of `collapseAliases`

Co-authored-by: Zaid Ajaj <Zaid-Ajaj@users.noreply.github.com>
bors bot added a commit that referenced this pull request Feb 6, 2023
11981: Test retype remote component and child using aliases r=justinvp a=Zaid-Ajaj

# Description

Reproduces #11697 and expected to fail right now. Will rebase on #11935 once merged

Fixes #11697 (issue)

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Zaid Ajaj <zaid.naom@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features language/go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[sdks/go] Delegate alias computation to the engine
3 participants