core: Don't re-register checkable outputs during the apply step #31890
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.
Once again we're caught out by sharing the same output value node type between the plan phase and the apply phase. To allow for some slight variation between plan and apply without drastic refactoring here we just add a new flag to nodeExpandOutput which is true only during the planning phase.
This then allows us to register the checkable objects only during the planning phase and not incorrectly re-register them during the apply phase. It's incorrect to re-register during apply because we carry over the planned checkable objects from the plan phase into the apply phase so we can guarantee that the final state will have all of the same checkable objects that the plan did.
This avoids a panic during the apply phase from the incorrect duplicate registration. This closes #31846.