Skip to content
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

fix: Convert endpoints to reference deployment version instead of release #392

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

adityachoudhari26
Copy link
Contributor

@adityachoudhari26 adityachoudhari26 commented Mar 17, 2025

Summary by CodeRabbit

  • New Features

    • Unified API endpoints and responses now consistently refer to "channels" and "deployment versions" instead of legacy terminology.
    • New endpoints added for creating and managing channels, as well as for handling deployment versions.
    • Request parameters and error messages for channel creation, deletion, and deployment version updates have been streamlined for improved clarity.
  • Documentation

    • API specifications and schema definitions have been revised to reflect the updated naming conventions across channels, environments, and jobs.
    • The OpenAPI specification has been updated to include new endpoints for channel management and deployment versions.

Copy link
Contributor

coderabbitai bot commented Mar 17, 2025

Walkthrough

This PR updates multiple API specifications and route handlers to reflect a shift from “release” terminology toward a broader “channel” and “deployment version” concept. Endpoint paths, operation summaries, and operation IDs have been updated accordingly. Request payload properties and variable names have been renamed (e.g., releaseFilterversionSelector, existingReleaseexistingVersion, versiontag) to improve clarity. Import paths have been changed from relative to absolute in some modules, and schema definitions have been revised to consistently reflect the new terminology.

Changes

File(s) Summary of Changes
apps/webservice/.../api/v1/channels/openapi.ts
apps/webservice/.../api/v1/channels/route.ts
apps/webservice/.../api/v1/deployments/[deploymentId]/channels/name/[name]/openapi.ts
apps/webservice/.../api/v1/deployments/[deploymentId]/channels/name/[name]/route.ts
Updated endpoints, summaries, operation IDs, and response messages to change terminology from “release channel” to “channel.” Also replaced the request parameter releaseFilter with versionSelector.
apps/webservice/.../api/v1/deployments/versions/[versionId]/openapi.ts
apps/webservice/.../api/v1/deployments/versions/openapi.ts
apps/webservice/.../api/v1/deployments/versions/[versionId]/route.ts
apps/webservice/.../api/v1/deployments/versions/route.ts
Modified endpoint paths and API documentation to switch from “release” to “deployment version.” This includes renaming parameters (e.g., releaseIdversionId), changing version to tag, and updating response schemas and error messages.
apps/webservice/.../api/v1/config/route.ts
apps/webservice/.../api/v1/deployments/[deploymentId]/route.ts
Renamed variables (existingReleaseexistingVersion) and updated import statements from relative to absolute paths, without changing the core logic.
apps/webservice/.../api/v1/environments/openapi.ts
apps/webservice/.../api/v1/environments/route.ts
Renamed schema properties for environment creation from releaseChannels and deploymentVersionChannels to channels, altering the expected input while preserving the data structure.
apps/webservice/.../api/v1/job-agents/[agentId]/jobs/running/route.ts
apps/webservice/.../api/v1/jobs/[jobId]/openapi.ts
apps/webservice/.../api/v1/jobs/[jobId]/route.ts
Removed references to release and revised job data handling to use deploymentVersion instead, including updates to metadata extraction and the returned job schema.
apps/webservice/.../api/v1/openapi.ts Renamed the Release schema to DeploymentVersion, changed its property version to tag, and revised related descriptions in policy definitions to align with deployment-specific terminology.

Possibly related PRs

  • fix: Make channel endpoint backwards compatible and perform upsert if nonunique detected #399: The changes in the main PR focus on modifying the API specification for channel management, while the retrieved PR involves updates to the handling of the POST request for creating or updating deployment version channels, specifically addressing the versionSelector field; thus, they are related at the code level.
  • fix: Revert deploymentVersionChannel to releaseChannel #398: The changes in the main PR focus on updating the API specification to generalize the terminology from "release channels" to "channels," while the retrieved PR reverts a property name from "deploymentVersionChannels" back to "releaseChannels," indicating a shift back to the previous terminology; thus, they are related at the code level.
  • fix: Create deployment endpoints #296: The changes in the main PR, which focus on modifying the API specification for channel management, are related to the retrieved PR that introduces new deployment endpoints, as both involve updates to the OpenAPI specifications and share a common context of managing channels and deployments.

Suggested reviewers

  • jsbroks

Poem

I'm a coding rabbit on a joyous spree,
Hopping through endpoints so gracefully free,
From "release" to "channel" my leaps are bright,
With "deployment version" in clear sight,
My burrow is filled with changes anew—
A bunny's tune in code, so true!
🐰💻

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 529e92c and 644258c.

📒 Files selected for processing (16)
  • apps/webservice/src/app/api/v1/channels/openapi.ts (5 hunks)
  • apps/webservice/src/app/api/v1/channels/route.ts (1 hunks)
  • apps/webservice/src/app/api/v1/config/route.ts (1 hunks)
  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/channels/name/[name]/openapi.ts (4 hunks)
  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/channels/name/[name]/route.ts (1 hunks)
  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/route.ts (1 hunks)
  • apps/webservice/src/app/api/v1/deployments/versions/[versionId]/openapi.ts (3 hunks)
  • apps/webservice/src/app/api/v1/deployments/versions/[versionId]/route.ts (3 hunks)
  • apps/webservice/src/app/api/v1/deployments/versions/openapi.ts (2 hunks)
  • apps/webservice/src/app/api/v1/deployments/versions/route.ts (5 hunks)
  • apps/webservice/src/app/api/v1/environments/openapi.ts (1 hunks)
  • apps/webservice/src/app/api/v1/environments/route.ts (3 hunks)
  • apps/webservice/src/app/api/v1/job-agents/[agentId]/jobs/running/route.ts (0 hunks)
  • apps/webservice/src/app/api/v1/jobs/[jobId]/openapi.ts (1 hunks)
  • apps/webservice/src/app/api/v1/jobs/[jobId]/route.ts (3 hunks)
  • apps/webservice/src/app/api/v1/openapi.ts (4 hunks)
💤 Files with no reviewable changes (1)
  • apps/webservice/src/app/api/v1/job-agents/[agentId]/jobs/running/route.ts
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{ts,tsx}`: **Note on Error Handling:** Avoid strict en...

**/*.{ts,tsx}: Note on Error Handling:
Avoid strict enforcement of try/catch blocks. Code may use early returns, Promise chains (.then().catch()), or other patterns for error handling. These are acceptable as long as they maintain clarity and predictability.

  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/channels/name/[name]/route.ts
  • apps/webservice/src/app/api/v1/environments/openapi.ts
  • apps/webservice/src/app/api/v1/channels/route.ts
  • apps/webservice/src/app/api/v1/config/route.ts
  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/route.ts
  • apps/webservice/src/app/api/v1/jobs/[jobId]/openapi.ts
  • apps/webservice/src/app/api/v1/environments/route.ts
  • apps/webservice/src/app/api/v1/deployments/versions/route.ts
  • apps/webservice/src/app/api/v1/openapi.ts
  • apps/webservice/src/app/api/v1/deployments/versions/[versionId]/route.ts
  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/channels/name/[name]/openapi.ts
  • apps/webservice/src/app/api/v1/channels/openapi.ts
  • apps/webservice/src/app/api/v1/jobs/[jobId]/route.ts
  • apps/webservice/src/app/api/v1/deployments/versions/[versionId]/openapi.ts
  • apps/webservice/src/app/api/v1/deployments/versions/openapi.ts
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Typecheck
  • GitHub Check: Lint
  • GitHub Check: build (linux/amd64)
🔇 Additional comments (46)
apps/webservice/src/app/api/v1/config/route.ts (1)

191-194: Variable name update to align with new terminology

The variable has been renamed from existingRelease to existingVersion, which is consistent with the broader refactoring converting "release" terminology to "deployment version" across the codebase.

apps/webservice/src/app/api/v1/deployments/[deploymentId]/route.ts (1)

10-11: Switched from relative to absolute imports

Import paths have been updated from relative paths (../../auth, ../../middleware) to absolute paths using the root alias ~. This change improves maintainability as files can be moved without breaking import paths.

apps/webservice/src/app/api/v1/deployments/versions/[versionId]/route.ts (6)

18-20: Switched from relative to absolute imports

Import paths have been updated from relative paths to absolute paths using the root alias ~, improving code maintainability.


33-33: Updated parameter name in authorization check

The parameter has been renamed from releaseId to versionId to align with the terminology shift from "release" to "deployment version".


38-40: Updated parameter type and variable name

Changed the parameter type from { releaseId: string } to { versionId: string } and updated the destructured variable accordingly. This maintains consistency with the new terminology.


44-44: Variable rename to reflect new terminology

Renamed release to deploymentVersion to be consistent with the terminology change throughout the codebase.


86-87: Updated log message to use new terminology

The log message now correctly references "deployment version" instead of "release", maintaining consistency in user-facing messages.


91-91: Updated return value variable name

Changed the returned variable from release to deploymentVersion to align with the new terminology.

apps/webservice/src/app/api/v1/openapi.ts (8)

100-100: Schema renamed from Release to DeploymentVersion

The schema has been renamed to better reflect its purpose in the context of deployment versions rather than releases.


105-105: Property renamed from version to tag

The property in the DeploymentVersion schema has been renamed from version to tag, which is a breaking change for API clients. This change appears to be intentional to better distinguish between the concept of a deployment version (the entity) and the tag that identifies it.

Since this is a breaking change in the API, ensure that all client code has been updated to use tag instead of version when interacting with deployment versions.


115-115: Updated required property in schema

The required property list has been updated to include tag instead of version, consistent with the property rename.


146-147: Updated policy description to focus on jobs

The description now correctly refers to successful jobs rather than releases, providing clearer documentation.


151-152: Updated success minimum description

The description now refers to "successful deployments" instead of "releases", maintaining terminology consistency.


157-158: Updated concurrency limit description

The description now refers to "deployment pipeline runs" instead of "concurrent releases", which is more precise and consistent with the new terminology.


166-167: Updated minimum release interval description

The description now refers to "version deployments" instead of "releases", aligning with the new terminology.


172-173: Updated release sequencing description

The description now refers to "deployment version" instead of "release", maintaining terminology consistency.

apps/webservice/src/app/api/v1/deployments/versions/openapi.ts (3)

12-15: Path and operation details successfully updated to use deployment version terminology.

The endpoint path, operation summary, and operationId have been appropriately updated to reflect the shift from "release" to "deployment version" terminology.


52-53: Schema reference correctly updated to DeploymentVersion.

The response schema reference has been properly updated to align with the new terminology.


57-57: Error description updated to reference deployment version.

The error description has been properly updated to align with the new terminology.

apps/webservice/src/app/api/v1/channels/route.ts (1)

39-40: Error message updated to "Channel already exists".

The error message has been appropriately updated to align with the new terminology, removing the "Release" prefix.

apps/webservice/src/app/api/v1/deployments/[deploymentId]/channels/name/[name]/route.ts (2)

35-36: Success message updated to "Channel deleted".

The success message has been appropriately updated to align with the new terminology, removing the "Release" prefix.


40-41: Error message updated to "Failed to delete channel".

The error message has been appropriately updated to align with the new terminology, removing the "Release" prefix.

apps/webservice/src/app/api/v1/environments/openapi.ts (1)

44-49: Property renamed from "releaseChannels" to "channels".

The property name has been correctly updated to align with the new terminology, removing the "release" prefix.

apps/webservice/src/app/api/v1/jobs/[jobId]/openapi.ts (1)

17-19: Schema update looks good.

The replacement of release with deploymentVersion in the schema properly aligns with the PR objective of shifting terminology from "release" to "deployment version". This change is consistent with similar updates across other API specs.

apps/webservice/src/app/api/v1/environments/route.ts (4)

18-18: Property name update is consistent with PR objective.

Renaming deploymentVersionChannels to channels in the schema definition aligns with the PR's goal of updating terminology.


51-51: Destructuring update matches schema change.

The updated destructuring correctly uses channels instead of deploymentVersionChannels, matching the schema change.


53-57: Variable name and query update.

Good refactoring to use a more descriptive variable name depVersionChannels and update the query to filter using the renamed channels parameter.


67-67: Parameter name change in createEnv function.

Properly updated the parameter name from channels to versionChannels in the createEnv function call to reflect the new data structure.

apps/webservice/src/app/api/v1/jobs/[jobId]/route.ts (5)

61-95: Simplified data retrieval.

Good refactoring to use row instead of rows and leveraging takeFirstOrNull() to simplify the code. This makes the code more readable and eliminates unnecessary complexity.


103-118: Enhanced metadata handling.

Well-structured addition of deployment version metadata retrieval. This enhances the API response by including metadata in the returned deployment version object.


119-122: Properly constructed deploymentVersion object.

Good job including the fetched metadata in the deploymentVersion object. This ensures that clients receive complete information.


130-131: Updated property name in job execution object.

Properly renamed from version to deploymentVersion in the job execution object, maintaining consistency with the schema changes.


136-138: Updated property reference in approval logic.

Correctly updated the reference from je.version?.id to je.deploymentVersion?.id in the approval verification logic.

apps/webservice/src/app/api/v1/deployments/versions/route.ts (8)

26-28: Import paths updated to absolute imports.

Good update from relative paths to absolute paths with the ~ prefix. This makes imports more consistent and easier to maintain across project refactoring.


30-35: Simplified schema definition.

The schema definition has been appropriately simplified while maintaining the necessary validation requirements.


50-50: Updated destructuring to match schema changes.

Correctly updated the destructuring of the body object to use the new property names.


52-52: Simplified version name logic.

Good use of the nullish coalescing operator to simplify the logic for determining the version name.


61-62: Updated query condition.

Correctly updated the query condition to use the renamed property tag directly.


68-68: Updated database insert values.

The database insert values are properly updated to use the new property names.


127-128: Updated logging terminology.

Properly updated the logging statement to use "deployment version" instead of "release", maintaining terminology consistency.


143-143: Updated error logging terminology.

Error logging has been correctly updated to use the new "deployment version" terminology.

apps/webservice/src/app/api/v1/deployments/versions/[versionId]/openapi.ts (1)

9-9: API path and terminology successfully updated to use consistent "deployment version" nomenclature.

The changes correctly update the OpenAPI specification from "release" to "deployment version" terminology, including the path, operation ID, parameter name, and schema reference. This aligns with the PR objective of standardizing on deployment version terminology.

Also applies to: 11-12, 15-15, 19-19, 29-29, 57-57

apps/webservice/src/app/api/v1/deployments/[deploymentId]/channels/name/[name]/openapi.ts (1)

10-10: API path and terminology properly updated to use "channel" instead of "release channel".

The changes consistently update the endpoint path and operation descriptions from "release channel" to "channel" terminology. This change is properly applied across all relevant fields including the path, summary, operation ID, and response descriptions.

Also applies to: 12-13, 30-30, 54-54, 66-66

apps/webservice/src/app/api/v1/channels/openapi.ts (3)

10-10: API path and operation identifiers updated to use "channel" terminology.

The endpoint path, summary, and operation ID properly reflect the updated terminology, changing from "release-channels" to "channels" and updating the corresponding operation identifiers.

Also applies to: 12-13, 20-20


25-28: Property renamed from "releaseFilter" to "versionSelector".

The property has been consistently renamed from "releaseFilter" to "versionSelector" in both the request schema and response schema, maintaining the same structure with no changes to the underlying type definition.

Also applies to: 47-50


36-36: Response descriptions updated to use consistent "channel" terminology.

The response descriptions have been updated to use "channel" instead of "release channel" across all response status codes, maintaining consistency with the other terminology changes.

Also applies to: 58-58, 73-73

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 644258c and 7b8e92c.

📒 Files selected for processing (1)
  • openapi.v1.json (26 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Lint
  • GitHub Check: build (linux/amd64)
🔇 Additional comments (6)
openapi.v1.json (6)

8-42: New Channel Creation Endpoint Verification
The new POST endpoint at /v1/channels properly defines a channel creation operation with a clear summary and request body schema (including the fields deploymentId, name, and versionSelector) as well as detailed responses. Make sure that the new "channel" terminology is referenced consistently elsewhere in the documentation and that downstream systems are updated accordingly.


167-207: Channel Deletion Endpoint Review
The DELETE operation at /v1/deployments/{deploymentId}/channels/name/{name} is now updated with the operation ID deleteChannel and correct parameters for deleting a channel. The response descriptions appear to be in line with the new channel management context.


265-310: Inconsistency in GET Deployment Endpoint
The AI summary mentioned that the endpoint GET /v1/deployments/{deploymentId} should be removed, yet it is still defined here. Please verify if retaining this endpoint is intentional or if it should be eliminated to fully reflect the shift away from “release” terminology.

Likely an incorrect or invalid review comment.


374-446: Deployment Update Endpoint Confirmation
The PATCH operation for updating a deployment (at /v1/deployments/{deploymentId}) appears standard. Ensure that any changes in context—now signaling a deployment update rather than a release update—are also reflected in the accompanying documentation and related integrations.


574-651: Deployment Version Update Endpoint Review
The PATCH endpoint at /v1/deployments/versions/{versionId} is introducing the new tag property while updating deployment versions. This aligns with the new nomenclature. Verify that upstream systems interpret the tag field correctly in place of any former version references.


3155-3198: DeploymentVersion Schema Review
The DeploymentVersion schema now properly includes the tag property and lists it as required. This update is consistent with the shift from using the term “version” to “tag” across the API. Double-check that all endpoints handling deployment versions reference this updated schema and that any legacy fields have been fully replaced.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
apps/webservice/src/app/api/v1/jobs/[jobId]/acknowledge/openapi.ts (1)

33-37: ⚠️ Potential issue

Fix property name inconsistency in the response schema

There's a typo in the property name "sucess" (line 33), but the required array correctly references "success" (line 37). This inconsistency will cause validation issues since the required property name doesn't match the defined property.

Apply this fix:

  properties: {
-   sucess: {
+   success: {
      type: "boolean",
    },
  },
  required: ["success"],
🧹 Nitpick comments (2)
openapi.v1.json (2)

915-928: Endpoint “/v1/job-agents/{agentId}/jobs/running” – Minor Grammar
The summary currently reads “Get a agents running jobs.” Consider revising it to “Get an agent’s running jobs” for grammatical correctness and clarity.


3155-3197: DeploymentVersion Schema – “tag” Property Addition
The DeploymentVersion schema now includes a new property "tag" (of type string) that is also marked as required. This is a crucial change reflecting the updated nomenclature. To improve clarity, consider adding an example value to illustrate the intended format of the tag.

🛑 Comments failed to post (1)
openapi.v1.json (1)

1114-1144: ⚠️ Potential issue

Typo in Job Acknowledgment Response Schema
In the POST endpoint at “/v1/jobs/{jobId}/acknowledge”, the property is named "sucess" (misspelled) while the required array lists "success". This inconsistency can lead to validation issues. Please correct the property name to "success" in both its definition and in the required array.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
openapi.v1.json (1)

3042-3050: JobWithTrigger Schema – Approval Details Revision
In the JobWithTrigger schema, the embedded approval object (lines 3061–3091) now requires "id" and "name". This enhances clarity regarding the status approval details. Confirm that downstream consumers are prepared for this updated requirement.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a6fd2bd and 53a4ad5.

📒 Files selected for processing (1)
  • openapi.v1.json (48 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build (linux/amd64)
  • GitHub Check: Lint
🔇 Additional comments (11)
openapi.v1.json (11)

4-4: API Title Update
The API title has been updated to “Ctrlplane API”, replacing the old branding. This change looks intentional and aligns with the new overall naming.


8-42: New Channel Creation Endpoint
A new endpoint at /v1/channels has been introduced for channel creation. The POST method correctly defines the request body schema with required properties (deploymentId, name, and versionSelector) and detailed property types (including an optional nullable description). This update aligns with the shift in terminology away from “release” channels.


221-317: Updated Channel Deletion Endpoint
The DELETE endpoint at /v1/deployments/{deploymentId}/channels/name/{name} has been refactored to use the new “channels” terminology instead of the legacy “release-channels”. The parameters and response schema now reflect the channel domain (e.g. “Channel deleted” message). Everything appears consistent with the overall update.


628-705: PATCH Deployment Version Endpoint Update
The PATCH endpoint for /v1/deployments/versions/{versionId} now uses a request body schema that includes a tag property instead of using any legacy “release” terminology. This change meets the objective of referencing the deployment version. Please ensure that all clients are updated to send the tag field as part of the request.


707-796: POST Deployment Version Upsert Endpoint
The new POST endpoint at /v1/deployments/versions correctly defines a schema that requires the tag and deploymentId properties. The usage of tag throughout this endpoint now uniformly represents the deployment version. This change is consistent with the PR objective.


1191-1198: ⚠️ Potential issue

Job Acknowledgment Response Schema Typo
There is a mismatch in the acknowledgment response: the property is defined as "sucess" (lines 1191–1194) but the required array lists "success" (lines 1195–1197). This discrepancy could cause validation errors and client confusion.
Proposed fix diff:

-                    "sucess": {
-                      "type": "boolean"
-                    }
+                    "success": {
+                      "type": "boolean"
+                    }

3236-3279: DeploymentVersion Schema Enhancement
Within the DeploymentVersion schema, the property "tag" (line 3246) is now included and is marked as required (see line 3273). This change clearly reflects the shift to using deployment version references. Ensure that any consumers of this schema are updated accordingly.


3000-3005: Security Scheme Definition
The components section now defines the bearerAuth security scheme (lines 3000–3005) correctly using HTTP Bearer authentication. This addition is properly formatted and consistent with best practices for securing endpoints.


3134-3138: Workspace Schema “required” Fields Update
The Workspace schema now marks "id", "name", and "slug" as required (lines 3134–3138). This update seems appropriate for ensuring that core workspace identity fields are always present.


3303-3317: Policy Schema Enumeration Update
The Policy schema’s approvalRequirement (lines 3303–3307) and successType (lines 3311–3317) enums have been updated to use explicit values such as "manual", "automatic", "some", "all", and "optional". This clarification better expresses the policy behaviors.


3337-3343:

✅ Verification successful

Policy Schema Rollout Sequencing Update
The releaseSequencing property in the Policy schema (lines 3337–3343) now uses the enum values "wait" and "cancel". This should be reviewed to ensure it correctly models the desired behavior for deployment version rollouts given the change in terminology.


Validated releaseSequencing Schema Update
The Policy schema now correctly uses the enum values "wait" and "cancel" (openapi.v1.json, lines 3337–3343) to model deployment rollout sequencing. The updated description appears to align with the intended behavior. Please confirm that any downstream logic or tests that depend on this property are updated accordingly.


🏁 Script executed:

#!/bin/bash
echo "Extracting lines 3337-3343 from openapi.v1.json to verify the updated schema:"
sed -n '3337,3343p' openapi.v1.json

Length of output: 623


Schema Enum Update Verified
The releaseSequencing property in the Policy schema now correctly uses the enum values "wait" and "cancel" at lines 3337–3343 in openapi.v1.json. The updated description accurately reflects the intended behavior for managing deployment rollouts. Please make sure any downstream logic or tests that rely on this property are also updated accordingly.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
openapi.v1.json (4)

8-42: New Channel Creation Endpoint
A new endpoint (/v1/channels) has been introduced with a POST method. The request body schema defines the required fields: "deploymentId", "name", and "versionSelector". The use of an object for versionSelector (with additionalProperties: true) allows flexibility for future options. Please ensure that any client integrations are updated to accommodate these changes and that additional descriptive metadata (such as examples or further documentation for versionSelector) is provided if needed.


15-23: Request Schema Required Fields Clarity
Within the /v1/channels endpoint, the request body’s "required" array explicitly lists "deploymentId", "name", and "versionSelector". This clarity is beneficial for both documentation and validation. Consider adding descriptions or examples for the versionSelector property to guide API consumers.


221-317: Delete Channel Endpoint Update
The endpoint at /v1/deployments/{deploymentId}/channels/name/{name} now handles channel deletion. The changes reflect the updated domain language by using “channel” in the path. Please verify that the response schemas (including the messages and error handling) are fully aligned with your updated business terminology and that any legacy references are removed.


628-706: PATCH Deployment Version Endpoint
The PATCH endpoint for updating a deployment version is introduced here. The request body schema now includes properties such as "tag", "deploymentId", "name", "config", and others. This change aligns with the new terminology replacing “release” with deployment version references. Consider validating fields like "deploymentId" with a UUID format if applicable.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4b993b4 and c953901.

📒 Files selected for processing (1)
  • openapi.v1.json (48 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Typecheck
  • GitHub Check: Lint
  • GitHub Check: build (linux/amd64)
🔇 Additional comments (18)
openapi.v1.json (18)

4-4: API Title Update
The API title has been changed from “Cloud Regions Geo API” to “Ctrlplane API.” This update clearly reflects the new identity and focus of the API.


179-183: Cloud Provider Enum Specification
The enum for the provider parameter in /api/v1/cloud-locations/{provider} now explicitly lists "aws", "gcp", and "azure". This explicit declaration is useful for client-side validations. There are no concerns here.


1189-1198: ⚠️ Potential issue

Typo in Job Acknowledgment Response Schema
There is an inconsistency in the /v1/jobs/{jobId}/acknowledge endpoint: the response schema defines a property named "sucess" while the required array lists "success". This mismatch can lead to validation errors.
Recommended Diff:

-                    "sucess": {
-                      "type": "boolean"
-                    },
+                    "success": {
+                      "type": "boolean"
+                    },

707-796: POST (Upsert) Deployment Version Endpoint
The POST endpoint for upserting a deployment version now requires at least "tag" and "deploymentId". This clear definition is vital for ensuring unambiguous version management. Verify that the "tag" value conforms to any business-defined constraints (such as a specific format or character restrictions).


3000-3005: Security Scheme Definition
The security scheme defined under "securitySchemes" now uses a bearer authentication scheme correctly (type "http" with scheme "bearer"). This is consistent with best practices for token-based authentication in OpenAPI specifications.


3009-3013: CloudRegionGeoData Schema Enhancements
The schema for CloudRegionGeoData now enforces that "timezone", "latitude", and "longitude" are required. This ensures that geographic data is complete and useful.


3042-3091: JobWithTrigger Schema and Approval Sub-schema Update
The JobWithTrigger schema now includes additional fields such as deploymentVersion, deployment, runbook, resource, environment, and a more structured approval sub-schema. Notably, the approval object now requires both "id" and "name". Please verify that these changes are compatible with existing consumers and that the new fields are truly optional versus mandatory based on real–world data.


3134-3139: Workspace Schema Refinement
The Workspace schema has been updated so that the "required" array now includes "id", "name", and "slug". This helps enforce consistency and ensures that the minimum necessary information is always provided.


3166-3172: System Schema Update
The System schema’s "required" fields now include "id", "workspaceId", "name", and "slug", which aligns with the overall data model.


3231-3235: UpdateDeployment Schema Simplification
The UpdateDeployment schema now requires only the "id" field and allows additional properties. This is consistent with a patch/update operation where partial updates are supported.


3236-3279: DeploymentVersion Schema Revision
The DeploymentVersion schema now includes the new "tag" field along with "id", "name", "config", "jobAgentConfig", "deploymentId", and "createdAt". This update is critical for referencing deployment versions in lieu of release terminology.


3280-3356: Policy Schema Updates
The Policy schema now enforces several required properties such as "id", "systemId", "name", "approvalRequirement", "successType", "successMinimum", "rolloutDuration", "minimumReleaseInterval", and "releaseSequencing". Enums are used appropriately to restrict values. Please verify that these enum values align with your business rules.


3357-3412: Environment Schema Enhancements
The Environment schema has been updated so that its "required" array includes "id", "systemId", "name", "createdAt", and "directory". This ensures that every environment has the critical data needed for proper identification and configuration.


3432-3438: Runbook Schema Update
The Runbook schema now mandates that "id", "name", "systemId", and "jobAgentId" are provided. This helps maintain the integrity of runbook-related operations.


3440-3491: Resource Schema Consistency
The Resource schema now requires an extensive set of fields including "id", "name", "version", "kind", "identifier", "config", "workspaceId", "createdAt", "updatedAt", and "metadata". This comprehensive requirement set reinforces data integrity and consistency across resource representations.


3507-3563: Job Schema Update
The Job schema now explicitly requires "id", "status", "createdAt", "updatedAt", and "jobAgentConfig". Optional fields such as "externalId", "startedAt", and "completedAt" remain flexible. This structured approach enhances consistency in job-related responses.


3564-3592: Variable Schema Refinement
The Variable schema has been updated so that "key" and "value" are always required. The inclusion of an optional "sensitive" boolean flag is useful for marking PII or otherwise sensitive data.


3593-3594: File Termination Check
The file closes correctly, indicating that the changes are fully contained and the specification is complete.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bba24bb and 0ee2b04.

📒 Files selected for processing (1)
  • apps/webservice/src/app/api/v1/channels/route.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{ts,tsx}`: **Note on Error Handling:** Avoid strict enforcement of try/catch blocks. Code may use early returns, Promise chains (.then().catch()), or other patterns for error...

**/*.{ts,tsx}: Note on Error Handling:
Avoid strict enforcement of try/catch blocks. Code may use early returns, Promise chains (.then().catch()), or other patterns for error handling. These are acceptable as long as they maintain clarity and predictability.

  • apps/webservice/src/app/api/v1/channels/route.ts
🧬 Code Definitions (1)
apps/webservice/src/app/api/v1/channels/route.ts (2)
apps/webservice/src/app/api/v1/environments/route.ts (1) (1)
  • POST (25:81)
apps/webservice/src/app/api/v1/deployments/versions/route.ts (1) (1)
  • POST (37:150)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Typecheck
  • GitHub Check: Lint
  • GitHub Check: build (linux/amd64)
🔇 Additional comments (3)
apps/webservice/src/app/api/v1/channels/route.ts (3)

1-8: Great use of typed imports and schema-based validation.

The imports from zod and the usage of createDeploymentVersionChannel schema ensure that request body validation is type-safe and consistent.


28-36: Confirm that only the versionSelector field needs conflict updates.

Currently, the conflict resolution updates only "versionSelector". If other fields might need updates when the same (deploymentId, name) combination is encountered (e.g., metadata or status), consider including them in buildConflictUpdateColumns. Otherwise, this code could silently ignore user intent to update any other fields.


13-22:

✅ Verification successful

Verify that the authorization logic covers all deployment scenarios.

Your authorization logic successfully checks for DeploymentVersionChannelCreate permission on the specified deployment before proceeding. However, if there's a chance of additional context checks (like environment or subsystem constraints), ensure that these are enforced at this layer or a lower layer.

Please confirm that no further checks (e.g., environment-specific or additional metadata constraints) are required by other parts of the system by searching for references to DeploymentVersionChannelCreate within the repository:


🏁 Script executed:

#!/bin/bash
# Description: Search for all references to DeploymentVersionChannelCreate to confirm no additional checks are needed.

rg "DeploymentVersionChannelCreate" -A 5

Length of output: 1544


Authorization Logic Verification: No Additional Checks Required

The current implementation in apps/webservice/src/app/api/v1/channels/route.ts correctly checks for the DeploymentVersionChannelCreate permission using the deployment ID from the request body. A repository-wide search for DeploymentVersionChannelCreate (which also highlighted similar logic in packages/api/src/router/deployment-version.ts and the definitions in packages/validators/src/auth/index.ts) did not reveal any supplementary constraints—such as environment-specific or additional metadata checks—that would affect deployment scenarios.

Please ensure that if new requirements (like additional context validations) are introduced in the future, they are integrated consistently across the authorization logic.

.then((deploymentVersionChannel) =>
NextResponse.json(deploymentVersionChannel),
)
.catch((error) => NextResponse.json({ error }, { status: 500 })),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Avoid exposing the raw error object in responses.

Returning error directly may leak sensitive information. It is considered safer to log the full error (for debugging) but return a more generic message to the user.

Below is a proposed diff for safer error handling:

 .catch((error) => {
-  return NextResponse.json({ error }, { status: 500 });
+  logger.error("Failed to create or update deploymentVersionChannel:", error);
+  return NextResponse.json(
+    { error: "Internal Server Error" },
+    { status: 500 }
+  );
});
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.catch((error) => NextResponse.json({ error }, { status: 500 })),
.catch((error) => {
logger.error("Failed to create or update deploymentVersionChannel:", error);
return NextResponse.json(
{ error: "Internal Server Error" },
{ status: 500 }
);
}),

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