fix(registeredscript): resolve version diff detection issue#52
Merged
Conversation
This fixes an issue where RegisteredScript would always detect a version diff even when the version hadn't changed, causing unnecessary replacements. Root cause: Pulumi's struct embedding doesn't properly deserialize the version field into the embedded RegisteredScriptResourceArgs struct, causing req.State.Version to be empty during Diff comparison. Changes: - Made version field optional in struct tag for backwards compatibility with existing state (Create still validates version is provided) - Updated Diff method to only compare version when both state and inputs have non-empty values Also updates ISSUES-TO-FIX.md with resolution status for Issues 1, 2, and 4, and documents two new issues discovered during testing (Asset variants parsing and CollectionItem slug uniqueness). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
Does the PR have any schema changes?Found 1 breaking change: Resources
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical issue where RegisteredScript resources would incorrectly detect version changes on every Pulumi run, causing unnecessary resource replacements that broke dependent SiteCustomCode resources. The root cause was Pulumi's struct embedding not properly deserializing the version field into the embedded struct during Diff operations.
Changes:
- Made the
versionfield optional in the schema and provider struct tags for backwards compatibility with existing state - Updated the Diff method to only compare versions when both state and input values are non-empty, preventing false positives
- Validation in the Create method still requires version to be provided for new resources
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| provider/registeredscript_resource.go | Added optional tag to Version field and updated Diff logic to handle empty state versions from deserialization issues |
| provider/cmd/pulumi-resource-webflow/schema.json | Removed version from required fields list |
| sdk/python/pulumi_webflow/registered_script.py | Made version optional parameter (moved after can_copy), removed constructor validation, changed return type to Optional |
| sdk/nodejs/registeredScript.ts | Made version optional in args interface and changed output type to allow undefined |
| sdk/go/webflow/registeredScript.go | Changed Version to StringPtrOutput and removed constructor validation |
| sdk/java/src/main/java/io/github/jdetmar/pulumi/webflow/RegisteredScriptArgs.java | Made version @nullable, removed required=true, changed return type to Optional, removed validation |
| sdk/java/src/main/java/io/github/jdetmar/pulumi/webflow/RegisteredScript.java | Changed version output to Optional wrapper |
| sdk/dotnet/Webflow/RegisteredScript.cs | Made version nullable string and removed required attribute |
| ISSUES-TO-FIX.md | Updated status for resolved issues and documented new issues discovered during testing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes an issue where RegisteredScript would always detect a version diff even when the version hadn't changed, causing unnecessary replacements that broke SiteCustomCode (Issue 2).
Root cause: Pulumi's struct embedding doesn't properly deserialize the version field into the embedded
RegisteredScriptResourceArgsstruct, causingreq.State.Versionto be empty during Diff comparison.Changes:
Test plan
make test_provider)siteCustomCodeUpdatedoutput shows valid timestampRelated Issues
Updates ISSUES-TO-FIX.md:
🤖 Generated with Claude Code