Skip to content

fix: mark ModelConvertor parameters and returns as non-null (#2507) - #2519

Open
vikas-prasad-cx wants to merge 2 commits into
TimefoldAI:mainfrom
vikas-prasad-cx:timefold-first-contribution
Open

fix: mark ModelConvertor parameters and returns as non-null (#2507)#2519
vikas-prasad-cx wants to merge 2 commits into
TimefoldAI:mainfrom
vikas-prasad-cx:timefold-first-contribution

Conversation

@vikas-prasad-cx

Copy link
Copy Markdown

Summary

  • Mark ModelConvertor with @NullMarked and document that method parameters/returns are never null (use empty Optional for no prior output).
  • Align AbstractTrivialModelConvertor with the same contract via runtime Objects.requireNonNull checks, removing the previous null-tolerant modelOutput path.
  • Add unit tests covering the annotation contract and null-argument rejection.

Fixes #2507

Test plan

  • ./mvnw test -pl service/definition -Dtest=ModelConvertorNullabilityTest
  • ./mvnw test -pl service/quarkus/deployment -Dtest=AbstractTrivialModelConvertorTest
  • ./mvnw test -pl service/definition,service/quarkus/deployment (40 tests passed)
  • CI checks on this PR

Made with Cursor

@vikas-prasad-cx

Copy link
Copy Markdown
Author

Hi — gentle ping on this PR when you have a chance. Happy to address any feedback. CI may still need first-time contributor workflow approval. Thanks!

@triceo

triceo commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Hello @vikas-prasad-cx - we are aware of your PR and we will get to it when time permits.
Thank you for your contribution, and for your patience.

@rsynek rsynek 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.

@vikas-prasad-cx Thanks for your contribution!

Also, my apologies for the delay with reviewing your PR.

I left one comment inline, plus, in order to declare non-null parameters of the ModelConvertor methods we must ensure that the caller never passes nulls there.

In case we don't have the ModelConfig instance, there is empty factory method.

@vikas-prasad-cx

Copy link
Copy Markdown
Author

@rsynek Thank you for the review, and no worries about the delay.

Addressed in 8895be2:

  • Removed ModelConvertorNullabilityTest as requested.
  • SolverWorker now passes ModelConfig.empty() when no config is available, so ModelConvertor callers never hand in a null ModelConfig. The existing AbstractTrivialModelConvertor null-checks and the ModelConfig.empty() happy-path test are unchanged.

Happy to adjust further if needed.

@vikas-prasad-cx
vikas-prasad-cx requested a review from a team September 1, 2026 22:14
@triceo
triceo removed their request for review September 2, 2026 06:40
vikas-prasad-cx and others added 2 commits September 3, 2026 09:34
…AI#2507)

Clarify the API nullability contract with @NullMarked and enforce it in
AbstractTrivialModelConvertor so callers cannot pass null arguments.

Co-authored-by: Cursor <cursoragent@cursor.com>
…foldAI#2507)

Drop the annotation-presence test and make SolverWorker use the empty
factory when no model config is available, so convertor callers never
pass a null ModelConfig.

Co-authored-by: Cursor <cursoragent@cursor.com>
@rsynek
rsynek force-pushed the timefold-first-contribution branch from 8895be2 to 4275784 Compare September 3, 2026 07:34
@rsynek

rsynek commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@rsynek Thank you for the review, and no worries about the delay.

Addressed in 8895be2:

  • Removed ModelConvertorNullabilityTest as requested.
  • SolverWorker now passes ModelConfig.empty() when no config is available, so ModelConvertor callers never hand in a null ModelConfig. The existing AbstractTrivialModelConvertor null-checks and the ModelConfig.empty() happy-path test are unchanged.

Happy to adjust further if needed.

Thank you, looks very good now! I will take care of the CI checks and let you if any further change is needed.

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.

ModelConvertor interface should guarantee its method parameters cannot be null

3 participants