feat(templates): infer transactional flag from apply payload metadata#860
Merged
feat(templates): infer transactional flag from apply payload metadata#860
Conversation
00b94bc to
8d57015
Compare
When the user omits `transactional` in YAML, the builder now inspects apply payloads' `TemplatePayloadInfo.getSupportsTransactions()` to determine the correct value, instead of always defaulting to `true`. - If **any** apply payload claims `supportsTransactions=false` → infer `false` - Otherwise → infer `true` (all claim true, unclaimed, mix, or null/empty) - Explicit YAML values (`transactional: true/false`) always take precedence Additionally, preserves the original `transactionalFlag` (raw user input) separately from the resolved `transactional` boolean throughout the loaded/executable layer: - `getTransactionalFlag()` → `Optional<Boolean>` — original raw flag from YAML/annotation, preserved unchanged in `AbstractTaskDescriptor` - `isTransactional()` → `boolean` — resolved truth, stored in a dedicated field in `AbstractLoadedTask` **Changes:** - **AbstractLoadedTask**: add `private final boolean transactional` field; constructor now accepts both `Boolean transactionalFlag` and `boolean transactional`, passing the original flag to `super()` and storing the resolved value separately - **Constructor chain** (AbstractReflectionLoadedTask, AbstractLoadedChange, CodeLoadedChange, AbstractTemplateLoadedChange, SimpleTemplateLoadedChange, MultiStepTemplateLoadedChange): thread both parameters through - **CodeLoadedTaskBuilder / TemplateLoadedTaskBuilder**: pass both `transactionalFlag` (original) and `resolvedTransactional` (computed) to loaded change constructors - **TemplateLoadedTaskBuilder**: add `inferTransactionalFromPayloads()`, `resolveTransactional()`, and `resolveTransactionalFromSteps()` methods replacing the hardcoded `null → true` fallback - **SimpleTemplateLoadedTaskBuilderTest**: add `NonTxPayload`, `TxPayload`, `NonTxTemplate`, `TxTemplate` test infrastructure and 6 inference tests - **SteppableTemplateLoadedTaskBuilderTest**: add equivalent test infrastructure with steppable templates and 7 inference tests
8d57015 to
8bc767b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When the user omits
transactionalin YAML, the builder now inspectsapply payloads'
TemplatePayloadInfo.getSupportsTransactions()todetermine the correct value, instead of always defaulting to
true.supportsTransactions=false→ inferfalsetrue(all claim true, unclaimed, mix, or null/empty)transactional: true/false) always take precedenceChanges:
inferTransactionalFromPayloads(),resolveTransactional(), andresolveTransactionalFromSteps()methodsreplacing the hardcoded
null → truefallbackNonTxPayload,TxPayload,NonTxTemplate,TxTemplatetest infrastructure and 6 inference testsinfrastructure with steppable templates and 7 inference tests