Skip to content

feat: report unique resources - #2779

Merged
triceo merged 7 commits into
TimefoldAI:mainfrom
rsynek:feat/json-path-resource-reporting
Nov 3, 2026
Merged

triceo merged 7 commits into
TimefoldAI:mainfrom
rsynek:feat/json-path-resource-reporting

Conversation

@rsynek

@rsynek rsynek commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

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

nice work, especially around the Resolver

@rsynek
rsynek force-pushed the feat/json-path-resource-reporting branch from 7668b6b to 41b2343 Compare October 27, 2026 13:44
@rsynek
rsynek marked this pull request as ready for review October 27, 2026 13:45
@rsynek
rsynek requested a review from a team October 27, 2026 13:45
@rsynek
rsynek requested a review from triceo as a code owner October 27, 2026 13:45
Copilot AI balanced review requested due to automatic review settings October 27, 2026 13:45

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.

🟡 Changes recommended

The immutable image list breaks descriptor generation, and valid input structures can produce missing or incorrect resource paths.

5 open issues
What changed in this PR

This PR adds unique-resource metadata to service model descriptors. It derives resource types and JSONPath expressions from model-input annotations for downstream resource reporting.

Changes:

  • Adds @UniqueResourceId and descriptor storage for resource types and paths.
  • Integrates build-time path discovery into Quarkus descriptor generation.
  • Adds resolver tests and an end-to-end descriptor test.
File Description
service/​definition/​src/​main/​java/​ai/​timefold/​solver/​service/​definition/​api/​ModelDescriptor.java Stores and copies resource metadata; changes collection defaults.
service/​definition/​src/​main/​java/​ai/​timefold/​solver/​service/​definition/​api/​usage/​UniqueResourceId.java Defines the resource-ID annotation.
service/​definition/​src/​main/​java/​ai/​timefold/​solver/​service/​definition/​internal/​descriptor/​usage/​UniqueResource.java Pairs a resource type with its JSONPath.
service/​quarkus/​deployment/​src/​main/​java/​ai/​timefold/​solver/​service/​quarkus/​deployment/​TimefoldModelDescriptorProcessor.java Adds resource metadata during descriptor generation.
service/​quarkus/​deployment/​src/​main/​java/​ai/​timefold/​solver/​service/​quarkus/​deployment/​descriptor/​ResourceIdPathResolver.java Traverses indexed input fields to derive resource paths.
service/​quarkus/​deployment/​src/​test/​java/​ai/​timefold/​solver/​service/​quarkus/​deployment/​ModelDescriptorUniqueResourcesTest.java Checks generated descriptor resource entries.
service/​quarkus/​deployment/​src/​test/​java/​ai/​timefold/​solver/​service/​quarkus/​deployment/​descriptor/​UniqueResourceIdPathResolverTest.java Tests traversal, field annotations, and blank resource types.
service/​quarkus/​deployment/​src/​test/​java/​ai/​timefold/​solver/​service/​quarkus/​deployment/​testdata/​uniqueresource/​TestdataVisit.java Provides an annotated visit ID.
service/​quarkus/​deployment/​src/​test/​java/​ai/​timefold/​solver/​service/​quarkus/​deployment/​testdata/​uniqueresource/​TestdataVehicle.java Provides an annotated vehicle ID and nested visits.
service/​quarkus/​deployment/​src/​test/​java/​ai/​timefold/​solver/​service/​quarkus/​deployment/​testdata/​uniqueresource/​TestdataSolution.java Provides the test model input structure.
service/​quarkus/​deployment/​src/​test/​java/​ai/​timefold/​solver/​service/​quarkus/​deployment/​testdata/​uniqueresource/​TestdataRest.java Supplies the test model REST interface.
service/​quarkus/​deployment/​src/​test/​java/​ai/​timefold/​solver/​service/​quarkus/​deployment/​testdata/​uniqueresource/​TestdataConstraintProvider.java Supplies a constraint for the test deployment.

Review effort: Balanced

@timefold-automations

timefold-automations Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

This pull request, as it stands, would leave the Solver documentation stale in the places below. An automated check found them and can be wrong.

  1. Code change: TimefoldAI/timefold-solver, service/definition/src/main/java/ai/timefold/solver/service/definition/preview/api/usage/UniqueResourceId.java:1-19 — adds the preview @UniqueResourceId annotation and its required type() element (added public API).
    Docs location: no mention found in timefold-solver/docs/src/modules/ROOT/.
    Confidence: high.
    Suggested edit: add a section to pages/deploying-to-platform/model-metadata.adoc that explains how to annotate resource ID fields:
[#_unique_resource_ids]
== Unique resource IDs

Annotate each resource identifier that must be unique within its resource type with `@UniqueResourceId` from `ai.timefold.solver.service.definition.preview.api.usage`.

[source,java,options="nowrap"]
----
@UniqueResourceId(type = "vehicle")
private String id;
----
  1. Code change: TimefoldAI/timefold-solver, service/definition/src/main/java/ai/timefold/solver/service/definition/api/ModelDescriptor.java:70, 280-288 — adds the public uniqueResources property and its getUniqueResources()/setUniqueResources(...) accessors, exposing resource types and JSONPath expressions in generated service metadata (added public API).
    Docs location: no mention found in timefold-solver/docs/src/modules/ROOT/.
    Confidence: high.
    Suggested edit: in the same section, document the generated metadata:
The generated model descriptor exposes these resources through `uniqueResources`.
Each entry contains `resourceType` and `resourceIdJsonPath`, such as `vehicle` and `$.vehicles[*].id`.

The fix goes into this timefold-solver pull request. A new commit on the branch updates this comment, and drift that is still there when the group merges gets a docs pull request against main.

Generated by Solver Docs Drift Review · copilot · gpt56 · 11 AIC · ⌖ 3.86 AIC · ⊞ 25.2K · ◷

@rsynek
rsynek force-pushed the feat/json-path-resource-reporting branch from 41b2343 to 060e71e Compare October 27, 2026 16:07
Copilot AI balanced review requested due to automatic review settings October 27, 2026 16:07

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.

@rsynek
rsynek force-pushed the feat/json-path-resource-reporting branch from 060e71e to c64bb63 Compare November 2, 2026 13:47
Copilot AI balanced review requested due to automatic review settings November 2, 2026 13:47

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.

🟡 Changes recommended

Resource ID discovery can silently miss IDs in application-defined containers due to the class loader choice and in renamed fields because special property names are not correctly quoted and escaped.

2 open issues
1 resolved since last review

Review effort: Balanced

@rsynek
rsynek force-pushed the feat/json-path-resource-reporting branch from c64bb63 to 9807fbd Compare November 2, 2026 13:59
Copilot AI balanced review requested due to automatic review settings November 2, 2026 13:59

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.

🟡 Changes recommended

Resource ID resolution can miss IDs or select unrelated values because special JSON property names use unsafe dot notation and application-defined collections are misclassified during Quarkus augmentation.

2 open issues
1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 2, 2026 14:05

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.

🔵 Needs a closer look

Human assessment is needed to evaluate an edge case where concrete collection subtypes are inspected as containers, causing annotated element IDs to be omitted from descriptors.

1 open issue
1 resolved since last review

Review effort: Balanced

@rsynek

rsynek commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

The downstream failure is addressed by #2798.

@rsynek
rsynek force-pushed the feat/json-path-resource-reporting branch from 814dc13 to a331792 Compare November 2, 2026 16:05
Copilot AI balanced review requested due to automatic review settings November 2, 2026 16:05

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.

🟢 Approval recommended

No active review issues are reported for the unique-resource metadata changes.

1 open issue

Review effort: Balanced

@triceo triceo added this to the v2.9.0-rc-1 milestone Nov 3, 2026
@triceo
triceo merged commit c712cc0 into TimefoldAI:main Nov 3, 2026
39 checks passed

This branch was previously deployed

1 inactive deployment
internal — a331792e Deployed Nov 2, 2026 by rsynek via approval_required #1156
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.

4 participants