feat: allow shadow variable updaters to read the solution#2029
Merged
triceo merged 9 commits intoTimefoldAI:mainfrom Jan 21, 2026
Merged
feat: allow shadow variable updaters to read the solution#2029triceo merged 9 commits intoTimefoldAI:mainfrom
triceo merged 9 commits intoTimefoldAI:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds the ability for shadow variable supplier methods (updater methods annotated with @ShadowSources) to optionally accept the solution as a parameter. This allows shadow variable calculations to read global solution data when needed.
Changes:
- Core implementation now supports shadow variable supplier methods with an optional solution parameter
- Quarkus and Spring Boot integrations updated to handle the new optional parameter
- Test coverage added for both parameterized and non-parameterized shadow variable suppliers
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| DeclarativeShadowVariableDescriptor.java | Adds logic to lookup supplier methods with optional solution parameter |
| VariableUpdaterInfo.java | Changes calculator from Function to BiFunction to pass solution |
| ChangedVariableNotifier.java | Adds getWorkingSolution() method to provide solution to calculators |
| SingleDirectionalParentVariableReferenceGraph.java | Updates to pass calculator accessor instead of lambda |
| DefaultShadowVariableSessionFactory.java | Updates to pass calculator accessor instead of lambda |
| TimefoldProcessor.java | Updates Quarkus build-time method lookup to handle optional solution parameter |
| IntegrationTestEntity.java | Adds test shadow variables with and without solution parameter |
| IntegrationTestSolution.java | Adds dummy method to support solution parameter test |
| TestdataStringLengthShadowEntity.java | Adds test shadow variables with and without solution parameter |
| TestdataStringLengthShadowSolution.java | Adds dummy method to support solution parameter test |
| TestdataBasicVarParameter*.java | New test domain classes demonstrating the feature |
| TestdataInvalidDeclarativeParameter*.java | New test domain classes for invalid parameter validation |
| TestdataCountingValue.java | Updated signature to accept solution parameter |
| TestdataConcurrentValue.java | Updated signature to accept solution parameter |
| RootVariableSourceTest.java | Adds test for invalid parameter type detection |
| ShadowVariableUpdateTest.java | Adds test for shadow variables with solution parameter |
...mefold/solver/core/impl/domain/variable/declarative/DeclarativeShadowVariableDescriptor.java
Outdated
Show resolved
Hide resolved
...st/java/ai/timefold/solver/core/impl/domain/variable/declarative/RootVariableSourceTest.java
Outdated
Show resolved
Hide resolved
...a/ai/timefold/solver/core/testdomain/shadow/parameter/TestdataBasicVarParameterSolution.java
Outdated
Show resolved
Hide resolved
...ava/ai/timefold/solver/core/testdomain/shadow/parameter/TestdataBasicVarParameterEntity.java
Outdated
Show resolved
Hide resolved
...mefold/solver/core/impl/domain/variable/declarative/DeclarativeShadowVariableDescriptor.java
Outdated
Show resolved
Hide resolved
...uarkus/deployment/src/main/java/ai/timefold/solver/quarkus/deployment/TimefoldProcessor.java
Outdated
Show resolved
Hide resolved
...uarkus/deployment/src/main/java/ai/timefold/solver/quarkus/deployment/TimefoldProcessor.java
Outdated
Show resolved
Hide resolved
core/src/test/java/ai/timefold/solver/core/impl/domain/variable/ShadowVariableUpdateTest.java
Outdated
Show resolved
Hide resolved
...est/java/ai/timefold/solver/core/impl/domain/solution/descriptor/SolutionDescriptorTest.java
Outdated
Show resolved
Hide resolved
...ation-test/src/main/java/ai/timefold/solver/spring/boot/it/domain/IntegrationTestEntity.java
Show resolved
Hide resolved
core/src/test/java/ai/timefold/solver/core/impl/domain/variable/ShadowVariableUpdateTest.java
Outdated
Show resolved
Hide resolved
Christopher-Chianelli
approved these changes
Jan 20, 2026
triceo
requested changes
Jan 21, 2026
Collaborator
triceo
left a comment
There was a problem hiding this comment.
I'm missing a change to solver documentation.
...mefold/solver/core/impl/domain/variable/declarative/DeclarativeShadowVariableDescriptor.java
Outdated
Show resolved
Hide resolved
.../test/java/ai/timefold/solver/core/testdomain/shadow/concurrent/TestdataConcurrentValue.java
Outdated
Show resolved
Hide resolved
.../src/test/java/ai/timefold/solver/core/testdomain/shadow/counting/TestdataCountingValue.java
Show resolved
Hide resolved
...uarkus/deployment/src/main/java/ai/timefold/solver/quarkus/deployment/TimefoldProcessor.java
Outdated
Show resolved
Hide resolved
triceo
reviewed
Jan 21, 2026
Collaborator
triceo
left a comment
There was a problem hiding this comment.
IMO the comments were addressed in a way that is not improving the situation.
...mefold/solver/core/impl/domain/variable/declarative/DeclarativeShadowVariableDescriptor.java
Outdated
Show resolved
Hide resolved
docs/src/modules/ROOT/pages/using-timefold-solver/modeling-planning-problems.adoc
Outdated
Show resolved
Hide resolved
docs/src/modules/ROOT/pages/using-timefold-solver/modeling-planning-problems.adoc
Outdated
Show resolved
Hide resolved
...uarkus/deployment/src/main/java/ai/timefold/solver/quarkus/deployment/TimefoldProcessor.java
Outdated
Show resolved
Hide resolved
...mefold/solver/core/impl/domain/variable/declarative/DeclarativeShadowVariableDescriptor.java
Show resolved
Hide resolved
docs/src/modules/ROOT/pages/using-timefold-solver/modeling-planning-problems.adoc
Show resolved
Hide resolved
triceo
approved these changes
Jan 21, 2026
0dfed1a to
78fd485
Compare
...est/src/main/java/ai/timefold/solver/quarkus/it/domain/TestdataStringLengthShadowEntity.java
Show resolved
Hide resolved
docs/src/modules/ROOT/pages/using-timefold-solver/modeling-planning-problems.adoc
Show resolved
Hide resolved
docs/src/modules/ROOT/pages/using-timefold-solver/modeling-planning-problems.adoc
Outdated
Show resolved
Hide resolved
docs/src/modules/ROOT/pages/using-timefold-solver/modeling-planning-problems.adoc
Show resolved
Hide resolved
...mefold/solver/core/impl/domain/variable/declarative/DeclarativeShadowVariableDescriptor.java
Show resolved
Hide resolved
...ation-test/src/main/java/ai/timefold/solver/spring/boot/it/domain/IntegrationTestEntity.java
Show resolved
Hide resolved
|
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.



No description provided.