Fix #772 ComputedPartialFailFast - #875
Merged
Merged
Conversation
Add withFieldComputedPartialFailFast, withFieldComputedPartialFromFailFast, withSealedSubtypeHandledPartialFailFast, withEnumCaseHandledPartialFailFast, withConstructorPartialFailFast, and withConstructorPartialToFailFast methods to PartialTransformerInto and PartialTransformerDefinition (both Scala 2 and 3). These methods accept functions that take a `failFast: Boolean` parameter, allowing users to optimize partial computations based on whether fail-fast mode is active. Field/subtype functions use `(From, Boolean) => Result[U]`, constructor functions use curried `(a, b) => (failFast) => Result[To]`. Internally, functions are stored curried (`A => Boolean => Result[B]`) to work with chimney-macro-commons' Function1-only Expr.apply support.
Add "Fail-fast-aware partial computations" subsection to supported-transformations.md with a runnable Scala CLI snippet demonstrating withFieldComputedPartialFailFast behavior with transform vs transformFailFast. All doc snippets pass.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #875 +/- ##
==========================================
- Coverage 86.08% 85.04% -1.05%
==========================================
Files 154 154
Lines 6923 7116 +193
Branches 779 794 +15
==========================================
+ Hits 5960 6052 +92
- Misses 963 1064 +101 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
MateuszKubuszok
force-pushed
the
issue-772-computed-partial-fail-fast
branch
from
April 25, 2026 05:53
59d73e3 to
3dfe210
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.
Summary
Closes #772.
Adds fail-fast-aware variants of partial transformer DSL methods. These accept functions that receive a
failFast: Booleanparameter, allowing users to optimize partial computations based on whether.transform(collects all errors,failFast = false) or.transformFailFast(stops at first error,failFast = true) was used.New methods
Added to both
PartialTransformerIntoandPartialTransformerDefinition(Scala 2.12, 2.13, and 3):withFieldComputedPartialFailFast(From, Boolean) => partial.Result[U]withFieldComputedPartialFromFailFast(S, Boolean) => partial.Result[U]withSealedSubtypeHandledPartialFailFast(Subtype, Boolean) => partial.Result[To]withEnumCaseHandledPartialFailFastwithConstructorPartialFailFast(a, b, ...) => (failFast: Boolean) => partial.Result[To]withConstructorPartialToFailFastExample
Implementation details
ComputedPartialFailFast,ComputedPartialFromFailFast,CaseComputedPartialFailFast,ConstructorPartialFailFastadded toTransformerOverridesfailFastAware: Booleanflag onTransformerOverride.ComputedPartialandConstructorPartialA => Boolean => Result[B]) sincechimney-macro-commonsonly supportsExpr.applyforFunction1TransformProductToProductRuleModuleandTransformSealedHierarchyToSealedHierarchyRuleModuleupdated to threadctx.failFastwhenfailFastAware = trueTests
withFieldComputedPartialFailFastpasses correctfailFastviatransformandtransformFailFastwithFieldComputedPartialFromFailFastvariantwithSealedSubtypeHandledPartialFailFastfor sealed hierarchiesPartialTransformer.definebuilder variantDocumentation
supported-transformations.mdfailFastflag behavior