Skip to content

plan digest: say what a Pulumi digest covers and leaves out #5564

Done

Description

@lex00

packages/core/src/lifecycle/plan-digest.ts says: "Two plans share a digest exactly when applying either one would do the same thing". For a Pulumi stack that does not hold in either direction.

Two different changes can share a digest:

  • a secret value is recorded as one placeholder, since previews run without showing secrets, so a change from one secret value to another looks the same as any other;
  • a value unknown at preview time is recorded as one fixed string;
  • stack outputs and config are not in the digest;
  • a resource registered inside an apply() whose input is unknown is not in the preview at all (lexicons/pulumi/src/change-set.ts, header).

The same change can get two digests: the document digest includes names the engine draws again on each preview (filed separately).

The checks after the gate compare shape only (resources, actions, property names), so a value that changes between the gate and the update, such as a stack reference output or a data source read, is applied with no error.

Expected

The comment and the docs that repeat it say what the digest covers and what it leaves out, per engine. The Pulumi lexicon's docs list the four cases above next to the description of the digest, so a reviewer knows what an approval of a digest does not vouch for.

Done when

The claim in plan-digest.ts is replaced by a statement the Pulumi change set meets, and a docs page lists the cases.

Activity

  1. added
    documentation
    area:lifecycle
    on Nov 23, 2026
  2. lex00 commented on Nov 23, 2026

    @lex00
    ContributorAuthor

    Needs validation before anyone builds on it. These findings come from one read of the code and docs at origin/main on 2026-11-23, not from a run. The first step is to confirm each point against the code as it is now, and where the issue describes behaviour, to show it with a test or a claim. Correct the issue where the code disagrees.

  3. added
    epic:ci-hardening
    on Nov 24, 2026
  4. lex00 commented on Nov 24, 2026

    @lex00
    ContributorAuthor

    Validated against origin/main at c0108d6 by reading the code. Most points hold. Two are narrower than the issue says, and the drawn-name point is fixed by #5563's pull request.

    Confirmed

    • The claim is at packages/core/src/lifecycle/plan-digest.ts:15-18 ("Two plans share a digest exactly when applying either one would do the same thing to the estate"). docs/src/content/docs/guide/op-waves.mdx:77 repeats it ("two plans that would do the same thing share one").
    • Secrets. chant previews without showing secrets, and the preview prints a secret as "[secret]" (lexicons/pulumi/src/change-set.ts:84-85, lexicons/pulumi/src/values.ts:14-15). digestStep hashes the inputs as printed (change-set.ts:224-225), and the entry is sensitive: true with neither side (change-set.ts:349-357). A change from one secret value to another gives the same digest whatever the new value is.
    • Unknowns. A value unknown at preview is Pulumi's one sentinel string (values.ts:27), hashed as it is (change-set.ts:75).
    • Stack outputs. digestStep leaves out the states' outputs and the preview's config block (change-set.ts:69-71), and the recorded previews plan no stack outputs. A change that only moves a stack output is not in the digest. Config is narrower than the issue says: a config value that feeds a resource input is in the digest through that input. What is left out is config no input reads.

    Corrected

    • Resources registered inside an apply(). Most of them are covered. Under a component whose subtree waits on an unknown, the adapter writes a mayAppear entry at the component (change-set.ts:43-48). With the last deployment's export, a resource the preview leaves out gets an update entry marked mayAppear (change-set.ts:49-57). Both entries are in the document digest. They are not in the stack's own digest, which covers steps only (change-set.ts:244-250). What is left out is what the header names (change-set.ts:59-63): a resource registered directly under the stack that no export holds yet is absent, and one the export holds whose input is unknown reads as a plain delete.
    • The checks after the gate. For stock Pulumi they do compare shape only. pr-apply plans again and decides the gate on that plan's digest, values included. Then pulumi up plans once more, and the steps it ran are held to the approved shape (lexicons/pulumi/src/pulumi-up.ts:1042-1057), which compares resources, actions, types, property names and replacement (lexicons/pulumi/src/plan-shape.ts:41-70, packages/core/src/components/covered-round.ts:103-138). A value that moves between that last preview and up, without changing the shape, is applied with no error. On plunge the update applies the plan saved with the preview (pulumi-up.ts:1032-1040), so this gap is stock Pulumi's.
    • "The same change can get two digests." True at origin/main for the document digest, as pulumi: the approved document digest changes between previews when a resource's name is drawn, so apply before merge would refuse #5563 shows. After pulumi: the approved document digest changes between previews when a resource's name is drawn, so apply before merge would refuse #5563's fix a drawn name is unknown: true in the entry, so the document digest and the stack's digest leave out the same names. What still differs between two previews is a value the engine draws that the autoname rule does not recognise: one not listed in __defaults, or not the logical name plus seven hex characters (change-set.ts:200-214).

    The comment and docs pull request will follow #5563 and describe the code after that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:lifecycledocumentationepic:ci-hardening

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions