Skip to content

Changes from dev to main - #468

Merged
cloby99 merged 11 commits into
mainfrom
dev-app-customer-portal-v1.0.x
Apr 6, 2026
Merged

cloby99 merged 11 commits into
mainfrom
dev-app-customer-portal-v1.0.x

Conversation

@Rashmika998

@Rashmika998 Rashmika998 commented Apr 6, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Describe the problems, issues, or needs driving this feature/fix and include links to related issues in the following format: Resolves issue1, issue2, etc.

Goals

Describe the solutions that this feature/fix will introduce to resolve the problems described above

Approach

Describe how you are implementing the solutions. Include an animated GIF or screenshot if the change affects the UI (email documentation@wso2.com to review all UI text). Include a link to a Markdown file or Google doc if the feature write-up is too long to paste here.

User stories

Summary of user stories addressed by this change>

Release note

Brief description of the new feature or bug fix as it will appear in the release notes

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter �N/A� plus brief explanation of why there�s no doc impact

Training

Link to the PR for changes to the training content in https://github.com/wso2/WSO2-Training, if applicable

Certification

Type �Sent� when you have provided new/updated certification questions, plus four answers for each question (correct answer highlighted in bold), based on this change. Certification questions/answers should be sent to certification@wso2.com and NOT pasted in this PR. If there is no impact on certification exams, type �N/A� and explain why.

Marketing

Link to drafts of marketing content that will describe and promote this feature, including product page changes, technical articles, blog posts, videos, etc., if applicable

Automation tests

  • Unit tests

    Code coverage information

  • Integration tests

    Details about the test cases and coverage

Security checks

Samples

Provide high-level details about the samples related to this feature

Related PRs

List any other related PRs

Migrations (if applicable)

Describe migration steps and platforms on which migration has been tested

Test environment

List all JDK versions, operating systems, databases, and browser/versions on which this feature/fix was tested

Learning

Describe the research phase and any blog posts, patterns, libraries, or add-ons you used to solve the problem.

Summary by CodeRabbit

  • New Features

    • Added instance search endpoints for projects, deployments, and products with optional date-range and pagination.
    • Enhanced instance data returned with metadata and cross-reference links.
  • Improvements

    • Simplified search filters by removing consumption-based nesting.
  • Chores

    • Bumped package/OpenAPI version to 1.0.0-rc.3.
    • Removed in-memory user caching and related dependency.

@coderabbitai

coderabbitai Bot commented Apr 6, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8a4913b7-1b05-4c70-b6a8-f97c639e42bb

📥 Commits

Reviewing files that changed from the base of the PR and between 4e2687b and 6f016ba.

📒 Files selected for processing (1)
  • apps/customer-portal/backend/openapi.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/customer-portal/backend/openapi.yaml

📝 Walkthrough

Walkthrough

Adds instance-search functionality and related types/endpoints, removes consumption-based filtering and in-memory ballerina/cache usage, updates OpenAPI version, and refactors mapping utilities and entity module to support new instance search flows across the customer-portal backend.

Changes

Cohort / File(s) Summary
Package & Dependency Management
apps/customer-portal/backend/Ballerina.toml, apps/customer-portal/backend/Dependencies.toml
Ballerina package version bumped 1.0.0-rc.2 → 1.0.0-rc.3; removed top-level ballerina:cache module entry and removed ballerina:cache from customer_portal dependencies.
Entity & Types Modules
apps/customer-portal/backend/modules/entity/entity.bal, apps/customer-portal/backend/modules/entity/types.bal, apps/customer-portal/backend/modules/types/types.bal
Added searchInstances(idToken, InstanceSearchPayload) and introduced instance-related types (InstanceSearchPayload, InstanceMetadata, new Instance, InstancesResponse); removed ConsumptionFilter and consumption-based fields; removed instance-count/instances fields from DeployedProduct and Deployment.
API Contract
apps/customer-portal/backend/openapi.yaml
Spec version bumped to 1.0.0-rc.3; added three POST instance-search endpoints (/projects/{id}/instances/search, /deployments/{id}/instances/search, /deployments/products/{id}/instances/search); removed ConsumptionFilter schema; added InstanceSearchPayload schema.
Service Implementation
apps/customer-portal/backend/service.bal
Removed ballerina/cache import and userCache; removed caching logic in users/me; added three instance-search resource functions that validate authorization, call entity:searchInstances, map responses, and return proper HTTP status handling and logging.
Utilities / Mapping
apps/customer-portal/backend/utils.bal
Removed instance-count/instances mapping from mapDeployments and mapDeployedProducts; added mapInstancesResponse to convert backend InstancesResponse into the service types:InstancesResponse.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Service as Customer-Portal Service
    participant Entity as Entity Module
    participant Backend as External Backend

    Client->>Service: POST /projects/{id}/instances/search\n(InstanceSearchPayload + idToken)
    Service->>Service: extract authorization header
    Service->>Entity: searchInstances(idToken, payload)
    Entity->>Backend: POST /instances/search\n(payload + auth headers)
    Backend-->>Entity: InstancesResponse
    Entity-->>Service: InstancesResponse
    Service->>Service: mapInstancesResponse()
    Service-->>Client: HTTP 200 OK (mapped InstancesResponse)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested labels

Type/New Feature, Type/Improvement, App/Customer Portal, Area/Backend

Suggested reviewers

  • shayanmalinda
  • yuk7hi

Poem

🐰 I hopped in code to find new trails,
Queries bloom where old consumption fails.
No cache to hide the user’s face,
Instances now have their rightful place.
A tiny hop, a big backend tale.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only the template structure with placeholder text (>symbols and brackets); no actual content has been filled in for any section. Complete all required sections with specific details about the changes, including Purpose, Goals, Approach, User stories, Release note, Documentation, and other applicable sections.
Title check ❓ Inconclusive The title 'Changes from dev to main' is too generic and vague, using non-descriptive language that doesn't convey the actual changes made in this PR. Replace with a specific title summarizing the main change, such as 'Add instance search endpoints and update entity models' or similar that captures the primary modifications.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-app-customer-portal-v1.0.x

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 and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/customer-portal/backend/service.bal (1)

575-640: Consider a shared helper for the three instance-search endpoints.

Only the scoped ID field and route-specific nouns change here. Pulling the common entity:searchInstances + status translation flow into one helper would make future changes to error handling or response mapping much harder to miss in one path.

Also applies to: 833-898, 2566-2632

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/customer-portal/backend/service.bal` around lines 575 - 640, This
endpoint repeats the same entity:searchInstances + status-to-response logic;
extract that common flow into a shared helper (e.g., create a function
searchInstancesForScope(userInfo, id, payload, scopeName) or a generic helper
searchInstancesAndMap(userInfo.idToken, filters, pagination, mapFunc)) and
replace the bodies of resource function post projects/[entity:IdString
id]/instances/search and the other two duplicate endpoints with calls to that
helper; the helper should call entity:searchInstances, inspect
getStatusCode(...) for STATUS_FORBIDDEN/STATUS_UNAUTHORIZED/STATUS_BAD_REQUEST,
log the same messages (use userInfo.userId and the scoped id/route-specific
noun), and return the appropriate http response shape before finally mapping
successful results with mapInstancesResponse.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/customer-portal/backend/openapi.yaml`:
- Line 4: Update the top-level version field in the OpenAPI spec (the "version:"
value in apps/customer-portal/backend/openapi.yaml) from 1.0.0-rc.2 to
1.0.0-rc.3 so it matches the package version in Ballerina.toml; confirm there
are no other stale version fields in the file and keep the version string
identical to the Ballerina.toml entry.
- Around line 275-307: The 200 responses for the instance-search endpoints (e.g.
operationId postProjectsIdInstancesSearch at path
/projects/{id}/instances/search and the equivalent deployment and
deployed-product instance-search paths) are missing response bodies; add an
application/json response schema for HTTP 200 for each of these three POST
endpoints that returns a top-level InstancesResponse object, and add
components.schemas definitions for Instance, InstanceMetadata, and
InstancesResponse (InstancesResponse should include an array of Instance and any
paging/metadata fields). Ensure the three paths referenced in the spec use the
newly defined InstancesResponse schema for their 200 responses so generated
clients/docs will include the returned payload.

---

Nitpick comments:
In `@apps/customer-portal/backend/service.bal`:
- Around line 575-640: This endpoint repeats the same entity:searchInstances +
status-to-response logic; extract that common flow into a shared helper (e.g.,
create a function searchInstancesForScope(userInfo, id, payload, scopeName) or a
generic helper searchInstancesAndMap(userInfo.idToken, filters, pagination,
mapFunc)) and replace the bodies of resource function post
projects/[entity:IdString id]/instances/search and the other two duplicate
endpoints with calls to that helper; the helper should call
entity:searchInstances, inspect getStatusCode(...) for
STATUS_FORBIDDEN/STATUS_UNAUTHORIZED/STATUS_BAD_REQUEST, log the same messages
(use userInfo.userId and the scoped id/route-specific noun), and return the
appropriate http response shape before finally mapping successful results with
mapInstancesResponse.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 86bbfe1c-5a50-496e-9fe9-f846fbcb7663

📥 Commits

Reviewing files that changed from the base of the PR and between 04a5c97 and 4e2687b.

📒 Files selected for processing (8)
  • apps/customer-portal/backend/Ballerina.toml
  • apps/customer-portal/backend/Dependencies.toml
  • apps/customer-portal/backend/modules/entity/entity.bal
  • apps/customer-portal/backend/modules/entity/types.bal
  • apps/customer-portal/backend/modules/types/types.bal
  • apps/customer-portal/backend/openapi.yaml
  • apps/customer-portal/backend/service.bal
  • apps/customer-portal/backend/utils.bal
💤 Files with no reviewable changes (1)
  • apps/customer-portal/backend/Dependencies.toml

Comment thread apps/customer-portal/backend/openapi.yaml Outdated
Comment on lines +275 to +307
/projects/{id}/instances/search:
post:
summary: Search instances of a project.
operationId: postProjectsIdInstancesSearch
parameters:
- name: id
in: path
description: ID of the project
required: true
schema:
$ref: '#/components/schemas/IdString'
requestBody:
description: Payload for searching instances of the project
content:
application/json:
schema:
$ref: '#/components/schemas/InstanceSearchPayload'
required: true
responses:
"200":
description: Ok
"400":
description: BadRequest
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorPayload'
"401":
description: Unauthorized
"500":
description: InternalServerError
"403":
description: Forbidden

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.

⚠️ Potential issue | 🟠 Major

Document the 200 response body for the new instance-search endpoints.

These operations now return an instances payload, but the spec still declares 200 without content and only adds the request schema. Generated docs/clients will treat the response as empty. Add an application/json schema for 200 on all three paths and define Instance, InstanceMetadata, and InstancesResponse under components.schemas.

📘 Minimal spec fix
  /projects/{id}/instances/search:
    post:
      responses:
        "200":
          description: Ok
+         content:
+           application/json:
+             schema:
+               $ref: '#/components/schemas/InstancesResponse'

Repeat the same 200 response schema for the deployment and deployed-product instance-search paths.

Also applies to: 428-460, 1423-1455, 4000-4015

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/customer-portal/backend/openapi.yaml` around lines 275 - 307, The 200
responses for the instance-search endpoints (e.g. operationId
postProjectsIdInstancesSearch at path /projects/{id}/instances/search and the
equivalent deployment and deployed-product instance-search paths) are missing
response bodies; add an application/json response schema for HTTP 200 for each
of these three POST endpoints that returns a top-level InstancesResponse object,
and add components.schemas definitions for Instance, InstanceMetadata, and
InstancesResponse (InstancesResponse should include an array of Instance and any
paging/metadata fields). Ensure the three paths referenced in the spec use the
newly defined InstancesResponse schema for their 200 responses so generated
clients/docs will include the returned payload.

[Customer Portal][BE] Update openapi.yaml file
@cloby99
cloby99 merged commit b9209be into main Apr 6, 2026
1 check passed
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