Skip to content

don't register resource outputs for skipped creates#21957

Merged
tgummerer merged 4 commits intomasterfrom
tg/snapshot-panic
Feb 26, 2026
Merged

don't register resource outputs for skipped creates#21957
tgummerer merged 4 commits intomasterfrom
tg/snapshot-panic

Conversation

@tgummerer
Copy link
Copy Markdown
Collaborator

Sometimes (in particular for new resources in the program that are untargeted, or when using --run-program), we generate "skipped creates", which are the engines way of pretending we create a resource, but leaving it out of the snapshot.

However for component resources, at the point of generating that skipped create, we've already started running Construct, which will subsequently call registerOutputs, as we require all component resources to do.

This becomes a problem in particular with journaling, as there, when registering outputs, we try to replace a resource in the snapshot with the new updated resource with the new outputs. However, since we have a skipped create, the resource is never registered in the snapshot in the first place, and we panic when trying to find the resource to replace.

Fix this by exiting early from registerResourceOutputs if the associated resource registration was a skipped create. This fixes the panic.

Fixes #21463
Closes #21490

@tgummerer tgummerer requested a review from a team as a code owner February 25, 2026 15:20
registerComponent = true

_, err = lt.TestOp(Update).RunStep(p.GetProject(), p.GetTarget(t, nil), opts, false, p.BackendClient, nil, "1")
require.NoError(t, err)
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.

Worth asserting that the component isn't in the snapshot?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I think that's a good idea. Done ✔️

@tgummerer tgummerer enabled auto-merge February 26, 2026 10:19
@julienp julienp mentioned this pull request Feb 26, 2026
@julienp
Copy link
Copy Markdown
Contributor

julienp commented Feb 26, 2026

/rebase

Sometimes (in particular for new resources in the program that are
untargeted, or when using `--run-program`), we generate "skipped
creates", which are the engines way of pretending we create a
resource, but leaving it out of the snapshot.

However for component resources, at the point of generating that
skipped create, we've already started running `Construct`, which will
subsequently call `registerOutputs`, as we require all component
resources to do.

This becomes a problem in particular with journaling, as there, when
registering outputs, we try to replace a resource in the snapshot with
the new updated resource with the new outputs.  However, since we have
a skipped create, the resource is never registered in the snapshot in
the first place, and we panic when trying to find the resource to
replace.

Fix this by exiting early from registerResourceOutputs if the
associated resource registration was a skipped create. This fixes the panic.
@tgummerer tgummerer added this pull request to the merge queue Feb 26, 2026
Merged via the queue into master with commit 2218a50 Feb 26, 2026
111 checks passed
@tgummerer tgummerer deleted the tg/snapshot-panic branch February 26, 2026 14:32
github-merge-queue Bot pushed a commit that referenced this pull request Feb 26, 2026
#21953 is in the merge queue,
freeze after that lands.

Also waiting for #21957 to merge

##  (2026-02-26)

### Features

- [backend/diy] Add zstd compression option for DIY backend state files
  [#21877](#21877)


### Bug Fixes

- [pkg] Correct the schema for "pulumi:pulumi:StackReference"
  [#21895](#21895)

- [programgen/nodejs] Correct the semantics of singleOrNone in generated
files
  [#21947](#21947)

- [sdk/python] Fix `StepEventMetadata.from_json` reading `detailed_diff`
(snake_case) instead of `detailedDiff` (camelCase), and
`PolicyEvent.from_json` reading `resource_urn` instead of `resourceUrn`,
causing both fields to always be `None`
  [#21714](#21714)

- [sdk/python] Convert integer component inputs to `int`
  [#21944](#21944)

- [sdk/python] Fix crash in forked processes using automation API
  [#21937](#21937)


### Miscellaneous

- [sdk] Update java, dotnet & yaml
  [#21961](#21961)

- [sdk/python] Improve the performance of `contains_unknowns` for large
objects
  [#21893](#21893)
julienp added a commit that referenced this pull request Feb 26, 2026
- [engine] Automatically make invoke outputs secret when there is a secret input, and the invoke provider does not support secrets
  [#21959](#21959)

- [backend/diy] Add zstd compression option for DIY backend state files
  [#21877](#21877)

- [cli/package] Support source-based packages in `pulumi schema check`, not just schema files
  [#21897](#21897)

- [engine] Fix panic when a new component resource in the program is not targeted
  [#21957](#21957)

- [cli/state] `state move` now correctly handles reparenting of resources
  [#21953](#21953)

- [pkg] Correct the schema for "pulumi:pulumi:StackReference"
  [#21895](#21895)

- [programgen/nodejs] Correct the semantics of singleOrNone in generated files
  [#21947](#21947)

- [sdk/python] Fix `StepEventMetadata.from_json` reading `detailed_diff` (snake_case) instead of `detailedDiff` (camelCase), and `PolicyEvent.from_json` reading `resource_urn` instead of `resourceUrn`, causing both fields to always be `None`
  [#21714](#21714)

- [sdk/python] Convert integer component inputs to `int`
  [#21944](#21944)

- [sdk/python] Fix crash in forked processes using automation API
  [#21937](#21937)

- [sdk] Update java, dotnet & yaml
  [#21961](#21961)

- [sdk/python] Improve the performance of `contains_unknowns` for large objects
  [#21893](#21893)
@pulumi-bot
Copy link
Copy Markdown
Contributor

This PR has been shipped in release v3.224.0.

@pulumi-bot
Copy link
Copy Markdown
Contributor

This PR has been shipped in release v3.225.0.

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.

Panic in JournalSnapshotManager.findResourceInNewOrOld when using --target with new ComponentResource

4 participants