Skip to content

fix: fail-fast on @PlanningEntity being used in a @ProblemFactCollectionProperty#1646

Merged
Christopher-Chianelli merged 2 commits into
TimefoldAI:mainfrom
Christopher-Chianelli:fix/problem-fact-collection-planning-entity-fail-fast
Jun 12, 2025
Merged

fix: fail-fast on @PlanningEntity being used in a @ProblemFactCollectionProperty#1646
Christopher-Chianelli merged 2 commits into
TimefoldAI:mainfrom
Christopher-Chianelli:fix/problem-fact-collection-planning-entity-fail-fast

Conversation

@Christopher-Chianelli

Copy link
Copy Markdown
Contributor

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

…ionProperty

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@sonarqubecloud

Copy link
Copy Markdown

@zepfred

zepfred commented Jun 12, 2025

Copy link
Copy Markdown
Contributor

Thank you for looking into and resolving the issue!

@Christopher-Chianelli Christopher-Chianelli merged commit d052cd9 into TimefoldAI:main Jun 12, 2025
43 checks passed
@Christopher-Chianelli Christopher-Chianelli deleted the fix/problem-fact-collection-planning-entity-fail-fast branch May 14, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants