fix: fail-fast on @PlanningEntity being used in a @ProblemFactCollectionProperty#1646
Merged
Christopher-Chianelli merged 2 commits intoJun 12, 2025
Conversation
…ionProperty The old test classes had different issues that caused a different fail-fast; those issues are now removed.
9 tasks
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the fail-fast behavior when a @PlanningEntity is mistakenly marked with a @ProblemFactCollectionProperty by updating the annotations in various test and benchmark files.
- Replaced incorrect @ProblemFactCollectionProperty annotations with the appropriate @PlanningEntityCollectionProperty or @PlanningEntityProperty in solution classes.
- Updated tests in the core module to validate the new fail-fast behavior and ensured the SolutionDescriptor correctly processes array types.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| quarkus-integration/quarkus-benchmark/integration-test/src/main/java/ai/timefold/solver/quarkus/benchmark/it/domain/TestdataStringLengthShadowSolution.java | Changed the annotation on valueList to use the proper entity annotation. |
| core/src/test/java/ai/timefold/solver/core/testdomain/shadow/inverserelation/TestdataInverseRelationSolution.java | Updated the annotation to represent planning entities rather than problem facts. |
| core/src/test/java/ai/timefold/solver/core/testdomain/invalid/entityannotatedasproblemfact/TestdataEntityAnnotatedAsProblemFactSolution.java | Replaced the annotation on getEntity() and added an accessor for the fact version. |
| core/src/test/java/ai/timefold/solver/core/testdomain/invalid/entityannotatedasproblemfact/TestdataEntityAnnotatedAsProblemFactCollectionSolution.java | Added a separate getter with a fact annotation for clarity in test coverage. |
| core/src/test/java/ai/timefold/solver/core/testdomain/invalid/entityannotatedasproblemfact/TestdataEntityAnnotatedAsProblemFactArraySolution.java | Defined array-based accessors for both planning entities and problem facts. |
| core/src/test/java/ai/timefold/solver/core/impl/domain/solution/descriptor/SolutionDescriptorTest.java | Adjusted tests to trigger fail-fast exceptions on the corrected annotation usage. |
| core/src/main/java/ai/timefold/solver/core/impl/domain/solution/descriptor/SolutionDescriptor.java | Enhanced the handling of array types in property annotations for accurate generic type extraction. |
Comments suppressed due to low confidence (1)
core/src/test/java/ai/timefold/solver/core/testdomain/invalid/entityannotatedasproblemfact/TestdataEntityAnnotatedAsProblemFactSolution.java:29
- [nitpick] A brief comment describing the intended difference between getEntity() and the newly added getEntityAsFact() could clarify their distinct roles in the test scenarios.
@PlanningEntityProperty
|
zepfred
approved these changes
Jun 12, 2025
Contributor
|
Thank you for looking into and resolving the issue! |
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.



The old test classes had different issues that caused a different fail-fast; those issues are now removed.