Current Behavior **When Bolt runs an apply block in a plan, it uses PAL to compile a catalog. Before calling PAL.with_catalog_compiler, Bolt detects any collisions between facts, target vars, and plan vars, and shadows them as needed (see https://github.com/puppetlabs/bolt/blob/main/lib/bolt/catalog.rb#L71-L88) . However, this can cause a potential problem when plan variables are using local references. If plan variable $bar has a reference to plan variable $foo, and the target has a fact foo, Bolt will shadow the plan variable $foo. When the variables are passed on to the catalog compiler, PAL will be unable to deserialize the plan variables as the local reference for $bar is no longer valid (see https://github.com/puppetlabs/bolt/issues/2111). Desired Behavior Shadowing variables that collide with facts of the same name should not result in PAL being unable to deserialize plan variables due to a missing local reference. Because FromDataConverter assumes that the data it receives comes directly from ToDataConverter, the serialized plan variables should be passed as-is to the catalog compiler where they can be deserialized. After the plan variables are deserialized, PAL should then shadow any variables that collide with facts of the same name (and warn when this happens). |