Skip to content

feat: add cloning fail fast check#2131

Merged
triceo merged 6 commits intoTimefoldAI:1.xfrom
zepfred:fix/valuerange
Feb 19, 2026
Merged

feat: add cloning fail fast check#2131
triceo merged 6 commits intoTimefoldAI:1.xfrom
zepfred:fix/valuerange

Conversation

@zepfred
Copy link
Contributor

@zepfred zepfred commented Feb 19, 2026

No description provided.

Copy link
Contributor

Copilot AI left a comment

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 adds a fail-fast validation to the deep-cloning subsystem to prevent invalid configurations where a basic planning variable is marked for deep cloning but its value type is not deep-clonable, and it adds a regression test plus minimal testdomain classes to cover the scenario.

Changes:

  • Add a fail-fast IllegalStateException in DeepCloningUtils.isFieldDeepCloned(...) for @PlanningVariable + @DeepPlanningClone fields whose type is not deep-cloned.
  • Introduce a dedicated invalid testdomain entity/solution that reproduces the configuration mistake.
  • Add a unit test asserting the new error message guidance.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
core/src/main/java/ai/timefold/solver/core/impl/domain/solution/cloner/DeepCloningUtils.java Adds the new validation and a helper to detect basic planning variables via field/getter annotations.
core/src/test/java/ai/timefold/solver/core/impl/domain/solution/cloner/AbstractSolutionClonerTest.java Adds a regression test asserting fail-fast behavior and message content.
core/src/test/java/ai/timefold/solver/core/testdomain/clone/deepcloning/field/invalid/TestdataInvalidEntityProvidingSolution.java New test solution used to trigger the invalid deep-clone configuration.
core/src/test/java/ai/timefold/solver/core/testdomain/clone/deepcloning/field/invalid/TestdataInvalidEntityProvidingEntity.java New test entity with @PlanningVariable and a deliberately invalid @DeepPlanningClone setup.

@triceo triceo added this to the v1.32.0 (Maintenance release) milestone Feb 19, 2026
@zepfred zepfred closed this Feb 19, 2026
@zepfred zepfred reopened this Feb 19, 2026
Copilot AI review requested due to automatic review settings February 19, 2026 14:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

@triceo triceo merged commit d538bcf into TimefoldAI:1.x Feb 19, 2026
20 checks passed
@zepfred zepfred deleted the fix/valuerange branch February 19, 2026 15:36
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.

2 participants

Comments