[UI] Add global policies support for LLM providers and proxies#2247
[UI] Add global policies support for LLM providers and proxies#2247ashera96 wants to merge 6 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 22 minutes and 17 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more credits in the billing tab to continue. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses rolling per-developer review limits. Reviews become available again as older review attempts age out of the rolling limit window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis pull request advances the WSO2 API platform gateway API group version from Suggested Reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai please review |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Get PR info
gh pr view 2247 --repo wso2/api-platform --json title,body,files,additions,deletions,changedFiles
echo "---FILES---"
gh pr diff 2247 --repo wso2/api-platformLength of output: 188414
Bug — stale Every other doc file updates both the curl URL and the # Line 40 — URL not updated (should be v1alpha2):
curl -X POST http://localhost:9090/api/management/v0.9/rest-apis \
-u admin:admin \
-H "Content-Type: application/yaml" \
--data-binary `@-` <<'EOF'
-apiVersion: gateway.api-platform.wso2.com/v1alpha1
+apiVersion: gateway.api-platform.wso2.com/v1alpha2This would send the request to the old endpoint and fail against a Minor — orphaned webhook secret schemas in Four new schemas are added ( Minor — Both tab components use // instead of splice:
operationPolicies.splice(policyIndex, 1);
// consistent alternative:
return { ...prev, operationPolicies: operationPolicies.filter((_, i) => i !== policyIndex) };The rest of the version-bump sweep across CLI, samples, configs, and doc reference pages looks complete and consistent. The |
baa60ad to
5f307d2
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/gateway/quick-start-guide.md (1)
38-43: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick winEndpoint URL does not match updated API version.
Line 39 uses the legacy
/api/management/v0.9/rest-apisendpoint, but line 43 specifiesapiVersion: gateway.api-platform.wso2.com/v1alpha2. The endpoint and API version must be aligned; a v1alpha2-only server would reject this request since v0.9 does not support the v1alpha2 API group.Update the curl endpoint to
/api/management/v1alpha2/rest-apisto match the apiVersion in the payload.🔧 Proposed fix
# Deploy an API configuration -curl -X POST http://localhost:9090/api/management/v0.9/rest-apis \ +curl -X POST http://localhost:9090/api/management/v1alpha2/rest-apis \ -u admin:admin \ -H "Content-Type: application/yaml" \ --data-binary `@-` <<'EOF'🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/gateway/quick-start-guide.md` around lines 38 - 43, The curl endpoint URL in the POST request uses the legacy `/api/management/v0.9/rest-apis` path, which does not match the apiVersion declared in the YAML payload as `gateway.api-platform.wso2.com/v1alpha2`. Update the endpoint path from `/api/management/v0.9/rest-apis` to `/api/management/v1alpha2/rest-apis` to ensure the endpoint version aligns with the v1alpha2 API version specified in the apiVersion field of the request body, allowing the server to properly handle the request.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/rest-apis/gateway/schemas.md`:
- Around line 3861-3981: The diff adds four new webhook secret schemas
(WebhookSecretCreationRequest, WebhookSecretInfo, WebhookSecretCreationResponse,
and WebhookSecretListResponse) but does not include the REST operation
documentation that uses these schemas. Add corresponding operation documentation
sections for the webhook secret endpoints such as creating a secret (POST
operation using WebhookSecretCreationRequest and WebhookSecretCreationResponse)
and listing secrets (GET operation using WebhookSecretListResponse), and any
other related operations like regenerate or delete that are referenced in the
schema descriptions. This ensures the new schemas are properly referenced by
actual API endpoint documentation and avoids orphaned schema definitions.
- Line 3929: The example secret value on line 3929 appears as a
production-shaped string that triggers secret-scanner warnings and looks like a
real credential in documentation. Replace the current secret value with a
clearly synthetic placeholder that obviously cannot be a real secret, such as
using a simple pattern like "whsec_test1234567890test1234567890test12345678" or
similar obviously-fake variant that maintains the same prefix but is
unmistakably an example value. This will reduce noise in secret scanning tools
while keeping the documentation examples clear and usable.
In
`@portals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxyGuardrailsTab.tsx`:
- Around line 258-273: Legacy policies with no paths are created with pathIndex
set to null around line 264, but the update handler (around lines 469-473) only
applies changes when pathIndex is not null, preventing edits from being saved.
Modify the condition in the update logic that checks pathIndex !== null to also
handle the case where pathIndex === null for legacy policies, and ensure the
update mechanism properly persists changes to these legacy policy items by
retrieving and updating the correct policy in the policies array using the
policyIndex identifier instead of relying on pathIndex.
In
`@portals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderGuardrailsTab.tsx`:
- Around line 278-287: The legacy edit handling code does not properly process
updates for pathless legacy policies that have pathIndex set to null. Locate the
legacy edit branch (the code that handles edit operations for legacy policies)
and add a condition to handle the case where pathIndex is null. When a legacy
policy item with pathIndex of null is edited, ensure the update is written to
the policy object similar to how it's handled for non-null path indices. This
fix should apply to both the main edit handler and the corresponding section
around line 486-491 to ensure consistency.
---
Outside diff comments:
In `@docs/gateway/quick-start-guide.md`:
- Around line 38-43: The curl endpoint URL in the POST request uses the legacy
`/api/management/v0.9/rest-apis` path, which does not match the apiVersion
declared in the YAML payload as `gateway.api-platform.wso2.com/v1alpha2`. Update
the endpoint path from `/api/management/v0.9/rest-apis` to
`/api/management/v1alpha2/rest-apis` to ensure the endpoint version aligns with
the v1alpha2 API version specified in the apiVersion field of the request body,
allowing the server to properly handle the request.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4c971c2b-a475-41e7-8bef-50d7c634a052
📒 Files selected for processing (81)
cli/it/resources/gateway/sample-api.yamlcli/it/resources/gateway/sample-mcp-config.yamlcli/src/cmd/gateway/restapi/apikey/create.gocli/src/cmd/gateway/subscription/create.gocli/src/cmd/gateway/subscriptionplan/create.gocli/src/internal/gateway/cr_test.gocli/src/internal/mcp/generator.godocs/ai-gateway/analytics/analytics-header-filter.mddocs/ai-gateway/llm/guardrails/aws-bedrock-guardrail.mddocs/ai-gateway/llm/guardrails/azure-content-safety.mddocs/ai-gateway/llm/guardrails/content-length.mddocs/ai-gateway/llm/guardrails/json-schema.mddocs/ai-gateway/llm/guardrails/pii-masking-regex.mddocs/ai-gateway/llm/guardrails/regex.mddocs/ai-gateway/llm/guardrails/semantic-prompt-guard.mddocs/ai-gateway/llm/guardrails/sentence-count.mddocs/ai-gateway/llm/guardrails/url.mddocs/ai-gateway/llm/guardrails/word-count.mddocs/ai-gateway/llm/llm-templates.mddocs/ai-gateway/llm/load-balancing/model-round-robin.mddocs/ai-gateway/llm/load-balancing/model-weighted-round-robin.mddocs/ai-gateway/llm/prompt-management/prompt-decorator.mddocs/ai-gateway/llm/prompt-management/prompt-template.mddocs/ai-gateway/llm/quick-start-guide.mddocs/ai-gateway/llm/semantic-caching.mddocs/ai-gateway/mcp/policies/mcp-acl-list.mddocs/ai-gateway/mcp/policies/mcp-authentication.mddocs/ai-gateway/mcp/policies/mcp-authorization.mddocs/ai-gateway/mcp/policies/mcp-rewrite.mddocs/ai-gateway/mcp/quick-start-guide.mddocs/cli/apiproject/README.mddocs/cli/gateway/README.mddocs/gateway/analytics/analytics-header-filter.mddocs/gateway/artifact-templating.mddocs/gateway/bottom-up-api-deployment-guide.mddocs/gateway/immutable-gateway.mddocs/gateway/quick-start-guide.mddocs/rest-apis/gateway/README.mddocs/rest-apis/gateway/certificate-management.mddocs/rest-apis/gateway/llm-provider-management.mddocs/rest-apis/gateway/llm-provider-template-management.mddocs/rest-apis/gateway/llm-proxy-management.mddocs/rest-apis/gateway/mcp-proxy-management.mddocs/rest-apis/gateway/rest-api-management.mddocs/rest-apis/gateway/schemas.mddocs/rest-apis/gateway/secrets-management.mddocs/rest-apis/gateway/webbroker-api-management.mddocs/rest-apis/gateway/websub-api-management.mdgateway/spec/impls/2-use-sqlite/data-model.mdportals/ai-workspace/configs/config-platform-api-template.tomlportals/ai-workspace/configs/config-platform-api.tomlportals/ai-workspace/configs/config-template.tomlportals/ai-workspace/configs/config.tomlportals/ai-workspace/docker-compose.yamlportals/ai-workspace/src/apis/platformApis.tsportals/ai-workspace/src/clients/choreoApiClient.tsportals/ai-workspace/src/config.env.tsportals/ai-workspace/src/contexts/ChoreoUserContext.tsxportals/ai-workspace/src/pages/appShell/appShellPages/proxies/LLMProxyGuardrailsTab.tsxportals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderGuardrailsTab.tsxportals/ai-workspace/src/pages/appShell/appShellPages/serviceProvider/ServiceProviderNew.tsxportals/ai-workspace/src/utils/types.tsportals/management-portal/src/hooks/GithubAPICreation.tsportals/management-portal/src/hooks/apiPublish.tsportals/management-portal/src/hooks/apis.tsportals/management-portal/src/hooks/deployments.tsportals/management-portal/src/hooks/devportals.tsportals/management-portal/src/hooks/gateways.tsportals/management-portal/src/hooks/orgs.tsxportals/management-portal/src/hooks/projects.tsportals/management-portal/src/hooks/validation.tsportals/management-portal/src/pages/overview/StepTwoApis.tsxsamples/ai-gw-llm-proxy/inject-mock.shsamples/ai-gw-llm-proxy/provider.yamlsamples/ai-gw-llm-proxy/proxy.yamlsamples/ai-gw-mcp-claude-desktop/inject-mock.shsamples/ai-gw-mcp-claude-desktop/mcp.yamlsamples/llm-cost-control-and-privacy-control/llm-provider.yamlsamples/llm-cost-control-and-privacy-control/llm-proxy.yamlsamples/llm-cost-control-and-privacy-control/setup.shsamples/llm-cost-control-and-privacy-control/teardown.sh
6a5be7a to
7514ba9
Compare
Purpose
Portal UI, event-gateway, CLI, samples, and documentation updates to support the
globalPolicies/operationPoliciesfeature and thev1alpha2version bump.AI Workspace portal.
LLMProxyGuardrailsTab) and service providers (ServiceProviderGuardrailsTab) updated to surface global vs. per-operation policy configuration.CLI.
v1alpha2.Samples.
v1alpha2artifact apiVersion.Docs.
globalPolicies/operationPoliciesfields andv1alpha2versions.CI.
operator-integration-test.ymlYAML indentation fixes (two annotation blocks had a one-space misalignment that caused YAML parse failures at apply time).