Skip to content

Fix policy definition version normalization#2861

Open
lahiruudayakumara wants to merge 2 commits into
wso2:mainfrom
lahiruudayakumara:fix/2855-policy-version-normalization
Open

Fix policy definition version normalization#2861
lahiruudayakumara wants to merge 2 commits into
wso2:mainfrom
lahiruudayakumara:fix/2855-policy-version-normalization

Conversation

@lahiruudayakumara

Copy link
Copy Markdown
Contributor

Purpose

Applied policies in AI Workspace may store versions using the gateway format, such as v1. Policy Hub expects the corresponding definition version as 1.0, causing requests such as /versions/v1/definition to fail.

Fixes #2855

Goals

Ensure policy definitions load correctly when users inspect an applied policy in AI Workspace.

Approach

Normalize policy versions in the shared Policy Hub definition API helper:

  • Remove a leading v.
  • Expand major-only versions to major.minor.
  • Preserve versions that already include a minor component.

For example:

  • v11.0
  • v1.01.0
  • 1.01.0

Because the normalization is implemented in the shared helper, it applies to both LLM Provider and LLM Proxy policy drawers.

User stories

As an AI Workspace user, I can inspect an applied policy and view its parameters without the policy definition request failing because of incompatible version formatting.

Documentation

N/A — this fixes internal request construction and does not change documented product behavior.

Automation tests

  • Unit tests
    • Not added; the AI Workspace project currently has no unit-test script configured for this helper.
  • Integration tests
    • Not run.

Security checks

Samples

N/A

Related PRs

N/A

Test environment

Static validation completed with git diff --check. The production build could not be run because project dependencies are not installed in the local environment.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 608d69c1-8415-47d5-98f1-afc0dca34bf4

📥 Commits

Reviewing files that changed from the base of the PR and between ee8602f and 6bd6028.

📒 Files selected for processing (1)
  • .github/workflows/ai-workspace-pr-check.yml

📝 Walkthrough

Walkthrough

AI Workspace policy definition requests now normalize version strings before encoding them. The pull-request workflow builds the workspace image using VERSION and pins the compose service to that image.

Changes

AI Workspace updates

Layer / File(s) Summary
Normalize policy definition versions
portals/ai-workspace/src/apis/policyHubApis.ts
getPolicyDefinition removes a leading v or V, appends .0 when needed, and encodes the normalized version.
Pin the built workspace image
.github/workflows/ai-workspace-pr-check.yml
The workflow builds the image from VERSION, updates docker-compose.yaml to reference that version, and removes the temporary backup file.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: pubudu538, malinthaprasan, chamilaadhi

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The workflow edit that pins the AI Workspace image is unrelated to version normalization and issue #2855. Move the workflow/image-pinning change to a separate PR or remove it from this fix so the PR stays focused.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main fix: policy definition version normalization.
Description check ✅ Passed The description covers purpose, goals, approach, user story, docs, tests, security, and environment per the template.
Linked Issues check ✅ Passed The helper change normalizes policy versions as required by issue #2855, so the failure path should be fixed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 24, 2026
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.

[Bug]: Error while checking policy params of an applied policy in AI Workspace

2 participants