Skip to content

fix(constraint-streams): fact-based precompute() correctly propagates#2338

Merged
triceo merged 1 commit into
TimefoldAI:mainfrom
triceo:precompute-fact-fix
Jun 8, 2026
Merged

fix(constraint-streams): fact-based precompute() correctly propagates#2338
triceo merged 1 commit into
TimefoldAI:mainfrom
triceo:precompute-fact-fix

Conversation

@triceo

@triceo triceo commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Identified and fixed by Claude as a side effect of doing something else.
If you have a better idea of fixing this, be my guest.

@triceo triceo self-assigned this Jun 7, 2026
@triceo triceo added this to the v2.3.0 milestone Jun 7, 2026

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 precompute propagation so that output tuples derived purely from problem facts are emitted downstream and properly retracted when the precompute cache is invalidated (for example, after problem fact removal).

Changes:

  • Add tracking and replay for fact-only output tuples in RecordAndReplayPropagator, including proper retraction on cache invalidation.
  • Extend the precompute test suite with a regression test that removes a problem fact and verifies the corresponding tuple is retracted.

Reviewed changes

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

File Description
core/src/main/java/ai/timefold/solver/core/impl/bavet/common/RecordAndReplayPropagator.java Ensures fact-derived output tuples are recorded once, inserted downstream, and later retractable on cache invalidation.
core/src/test/java/ai/timefold/solver/core/impl/score/stream/common/uni/AbstractUniConstraintStreamPrecomputeTest.java Adds a regression test covering precompute(forEachUnfiltered(factClass)) behavior across problem fact removal.

@sonarqubecloud

sonarqubecloud Bot commented Jun 7, 2026

Copy link
Copy Markdown

@triceo triceo changed the title fix(constraint-streams): precompute on facts correctly propagates fix(constraint-streams): fact-based precompute() correctly propagates Jun 8, 2026
@triceo triceo merged commit 816b130 into TimefoldAI:main Jun 8, 2026
19 checks passed
@triceo triceo deleted the precompute-fact-fix branch June 8, 2026 05:28
@triceo triceo modified the milestones: v2.3.0, v2.2.0 Jun 8, 2026
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