Skip to content

chore: make score analysis/recommendations/update fail fast on inconsistent solution#2444

Open
Christopher-Chianelli wants to merge 3 commits into
TimefoldAI:no-loopsfrom
Christopher-Chianelli:chore/score-analysis-inconsistent-fail-fasty
Open

chore: make score analysis/recommendations/update fail fast on inconsistent solution#2444
Christopher-Chianelli wants to merge 3 commits into
TimefoldAI:no-loopsfrom
Christopher-Chianelli:chore/score-analysis-inconsistent-fail-fasty

Conversation

@Christopher-Chianelli

@Christopher-Chianelli Christopher-Chianelli commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Depends on #2443

Fail fast on inconsistent solution for SolutionManager's update and analyze methods.

@Christopher-Chianelli
Christopher-Chianelli force-pushed the chore/score-analysis-inconsistent-fail-fasty branch from 3bade17 to af16cb2 Compare June 30, 2026 12:16
@Christopher-Chianelli
Christopher-Chianelli marked this pull request as ready for review June 30, 2026 12:16

@triceo triceo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall LGTM, with some comments.
We should also clearly document the cases in which inconsistency is going to result in runtime failures, but that may wait for a later PR.

// Do nothing
}

public List<Object> getInconsistentEntities() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think a more fitting name would be computeInconsistentEntities to make it clear that this is expensive.

lastVariableUpdateWasSuccessful = variableListenerSupport.triggerVariableListenersInNotificationQueues();
}

public boolean isLastVariableUpdateWasSuccessful() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

IMO works equally as well, even better, without the "was" there. lastVariableUpdateSuccessful perhaps best.

throw new IllegalArgumentException("Can not call " + this.getClass().getSimpleName()
+ ".update() with this solutionUpdatePolicy (" + solutionUpdatePolicy + ").");
throw new IllegalArgumentException(
"Can not call %s.update() with this solutionUpdatePolicy (%s)."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I know this is not actually new, but maybe we add a hint as to why they cannot call this? Like this, the exception message is not very helpful.

TimefoldSolverEnterpriseService.loadOrFail(TimefoldSolverEnterpriseService.Feature.SCORE_ANALYSIS);
var currentScore = (Score_) scoreDirectorFactory.getSolutionDescriptor().getScore(solution);
var analysis = callScoreDirector(solution, solutionUpdatePolicy,
var analysis = callScoreDirector("Solution analysis", solution, solutionUpdatePolicy,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we call it "Score analysis", don't we?

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