Skip to content

Chore: migrate to remote service without manual service#79

Closed
Schmarvinius wants to merge 34 commits into
review-fixesfrom
chore/migrate-to-remote-service
Closed

Chore: migrate to remote service without manual service#79
Schmarvinius wants to merge 34 commits into
review-fixesfrom
chore/migrate-to-remote-service

Conversation

@Schmarvinius

@Schmarvinius Schmarvinius commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Migrate AI Core Service to CAP Java RemoteService

♻️ Refactor: Removes the custom AICoreService interface and AICoreServiceImpl class, replacing them with a standard CAP Java RemoteService auto-created by the framework's RemoteServiceConfiguration. Callers now interact with the service by emitting typed EventContext instances (ResourceGroupContext, DeploymentIdContext, InferenceClientContext) instead of calling methods on a custom service interface.

Changes

Core API & Service Registration

  • AICore.java (new): Replaces the removed AICoreService interface as the central constants holder for SERVICE_NAME, RESOURCE_GROUPS, DEPLOYMENTS, and CONFIGURATIONS.
  • AICoreService.java (removed): Custom service interface eliminated.
  • AICoreServiceImpl.java (removed): Custom service implementation eliminated.
  • AICoreServiceConfiguration.java: Adds an environment() lifecycle phase that injects a RemoteServiceConfig for "AICore" into the CAP runtime properties, enabling the framework to auto-create the RemoteService. Helper methods (hasAICoreModel, hasAICoreBinding, detectMultiTenancy) moved to the bottom of the class.

Event Context Javadoc Updates

  • DeploymentIdContext.java, InferenceClientContext.java, ModelDeploymentSpec.java, ResourceGroupContext.java: Updated Javadoc references from AICoreService method calls to event-based descriptions.

Handler @ServiceName Updates

  • AICoreApiHandler, ActionHandler, ConfigurationHandler, DeploymentHandler, MockAICoreApiHandler, MockEntityHandler, ResourceGroupHandler: All @ServiceName annotations updated from AICoreService.DEFAULT_NAME to AICore.SERVICE_NAME.

Recommendation Feature

  • FioriRecommendationHandler.java: Field type changed from AICoreService to RemoteService; PersistenceService injected via constructor instead of being looked up per-request; fixed a draft check guard; prediction flow refactored to pass predictionRow + contextRows separately.
  • RecommendationConfiguration.java: Looks up RemoteService by AICore.SERVICE_NAME; resolveRptClient now emits typed contexts; PersistenceService null check added.
  • RecommendationContextBuilder.java: Removed assembleRows/computeSyntheticKey/indexColumn/syntheticKeyNeeded; buildPredictRow now filters to allowed columns only; added @Core.Computed/@readonly filters for context columns; added @cds.odata.valuelist: false exclusion for prediction elements.
  • RecommendationClient.java: Interface method signature changed to predict(CdsData predictionRow, List<CdsData> contextRows, List<String> predictionColumns, List<String> keyNames).
  • RecommendationClientResolver.java: Parameter type changed from AICoreService to RemoteService.
  • RptInferenceClient.java: Migrated to new predict signature; synthetic key logic (resolveIndexColumn, computeSyntheticKey, addSyntheticKeyIfNeeded) moved into this class; preparePredictRow added; PREDICT constant made public.

Tests

  • All unit and integration tests updated to use RemoteService from the catalog and emit typed event contexts instead of calling the old service interface methods.
  • RptInferenceClientTest.java (new): Tests for resolveIndexColumn and computeSyntheticKey helper methods.
  • FioriRecommendationHandlerTest.java: Added tests for @cds.odata.valuelist: false exclusion and context query correctness.
  • recommendations-test.cds: Added BooksWithDisabledValueList entity and BooksWithDisabledValueList service projection.

Samples

  • AICoreShowcaseHandler.java, ai-core-service.cds, .cdsrc.json: Updated to use RemoteService pattern and corrected CDS model import path.
  • 🔄 Regenerate and Update Summary
PR Bot Information

Version: 1.25.0

  • File Content Strategy: Full file content
  • Correlation ID: b93ea7ed-eaec-4cfa-b6f9-215da15b5070
  • Summary Prompt: Default Prompt
  • LLM: anthropic--claude-4.6-sonnet
  • Event Trigger: pull_request.ready_for_review
  • Output Template: Default Template

lisajulia and others added 30 commits June 16, 2026 16:41
…mputed, @readonly and remove logic from 'toSdkRow' method that was already executed elsewhere
…und and recommendations are therefore skipped
…cluded in the select query returned by buildContextQuery
@Schmarvinius
Schmarvinius changed the base branch from main to refactor-recommendations June 17, 2026 12:08
@Schmarvinius Schmarvinius changed the title Chore: migrate to remote service Chore: migrate to remote service without manual service Jun 17, 2026
Base automatically changed from refactor-recommendations to review-fixes June 17, 2026 13:45
@Schmarvinius
Schmarvinius marked this pull request as ready for review June 17, 2026 13:52
@Schmarvinius
Schmarvinius requested a review from a team as a code owner June 17, 2026 13:52

@hyperspace-pr-bot hyperspace-pr-bot Bot 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.

The PR refactors the AICoreService interface and AICoreServiceImpl in favour of using the standard CAP RemoteService with typed EventContext emissions — a clean architectural improvement. Three substantive issues were found: a composite-key inconsistency in MockRecommendationClient, a potential IndexOutOfBoundsException in test helpers, and a fragile instanceof String value-based index-column resolution in RptInferenceClient that breaks when a key field is null.

PR Bot Information

Version: 1.25.0

  • File Content Strategy: Full file content
  • LLM: anthropic--claude-4.6-sonnet
  • Correlation ID: b93ea7ed-eaec-4cfa-b6f9-215da15b5070
  • Event Trigger: pull_request.ready_for_review

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