Skip to content

[SRVLOGIC-1137] Restore host in ProcessDefinition serviceUrl - #133

Merged
baldimir merged 1 commit into
kiegroup:mainfrom
mcruzdev:fix-process-definition-service-url
Aug 21, 2026
Merged

[SRVLOGIC-1137] Restore host in ProcessDefinition serviceUrl#133
baldimir merged 1 commit into
kiegroup:mainfrom
mcruzdev:fix-process-definition-service-url

Conversation

@mcruzdev

Copy link
Copy Markdown

getProcessDefinitionServiceUrl was using URI.create(endpoint).getPath(), which drops the scheme and host and keeps only the path.

This made serviceUrl a relative path such as /callbackstatetimeouts/0.0.1 instead of the service address, e.g. http://callbackstatetimeouts.example.com.

getProcessInstanceServiceUrl already handles this correctly using URIInfo.buildURIInfo(...).truncatedURI(), which strips the trailing id/version segments while keeping the host. Use the same approach for ProcessDefinition, via the existing (previously unused) URIInfo.buildURIInfo(ProcessDefinition) overload.

This is MIDSTREAM if you want to send your PR to UPSTREAM use https://github.com/apache/incubator-kie-kogito-apps

REQUIRED Add link to SRVLOGIC Jira!

https://redhat.atlassian.net/browse/SRVLOGIC-1137

Please make sure that your PR meets the following requirements:

  • You have read the contributors guide
  • Your code is properly formatted according to this configuration
  • Pull Request title is properly formatted: SRVLOGIC-XYZ Subject
  • Pull Request title contains the target branch if not targeting main: [0.9.x] SRVLOGIC-XYZ Subject
  • Pull Request contains link to the JIRA issue
  • Pull Request contains link to any dependent or related Pull Request
  • Pull Request contains description of the issue
  • Pull Request does not include fixes for issues other than the main ticket
How to replicate CI configuration locally?

Build Chain tool does "simple" maven build(s), the builds are just Maven commands, but because the repositories relates and depends on each other and any change in API or class method could affect several of those repositories there is a need to use build-chain tool to handle cross repository builds and be sure that we always use latest version of the code for each repository.

build-chain tool is a build tool which can be used on command line locally or in Github Actions workflow(s), in case you need to change multiple repositories and send multiple dependent pull requests related with a change you can easily reproduce the same build by executing it on Github hosted environment or locally in your development environment. See local execution details to get more information about it.

getProcessDefinitionServiceUrl was using URI.create(endpoint).getPath(),
which drops the scheme and host and keeps only the path. This made
serviceUrl a relative path such as /callbackstatetimeouts/0.0.1 instead
of the service address, e.g. http://callbackstatetimeouts.example.com.

getProcessInstanceServiceUrl already handles this correctly using
URIInfo.buildURIInfo(...).truncatedURI(), which strips the trailing
id/version segments while keeping the host. Use the same approach for
ProcessDefinition, via the existing (previously unused)
URIInfo.buildURIInfo(ProcessDefinition) overload.

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.

Pull request overview

This PR fixes how the Data Index GraphQL layer computes serviceUrl for ProcessDefinition sources by preserving scheme/host and truncating the trailing process id/version segments, aligning the behavior with the existing ProcessInstance URL handling.

Changes:

  • Update getProcessDefinitionServiceUrl to use URIInfo.buildURIInfo(...).truncatedURI() instead of URI.create(...).getPath().
  • Add unit tests covering ProcessDefinition serviceUrl extraction (including versioned endpoints).

Reviewed changes

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

File Description
data-index/data-index-graphql/src/main/java/org/kie/kogito/index/graphql/AbstractGraphQLSchemaManager.java Switch ProcessDefinition serviceUrl computation to URIInfo truncation to preserve host/scheme.
data-index/data-index-service/data-index-service-common/src/test/java/org/kie/kogito/index/service/graphql/GraphQLSchemaManagerTest.java Add tests validating correct ProcessDefinition serviceUrl truncation behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 167 to +171
ProcessDefinition source = env.getSource();
if (source == null || source.getEndpoint() == null) {
return null;
}
return URI.create(source.getEndpoint()).getPath();
return URIInfo.buildURIInfo(source).truncatedURI().toString();
Comment on lines 21 to 23
import org.junit.jupiter.api.Test;
import org.kie.kogito.index.model.ProcessDefinition;
import org.kie.kogito.index.model.ProcessInstance;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mcruzdev please take a look at this.

@jankrystof-ibm
jankrystof-ibm self-requested a review August 20, 2026 06:28
@baldimir
baldimir merged commit b88b848 into kiegroup:main Aug 21, 2026
2 checks passed
baldimir added a commit that referenced this pull request Aug 24, 2026
…134)

getProcessDefinitionServiceUrl was using URI.create(endpoint).getPath(),
which drops the scheme and host and keeps only the path. This made
serviceUrl a relative path such as /callbackstatetimeouts/0.0.1 instead
of the service address, e.g. http://callbackstatetimeouts.example.com.

getProcessInstanceServiceUrl already handles this correctly using
URIInfo.buildURIInfo(...).truncatedURI(), which strips the trailing
id/version segments while keeping the host. Use the same approach for
ProcessDefinition, via the existing (previously unused)
URIInfo.buildURIInfo(ProcessDefinition) overload.

(cherry picked from commit b88b848)

Co-authored-by: Matheus Cruz <56329339+mcruzdev@users.noreply.github.com>
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.

5 participants