Skip to content

design: plunge - Pulumi with per-resource ownership, the engine tier for Pulumi stacks #2

Open

Description

@lex00

Design and tracking. Nothing here starts a build. It records the contract and splits the work into 6 milestones.

What

plunge is a fork of Pulumi with its state engine split into a new backend:
records per resource with conditional writes, ownership in marker tags. It's
the same size of rewrite choudoufu was for OpenTofu. A team can back out to
stock Pulumi. Backing out leaves one kind of change, removing the marker tags.

Milestones

P-L0 and P-L1 can start now. P-L2 follows P-L0. P-L3 is the long pole. P-L4
needs P-L3 and choudoufu H1 (INTENTIUS/choudoufu#2244). P-L5 follows P-L3.

Cross-cutting research (2026-10-25):

  • The hook is engine-wide. A native Go stack transform prepended when the
    resource monitor is built (pkg/resource/deploy/source_eval.go:2636-2659)
    sees every resource's type and inputs before Check, and can set markers,
    import and ignore_changes at once. A wrapper at the single provider-load
    point (pkg/resource/deploy/providers/registry.go:387,418) covers every
    provider's Read, Create and List. OpenTofu had neither, so choudoufu added
    its own seams.

  • What goes into the hook stays per family or per type, as in choudoufu.
    Pulumi's schema has no "taggable" concept. Marker placement is per family,
    schema-driven (bridged providers expose the Terraform schema through
    GetMapping). Import IDs are per type for bridged providers (the same
    Terraform importer strings) and one rule per family for native ones
    (aws-native primaryIdentifier, azure-native ARM ids, Kubernetes
    ns/name).

  • Policy remediations run after Check, too late for pulumi-aws's tagsAll.
    Resource hooks can't modify inputs.

  • Rough reuse of choudoufu's generated tables: about 90% for bridged
    providers, keyed through GetMapping; aws-native reuses the CloudFormation
    evidence directly.
    Verification (2026-10-25, pulumi 7e12743, bridge e21841e, pulumi-aws
    862029f, aws-native v1.83.1; one offline experiment against the
    pulumi-aws v7.43.0 plugin with stubbed endpoints, never applied):

  • tagsAll timing: PARTLY. A marker added after Check still reaches AWS,
    because the bridge re-diffs before Apply and upstream recomputes tags_all
    from tags plus default_tags; the next Diff is DIFF_NONE either way.
    Injecting before Check is still the right choice: it gets validation, a
    consistent stored tagsAll and a predictable diff. It covers map-style
    tags only. Other tag shapes need per-type handling.

  • Component children: VERIFIED. In-language components, multi-language
    components (Construct uses the same monitor address, no proxy) and Call
    all pass through stack transforms. Default providers skip them,
    ReadResource / .get() never reach them, explicit provider resources and
    component resources do, so plunge filters on custom, non-provider resources.
    During preview with unknown provider config, a component's children only
    appear at up.

  • aws-native metadata: PARTLY. Not available over the wire (GetSchema has
    no tag style or primary identifier, and there's no GetMapping). It's
    embedded in the binary and committed as
    provider/cmd/pulumi-resource-aws-native/metadata.json at every release
    tag: 1,682 types, 1,198 with tagsProperty, all with primaryIdentifier.
    plunge reads that file at the tag matching the provider version, with the
    CloudFormation schemas as a cross-check.

New risks for P-L4:

  • Run plunge's injection after the stack-transform loop, not prepended, so a
    user's own stack transforms can't strip or rewrite the markers.
  • A provider ignoreTags config matching the marker prefix drops the markers
    silently. plunge must detect and refuse it.
  • If tags is unknown during preview, the transform can't merge into it.
  • 484 aws-native types have no tags property, so markers can't land on them.
    They need record-carried ownership, as choudoufu does for untaggable types.
  • 53 aws-native types have tags as create-only (tagUpdatable: false, for
    example apprunner:Service). Adding a marker to an existing one probably
    forces replacement. Adoption must refuse those, never replace.

The demo and the order across repos

The demo: behold/example-three-cloud with one cloud's site on choudoufu, one
on Pulumi, dns staying chant. Default assignment: Azure site to choudoufu,
AWS site to Pulumi, GCP stays chant. Every member is in the engine tier:
ownership colours, per-resource drift, one shared change set.

Order across repos:

  1. chant: the drift record (C1) and rootReads in the graph IR (C2) come
    first, because behold's colour work reads them.
  2. behold milestones B1 to B4 and chant C3 (multi-engine C3: the pulumi lexicon chant#4453) to C6 then run in parallel.
  3. choudoufu H1 (multi-engine H1: pkg/identity choudoufu#2244) (pkg/identity) runs any time. H2 (single-resource plan path)
    runs any time and unlocks per-resource drift for choudoufu members.
  4. plunge is the long pole. Its state backend (P-L3) decides when the Pulumi
    member reaches the engine tier. Until then it shows in the stock tier.

Acceptance conventions for every sub-issue: verdict lines and recorded
artifacts, never exit codes alone. Anything needing an emulator corpus, an
estate run or a real cloud is run by the maintainer by hand. Red-first only for
new guards.

What plunge brings

Stock Pulumi has no way to find a live resource by its marker. That isn't a gap in plunge. It's the core of what plunge adds, the same way choudoufu added marker discovery that stock OpenTofu never had. plunge's own work list for the concurrency claims (see the parity table in the comments):

  1. Marker lookup: bind a planned create to the live object carrying its marker, and refuse when two objects carry it. This is the biggest item.
  2. Deterministic autonames, so a uniqueness constraint settles two creates of one resource.
  3. Splitting out per-stack state (Stack outputs, provider IDs, secrets config, pending operations) into per-resource records.

Where the marker listings come from:

  • Not from Pulumi providers. List is unimplemented for SDKv2-bridged types (pkg/tfbridge/provider.go:2065-2072), and aws-native's Cloud Control listing has no tag filter. plunge calls the clouds directly, as choudoufu does: the AWS tagging API, Cloud Control, and the GCP, Azure and Kubernetes sweeps.
  • Most of that code lifts from choudoufu. internal/live/cloudcontrol, azsweep, gcpsweep and kubesweep have no OpenTofu-specific imports. discovery and listclient are tied to OpenTofu types and get ported, not reused.
  • Binding uses strongly consistent per-type listings, as choudoufu's does. The estate-wide tagging sweep is eventually consistent and can miss a duplicate for a run, so it can't carry the collision claim alone.

Sibling epics

Activity

  1. added
    epic
    multi-engine
    on Oct 25, 2026
  2. lex00 commented on Oct 25, 2026

    @lex00
    ContributorAuthor

    Concurrency claim parity with choudoufu (vetted 2026-10-25)

    The goal is for plunge to make the same resource-level concurrency claims choudoufu makes (live/CONCURRENCY.md). Each claim was checked against stock Pulumi source (pulumi 7e12743, bridge e21841e). This is a read of the source; nothing was run. plunge can reach parity on all six claims. None of them comes free.

    Claim (choudoufu) choudoufu mechanism Stock Pulumi plunge requirement Feasibility
    C1 two creates of a client-named resource uniqueness constraint rejects the second; the loser binds the winner by marker random autoname suffix (pkg/resource/autonaming/strategy.go:243-262, seeded per run at deploy/step_generator.go:1172-1187), so the creates never collide; no bind step, so the loser retries forever deterministic pulumi:autonaming pattern (no ${hex}), plus a marker-bind phase before step generation significant
    C2 two creates of a server-assigned resource per-type marker listing; collisionProblem refuses naming both IDs duplicates go undetected a consistent per-type tagged lister per family, and a collision refusal. SDKv2 bridged types have no List (bridge/pkg/tfbridge/provider.go:2065-2072) significant; a blocker for SDKv2 types until a lister exists
    C3 divergent in-place updates, saved plan refused every plan reads live; the INTENTIUS/choudoufu#878 before/after gate refuses a moved value no refresh by default; a plan stores only the input diff, no before-values (step_generator.go:1446-1449), so a moved value isn't refused refresh by default (or on record conflict); record versions or old-output hashes in the plan; refuse on change significant
    C4 update racing a destroy not-found, then re-plan the update errors, and the next run diffs a stale checkpoint CAS delete of the record; the loser's write gets not-found and re-plans straightforward
    C5 record store unlocked; disjoint applies both land (#1938) staterecord: If-None-Match / If-Match per record; only changed records are written; one record per output one checkpoint behind a stack lock. The DIY lock is check, write, re-check (pkg/backend/diy/lock.go:130-154). gocloud.dev has no If-Match records per URN, never rewritten when unchanged; Stack outputs split into a record each; deterministic provider IDs; vendor choudoufu's staterecord (plain Go, MPL-2.0 file-level, fine in an Apache-2.0 tree) significant
    C6 nothing held; a crash is a re-run the marker rode the create call; records are written per step a lock file; pending creates block the next run remove the lock; per-resource pending records cleared by marker bind straightforward once C1's bind exists

    Shared per-stack state that has to be designed out:

    • Stack outputs on the root Stack resource need one CAS'd record per output, as choudoufu's projection/rootoutput.go does.
    • Provider resources get a random UUID ID (deploy/providers/registry.go:957-965). Two runs creating the default provider leave dangling URN::ID references, and VerifyIntegrity fails (deploy/snapshot.go:680-718). Provider IDs must be deterministic, or created with put-if-absent.
    • A missing parent or dependency also fails integrity. The snapshot has to be assembled from records, sorted, and refused by name, not crashed.
    • The secrets config needs to be one immutable put-if-absent record.
    • Pending operations need to be per resource.

    Coverage-only (these shrink which types the claims cover, as choudoufu's readiness table does): untaggable types, tag_on_create: false types (choudoufu carves out the same window), non-map tag shapes, and ignoreTags / defaultTags that hide markers (refused by name).

    Outside the claims, as in choudoufu: deletes from a run on an older commit. choudoufu's "Serialize applies against one estate in CI anyway" (CONCURRENCY.md:57-59) is advice, not a claim, and plunge copies the sentence word for word.

    Decisions before P-L3 and P-L4 can promise parity

    1. Autonaming policy: enforce a deterministic pattern and accept delete-before-replace, or class autonamed types as server-assigned under C2.
    2. The marker-bind and collision phase, and its lister per provider family. Reuse choudoufu's cloudcontrol and the sweeps (no tofu-specific imports). discovery / listclient would be a port. Decide what covers SDKv2 types.
    3. The record schema: a key per URN, a key per output, provider records with deterministic IDs, an immutable secrets record.
    4. A refresh policy that makes "the next plan converges" true.
    5. Before-values or record versions in plan files, and the refusal exit code.
    6. The backend set (S3; Azure Blob; GCS, once measured beyond the emulator; local, one host only; Kubernetes optional), vendored from staterecord, with the stack lock removed.
    7. The CI-serialization sentence, copied word for word.

    Proofs to mirror: choudoufu's claim 2 (no-self-managed-locks, two-writers-one-record, cas-holds-under-every-sse-flavour), claim 5 (recovery-is-a-rerun), claim 15 (saved-plan refusal). choudoufu's own gaps worth knowing: no smoke scenario for C2, and the disjoint half of C5 is unit-tested only (#1938, INTENTIUS/choudoufu#1944).

  3. transferred this issue fromINTENTIUS/choudoufuon Oct 25, 2026
  4. added a commit that references this issue on Oct 25, 2026
  5. lex00 commented on Oct 25, 2026

    @lex00
    ContributorAuthor

    Path 2 plunge reds fixed. Merge commit 87bd15d on integration/pulumi-engine (unit/fix-epic2-reds; tested at b379516, merged over 6745532, which added only corpus data).

    Per failure, and whether the code or the test was wrong:

    • pkg/resource/deploy TestGenerateResourceStepsNormalizesGoalAfterMigration (upstream test). It passes at the fork point 7e12743, so plunge broke it. The code was wrong: checkProviderMarkers, bindMarkers (plunge_markers.go) and plungeAutoname (plunge_autonaming.go) read sg.deployment.Target().Markers etc. with no nil check, and this test builds a step generator with no target. A nil target now means no seam, the same as the delete guard already did (step_generator.go:2715).
    • pkg/engine/lifecycletest, the five P-L3/P-L4 seam tests. Their assertions passed; what failed was the missing golden display output (testdata/output//.../eventstream.json), because the tests were written and never run. I generated it with PULUMI_ACCEPT=true and read through it (delete guard keeps resB/resC as same and deletes resD; the binder collision prints "collision: live-1 and live-2"). Test data only, no code change. 10 repeated runs pass.
    • pkg/cmd/pulumi TestGetCLIMetadata (upstream test). The code was wrong. P-L0's "pulumi" + TrimPrefix(cmd.CommandPath(), cmd.Root().Name()) turned a command with no parent (Use "version") into "pulumi". Now only a root named plunge.BinaryName gets mapped to "pulumi"; every other root keeps its own path, as upstream does (pulumi.go:716).
    • pkg/cmd/pulumi TestUnknownCommandSuggestions and TestBareRootPrintsHelpAndFails (upstream tests). The tests were wrong after P-L0 deliberately renamed the root command to plunge. Subcommand help still says pulumi, but cobra's own "unknown command ... for X", its suggestions and "X requires a subcommand" come from the root name. The tests now build the expected strings from plunge.BinaryName.
    • pkg/backend/plunge TestAdoptionIsRecordedAndReRunIsANoOp panic. Test bug: the fixture built its diag sink with an empty FormatOptions, so Color was unset. Fixed with colors.Never, as the diy tests do. The panic had stopped the rest of the package from running. Once it was fixed, the package showed these further failures:
      • Eight tests failed with "duplicate resource ... (not marked for deletion)" and CloneSnapshot's DeepEqual assert. Test bug, in both harnesses (plunge_test.go runUpdate, markers_test.go run): the target got lt.GetTarget's clone of the base snapshot while the snapshot manager got the original. The manager tracks base states by identity, so every base state was saved twice. backend.go's apply gives both the same snapshot, and the harnesses now do too.
      • The package hung until the 10-minute timeout (TestTwoFirstRunsConvergeOnOneDefaultProvider, TestCollisionIsRefusedNamingBothIDs). Test bug: the harness's deferred host Close ran after cancelSrc.Terminate. The engine's own closer goroutine (engine/deployment.go:269) also fires on terminate, and two concurrent deploytest pluginHost.Close calls both send on the stop channel, so one blocks forever. The host is now closed before Terminate. 600 repeated runs pass.
      • TestAdoptionIsGated: magic cookie mismatch. Test bug: the hand-built stock checkpoint had Manifest.Version "test" and no Magic. A checkpoint the stock CLI writes always has a valid one, so the fixture now computes it.
      • A nil-interface panic in the fake cloud's Create (autoname_test.go). Test bug: it called StringValue on "name" before checking for the bucket type.
      • TestTwoFirstRunsConvergeOnOneDefaultProvider sometimes failed (3 in 30) with "the record at .../secrets is not JSON: unexpected end of JSON input". This is a code bug in the vendored staterecord LocalStore.PutIfAbsent: an O_CREATE|O_EXCL open followed by a write, so a concurrent Get could read the empty file. That broke the store's own doc promise that a reader never sees a half-written file. It now writes a temp file and os.Link()s it into place: the link fails if the name exists, and the name only appears with the whole payload. NOTICE now lists local.go as modified. choudoufu's internal/live/staterecord/local.go has the same race.
      • TestTwoConcurrentUpdatesOnDisjointResourcesBothLand sometimes failed (2 in 30): one of the two changes was missing and neither run errored. Test bug: each goroutine loaded the records itself, so the second run could start after the first had landed. It then read resX=2 and planned it back to its own program's 1, which is correct last-run-wins behaviour, not a lost update. Both runs now load the same base before either starts (runUpdateFrom). 500 repeated runs pass. The record backend's disjoint-update claim held in every run where the two runs really did share a base.

    Final runs, all from the unit branch:

    • go test ./backend/plunge/... ./cmd/pulumi/... ./engine/lifecycletest/ ./resource/deploy/... ./resource/autonaming/ ./plunge/... three times in a row with -count=1: every package ok each time.
    • go test ./backend/plunge/... -count=50: ok. go test -race ./backend/plunge/ -count=3: ok, with no race reports.
    • Upstream check, go test ./backend/diy/... ./backend/httpstate/... ./engine/...: ok for backend/diy, diy/unauthenticatedregistry, httpstate, httpstate/client, httpstate/journal, engine, engine/encryptedlog and engine/lifecycletest.

    Still open: nothing in this list. The choudoufu copy of LocalStore.PutIfAbsent needs the same fix in that repo.

  6. lex00 commented on Oct 25, 2026

    @lex00
    ContributorAuthor

    Path 2 of the multi-engine engine tier is on main: plunge d6db28a, chant 867a12c65, behold 9f7066ee (merge commits of integration/pulumi-engine, trees identical to the tested tips; path 1 was already on main). Units: P-L1, P-L2, P-L5 closed; P-L0, P-L3, P-L4 ready for the maintainer (see each). Concurrency races C1 to C6 on floci are the maintainer's to run.

  7. lex00 commented on Oct 27, 2026

    @lex00
    ContributorAuthor

    Design record update (plunge#37, merged into integration/consolidation-graph at 3cad609): plunge keeps per-resource records holding the full state. Ownership markers bind creates and now also vet deletes. Before any delete, destroy included, the live object must carry this stack's markers. A marker naming another stack, or a missing marker on a type that takes one, refuses the run (ruled 2026-10-26, "refuse, like choudoufu"). Types that carry no marker are record-owned and delete on the record's word. docs/plunge/CONCURRENCY.md, section "Deletes: the marker decides", has the details.

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

    epicmulti-engine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions