Skip to content

chore: remove the AbstractSimpleModel - #1279

Open
rsynek wants to merge 1 commit into
developmentfrom
chore/remove-abstract-simple-model
Open

rsynek wants to merge 1 commit into
developmentfrom
chore/remove-abstract-simple-model

Conversation

@rsynek

@rsynek rsynek commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Copilot AI balanced review requested due to automatic review settings December 4, 2026 09:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the model’s transition to explicit interfaces and score handling.

No open issues 🎉

What changed in this PR

Updates the school timetabling service model to remove its dependency on AbstractSimpleModel.

Changes:

  • Implements ModelInput, SolverModel<HardMediumSoftScore>, and ModelOutput directly.
  • Adds an explicit planning score field and accessors, excluding the score from JSON.
File Description
getting-started/​service/​src/​main/​java/​com/​acme/​schooltimetabling/​domain/​Timetable.java Replaces the base class with explicit interfaces and score handling.

Review effort: Balanced

@rsynek
rsynek force-pushed the chore/remove-abstract-simple-model branch from 7619880 to 62c3e86 Compare December 4, 2026 16:00
Copilot AI balanced review requested due to automatic review settings December 4, 2026 16:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Removing AbstractSimpleModel drops the ModelInput and ModelOutput interfaces, causing solved-timetable conversion to throw ClassCastException unless both interfaces are explicitly implemented.

1 open issue

Review effort: Balanced


@PlanningSolution
public class Timetable extends AbstractSimpleModel {
public class Timetable implements SolverModel<HardMediumSoftScore> {
@timefold-automations

Copy link
Copy Markdown

As it stands, this pull request would leave the Solver documentation stale in the place below. An automated check found it and can be wrong.

1. Timetable class declaration no longer matches the docs copy

  • Code change: timefold-quickstarts, getting-started/service/src/main/java/com/acme/schooltimetabling/domain/Timetable.java:18. Changed signature: Timetable now implements SolverModel<HardMediumSoftScore> only. It does not implement ModelInput or ModelOutput.
  • Docs location: docs/src/modules/ROOT/pages/quickstart/service/getting-started.adoc at the head of chore: remove the AbstractSimpleModel timefold-solver#2874. This page copies this class. The Java sample declares public class Timetable implements ModelInput, SolverModel<HardMediumSoftScore>, ModelOutput and imports both DTO interfaces (lines 114–121). The prose says the class implements all three interfaces (lines 86–89 and 273).
  • Confidence: high

Suggested edit: the easier fix is to make the quickstart match the docs: implements ModelInput, SolverModel<HardMediumSoftScore>, ModelOutput. This also matches running-timefold-solver/service/rest-api.adoc:12-16, which says a ModelInput and a ModelOutput implementation are expected. Note that AbstractTrivialModelConvertor casts the solver model to ModelOutput_, so a class that implements only SolverModel may fail at runtime. If you keep the quickstart as it is, the docs sample must change to match it:

import ai.timefold.solver.core.api.score.HardMediumSoftScore;
import ai.timefold.solver.service.definition.api.SolverModel;

import com.fasterxml.jackson.annotation.JsonIgnore;

@PlanningSolution
public class Timetable implements SolverModel<HardMediumSoftScore> {

The interface list at lines 86–89, the sentence at line 273 and the Setup list in rest-api.adoc then need to say that a SolverModel without ModelInput and ModelOutput implementations also acts as the input and output.

Where the fix goes: the docs live in timefold-solver only. For this group, put a docs fix into TimefoldAI/timefold-solver#2874. If you change only the quickstart, no docs change is needed.

A new commit on the branch updates this comment. Drift that is still there when the group merges gets a docs pull request against main.


Generated by Solver Docs Drift Review with Claude.

This branch has not been deployed

No deployments
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