-
Notifications
You must be signed in to change notification settings - Fork 0
Review fixes #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Review fixes #75
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
94b561a
pipeline
Schmarvinius ba157d2
refactor(ai-core): migrate AICoreService to RemoteService (#73)
Schmarvinius f48c554
refactor(ai-core): typesafe handlers decoupled from service impl (#74)
Schmarvinius b392cff
chore(ai-core): cleanup (#76)
Schmarvinius 0d81f68
Refactor cds-feature-recommendations (#77)
lisajulia 62f9b63
chore: migrate to remote service (#80)
Schmarvinius f4b8d06
feature: static recommendation state (#82)
Schmarvinius e557ebf
Final review doc changes (#84)
lisajulia 7891eee
fix recommendation unit tests (revert)
Schmarvinius b763fc7
revert pr pipeline branches
Schmarvinius 3c5f70d
continue-on-error
Schmarvinius d94923c
Fix one sonarqube issue apart from the coverage (#85)
lisajulia 326c102
simplification
Schmarvinius File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 0 additions & 77 deletions
77
cds-feature-ai-core/src/main/java/com/sap/cds/feature/aicore/api/AICoreService.java
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
cds-feature-ai-core/src/main/java/com/sap/cds/feature/aicore/api/DeploymentIdContext.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * © 2026 SAP SE or an SAP affiliate company and cds-ai contributors. | ||
| */ | ||
| package com.sap.cds.feature.aicore.api; | ||
|
|
||
| import com.sap.cds.services.EventContext; | ||
| import com.sap.cds.services.EventName; | ||
|
|
||
| /** | ||
| * Typed {@link EventContext} for the {@code deploymentId} event. | ||
| * | ||
| * <p>Emitted on the AI Core service to resolve (or create) a deployment matching the given spec | ||
| * inside the given resource group. The ON handler performs cache lookup, retry, configuration | ||
| * creation, deployment creation and polling. | ||
| */ | ||
| @EventName(DeploymentIdContext.EVENT) | ||
| public interface DeploymentIdContext extends EventContext { | ||
|
|
||
| /** Event name constant. */ | ||
| String EVENT = "deploymentId"; | ||
|
|
||
| /** Returns the resource group ID to operate in. */ | ||
| String getResourceGroupId(); | ||
|
|
||
| /** Sets the resource group ID to operate in. */ | ||
| void setResourceGroupId(String resourceGroupId); | ||
|
|
||
| /** Returns the deployment specification. */ | ||
| ModelDeploymentSpec getSpec(); | ||
|
|
||
| /** Sets the deployment specification. */ | ||
| void setSpec(ModelDeploymentSpec spec); | ||
|
|
||
| /** Returns the resolved deployment ID (set by the ON handler). */ | ||
| String getResult(); | ||
|
|
||
| /** Sets the resolved deployment ID. */ | ||
| void setResult(String deploymentId); | ||
|
|
||
| /** Creates a new context instance. */ | ||
| static DeploymentIdContext create() { | ||
| return EventContext.create(DeploymentIdContext.class, null); | ||
| } | ||
| } |
44 changes: 44 additions & 0 deletions
44
cds-feature-ai-core/src/main/java/com/sap/cds/feature/aicore/api/InferenceClientContext.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * © 2026 SAP SE or an SAP affiliate company and cds-ai contributors. | ||
| */ | ||
| package com.sap.cds.feature.aicore.api; | ||
|
|
||
| import com.sap.cds.services.EventContext; | ||
| import com.sap.cds.services.EventName; | ||
| import com.sap.cloud.sdk.services.openapi.apache.apiclient.ApiClient; | ||
|
|
||
| /** | ||
| * Typed {@link EventContext} for the {@code inferenceClient} event. | ||
| * | ||
| * <p>Emitted on the AI Core service to build an {@link ApiClient} preconfigured with the inference | ||
| * destination for the given deployment. | ||
| */ | ||
| @EventName(InferenceClientContext.EVENT) | ||
| public interface InferenceClientContext extends EventContext { | ||
|
|
||
| /** Event name constant. */ | ||
| String EVENT = "inferenceClient"; | ||
|
|
||
| /** Returns the resource group ID containing the deployment. */ | ||
| String getResourceGroupId(); | ||
|
|
||
| /** Sets the resource group ID containing the deployment. */ | ||
| void setResourceGroupId(String resourceGroupId); | ||
|
|
||
| /** Returns the deployment ID. */ | ||
| String getDeploymentId(); | ||
|
|
||
| /** Sets the deployment ID. */ | ||
| void setDeploymentId(String deploymentId); | ||
|
|
||
| /** Returns the configured {@link ApiClient} (set by the ON handler). */ | ||
| ApiClient getResult(); | ||
|
|
||
| /** Sets the configured {@link ApiClient}. */ | ||
| void setResult(ApiClient client); | ||
|
|
||
| /** Creates a new context instance. */ | ||
| static InferenceClientContext create() { | ||
| return EventContext.create(InferenceClientContext.class, null); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
cds-feature-ai-core/src/main/java/com/sap/cds/feature/aicore/api/ResourceGroupContext.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * © 2026 SAP SE or an SAP affiliate company and cds-ai contributors. | ||
| */ | ||
| package com.sap.cds.feature.aicore.api; | ||
|
|
||
| import com.sap.cds.services.EventContext; | ||
| import com.sap.cds.services.EventName; | ||
|
|
||
| /** | ||
| * Typed {@link EventContext} for the {@code resourceGroup} event. | ||
| * | ||
| * <p>Emitted on the AI Core service to resolve the AI Core resource group ID for the current | ||
| * tenant. In multi-tenancy mode, the resource group is created on-demand if it does not exist. In | ||
| * single-tenancy mode, the configured default resource group is returned. | ||
| * | ||
| * <p>If {@link #getTenantId()} is non-null, the handler uses the explicit tenant ID. Otherwise, the | ||
| * current tenant is read from the {@code RequestContext}. | ||
| */ | ||
| @EventName(ResourceGroupContext.EVENT) | ||
| public interface ResourceGroupContext extends EventContext { | ||
|
|
||
| /** Event name constant. */ | ||
| String EVENT = "resourceGroup"; | ||
|
|
||
| /** | ||
| * Returns the explicit tenant ID (optional). If {@code null}, the handler reads the tenant from | ||
| * the current {@code RequestContext}. | ||
| */ | ||
| String getTenantId(); | ||
|
|
||
| /** Sets an explicit tenant ID. */ | ||
| void setTenantId(String tenantId); | ||
|
|
||
| /** Returns the resolved resource group ID (set by the ON handler). */ | ||
| String getResult(); | ||
|
|
||
| /** Sets the resolved resource group ID. */ | ||
| void setResult(String resourceGroupId); | ||
|
|
||
| /** Creates a new context instance. */ | ||
| static ResourceGroupContext create() { | ||
| return EventContext.create(ResourceGroupContext.class, null); | ||
| } | ||
| } |
23 changes: 23 additions & 0 deletions
23
cds-feature-ai-core/src/main/java/com/sap/cds/feature/aicore/core/AICoreClients.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /* | ||
| * © 2026 SAP SE or an SAP affiliate company and cds-ai contributors. | ||
| */ | ||
| package com.sap.cds.feature.aicore.core; | ||
|
|
||
| import com.sap.ai.sdk.core.AiCoreService; | ||
| import com.sap.ai.sdk.core.client.ConfigurationApi; | ||
| import com.sap.ai.sdk.core.client.DeploymentApi; | ||
| import com.sap.ai.sdk.core.client.ResourceGroupApi; | ||
|
|
||
| /** | ||
| * Holder for the AI Core SDK API clients, built once from the service binding at startup. | ||
| * | ||
| * @param deploymentApi client for deployment CRUD operations | ||
| * @param configurationApi client for configuration CRUD operations | ||
| * @param resourceGroupApi client for resource-group CRUD operations | ||
| * @param sdkService the AI Core SDK service for inference destination resolution | ||
| */ | ||
| public record AICoreClients( | ||
| DeploymentApi deploymentApi, | ||
| ConfigurationApi configurationApi, | ||
| ResourceGroupApi resourceGroupApi, | ||
| AiCoreService sdkService) {} |
58 changes: 58 additions & 0 deletions
58
cds-feature-ai-core/src/main/java/com/sap/cds/feature/aicore/core/AICoreConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| /* | ||
| * © 2026 SAP SE or an SAP affiliate company and cds-ai contributors. | ||
| */ | ||
| package com.sap.cds.feature.aicore.core; | ||
|
|
||
| import com.sap.cds.services.environment.CdsEnvironment; | ||
|
|
||
| /** | ||
| * Immutable configuration for the AI Core plugin, read once from {@link CdsEnvironment} at startup. | ||
| * | ||
| * @param defaultResourceGroup the resource group to use when multi-tenancy is disabled | ||
| * @param resourceGroupPrefix prefix for tenant-specific resource groups (e.g. "cds-") | ||
| * @param maxRetries max retry attempts for transient AI Core errors | ||
| * @param initialDelayMs initial backoff delay in milliseconds | ||
| * @param multiTenancyEnabled whether multi-tenancy is active | ||
| */ | ||
| public record AICoreConfig( | ||
| String defaultResourceGroup, | ||
| String resourceGroupPrefix, | ||
| int maxRetries, | ||
| long initialDelayMs, | ||
| boolean multiTenancyEnabled) { | ||
|
|
||
| /** The AI Core resource-group label key used to associate groups with CDS tenants. */ | ||
| public static final String TENANT_LABEL_KEY = "ext.ai.sap.com/CDS_TENANT_ID"; | ||
|
|
||
| private static final String DEFAULT_RESOURCE_GROUP = "default"; | ||
| private static final String DEFAULT_RESOURCE_GROUP_PREFIX = "cds-"; | ||
| private static final int DEFAULT_MAX_RETRIES = 10; | ||
| private static final long DEFAULT_INITIAL_DELAY_MS = 300; | ||
|
|
||
| public AICoreConfig { | ||
| if (maxRetries < 1) { | ||
| throw new IllegalArgumentException("cds.ai.core.maxRetries must be >= 1, got " + maxRetries); | ||
| } | ||
| if (initialDelayMs < 1) { | ||
| throw new IllegalArgumentException( | ||
| "cds.ai.core.initialDelayMs must be >= 1, got " + initialDelayMs); | ||
| } | ||
| if (defaultResourceGroup == null || defaultResourceGroup.isBlank()) { | ||
| throw new IllegalArgumentException("cds.ai.core.resourceGroup must not be blank"); | ||
| } | ||
| if (resourceGroupPrefix == null) { | ||
| throw new IllegalArgumentException("cds.ai.core.resourceGroupPrefix must not be null"); | ||
| } | ||
| } | ||
|
|
||
| /** Creates an {@code AICoreConfig} from the runtime environment properties. */ | ||
| public static AICoreConfig from(CdsEnvironment env, boolean multiTenancyEnabled) { | ||
| return new AICoreConfig( | ||
| env.getProperty("cds.ai.core.resourceGroup", String.class, DEFAULT_RESOURCE_GROUP), | ||
| env.getProperty( | ||
| "cds.ai.core.resourceGroupPrefix", String.class, DEFAULT_RESOURCE_GROUP_PREFIX), | ||
| env.getProperty("cds.ai.core.maxRetries", Integer.class, DEFAULT_MAX_RETRIES), | ||
| env.getProperty("cds.ai.core.initialDelayMs", Long.class, DEFAULT_INITIAL_DELAY_MS), | ||
| multiTenancyEnabled); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.