Skip to content

Conversation

@adityachoudhari26
Copy link
Contributor

@adityachoudhari26 adityachoudhari26 commented Jul 1, 2025

Summary by CodeRabbit

  • Removals

    • Deployment version channels and release channels features have been fully removed.
    • User interface components, drawers, forms, and management options related to these channels are no longer accessible.
    • API endpoints and documentation for creating, updating, or deleting deployment version and release channels have been removed.
    • Permissions and access controls for deployment version channels have been deleted.
    • Internal data models, database schema, and related backend logic for deployment version channels and release channels have been cleaned up.
  • Bug Fixes

    • Job status override dialog updated and remains supported.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 1, 2025

Caution

Review failed

The pull request is closed.

## Walkthrough

This change removes all code, API endpoints, database schema, permissions, and UI components related to deployment version channels and release channels. It deletes associated backend logic, TRPC routers, OpenAPI specs, and frontend UI for managing these channels. The database schema and migrations are updated to drop related tables and permissions.

## Changes

| File(s) / Path(s)                                                                 | Change Summary                                                                                                   |
|-----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
| `apps/webservice/src/app/.../job/JobDropdownMenu.tsx`, `OverrideJobStatusDialog.tsx` | Moves `OverrideJobStatusDialog` to its own file; updates import paths accordingly.                               |
| `apps/webservice/src/app/.../channel/drawer/*`, `.../environment/drawer/*`, `.../policy/drawer/*`, `.../policy/form/*` | Deletes all UI components, drawers, dropdowns, and forms related to deployment version/release channels and environment policy drawers. |
| `apps/webservice/src/app/.../deployments/version/condition/*`                     | Removes channel selection logic from deployment version condition dialog and selector hook.                       |
| `apps/webservice/src/app/.../environments/[environmentId]/policies/*`             | Removes environment policies page and content components.                                                        |
| `apps/webservice/src/app/.../layout.tsx`                                          | Removes all references to environment/policy/channel drawers from the layout.                                    |
| `apps/webservice/src/app/api/v1/deployment-version-channels/*`, `.../release-channels/*`, `.../environments/*` | Removes all API endpoints, OpenAPI specs, and route handlers for deployment version/release channels; removes related schema fields. |
| `e2e/api/schema.ts`, `openapi.v1.json`                                            | Deletes all OpenAPI endpoint definitions and schema properties for deployment version/release channels; changes security scheme. |
| `packages/api/src/router/*`                                                        | Removes all TRPC routers, procedures, and queries for deployment version channels and related policy logic.      |
| `packages/auth/src/utils/rbac.ts`                                                 | Removes RBAC scope handlers and functions for deployment version channel permissions.                            |
| `packages/db/drizzle/0120_eminent_frank_castle.sql`, `meta/_journal.json`         | Drops database tables for deployment version channels and related policy links; updates enum and journal.        |
| `packages/db/src/schema/*`                                                        | Removes all schema/table/type definitions and relations for deployment version/release channels and policy links.|
| `packages/db/src/utils/upsert-env.ts`                                             | Removes version channel upsert logic from environment upsert utility.                                            |
| `packages/validators/src/auth/index.ts`                                           | Removes all deployment version channel permissions from the permissions enum.                                    |

## Sequence Diagram(s)

*Omitted: The changes are primarily deletions and removals of features, so a control flow diagram is not applicable.*

## Possibly related PRs

- [ctrlplanedev/ctrlplane#361](https://github.com/ctrlplanedev/ctrlplane/pull/361): Modifies `OverrideJobStatusDialog` and its usage in `JobDropdownMenu`; related due to import path and component changes.
- [ctrlplanedev/ctrlplane#162](https://github.com/ctrlplanedev/ctrlplane/pull/162): Extensive additions to job drawer components including `OverrideJobStatusDialog`; related by component evolution.
- [ctrlplanedev/ctrlplane#224](https://github.com/ctrlplanedev/ctrlplane/pull/224): Adds DELETE endpoint for release channels, which is removed in this PR.

## Suggested reviewers

- jsbroks
- zacharyblasczyk

## Poem

> The channels are gone, the code swept clean,  
> No drawers, no routes—just fields of green.  
> The schemas are lighter, the tables are few,  
> Permissions and endpoints bid their adieu.  
> With a hop and a sweep, the rabbit’s delight:  
> Simpler the garden, and lighter the byte!  
> 🐇✨

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bb2152d and c010d23.

📒 Files selected for processing (1)
  • packages/db/drizzle/meta/_journal.json (1 hunks)

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in 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

🧹 Nitpick comments (4)
apps/webservice/src/app/[workspaceSlug]/(app)/_components/job/OverrideJobStatusDialog.tsx (4)

40-52: Consider explicit typing for better maintainability

The component props and form setup look good, but consider adding explicit return type annotation for better type safety and documentation.

-export const OverrideJobStatusDialog: React.FC<{
+export const OverrideJobStatusDialog: React.FC<{
   jobIds: string[];
   children: React.ReactNode;
   onClose?: () => void;
-}> = ({ jobIds, onClose, children }) => {
+}> = ({ jobIds, onClose, children }): JSX.Element => {

54-60: Improve error handling in form submission

The current Promise chain approach works but could be more robust. Consider using try/catch for better error handling and avoiding potential race conditions.

-  const onSubmit = form.handleSubmit((data) =>
-    updateJobs
-      .mutateAsync({ ids: jobIds, data })
-      .then(() => utils.deployment.version.list.invalidate())
-      .then(() => setOpen(false))
-      .then(() => onClose?.()),
-  );
+  const onSubmit = form.handleSubmit(async (data) => {
+    try {
+      await updateJobs.mutateAsync({ ids: jobIds, data });
+      await utils.deployment.version.list.invalidate();
+      setOpen(false);
+      onClose?.();
+    } catch (error) {
+      // Error is already handled by the mutation state
+      console.error('Failed to update job statuses:', error);
+    }
+  });

87-102: Redundant SelectGroup nesting

The nested SelectGroup components are redundant and could be simplified for cleaner markup.

                    <Select value={value} onValueChange={onChange}>
-                      <SelectGroup>
                        <SelectTrigger>
                          <SelectValue />
                        </SelectTrigger>
                        <SelectContent>
                          <SelectGroup>
                            {Object.values(JobStatus).map((status) => (
                              <SelectItem key={status} value={status}>
                                {capitalCase(status)}
                              </SelectItem>
                            ))}
                          </SelectGroup>
                        </SelectContent>
-                      </SelectGroup>
                    </Select>

114-126: Inconsistent button styling approach

The destructive button uses buttonVariants() utility instead of the variant prop, which is inconsistent with the outline button above.

              <Button
                type="submit"
-                className={buttonVariants({ variant: "destructive" })}
+                variant="destructive"
                disabled={updateJobs.isPending}
              >
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 47cc33d and bb2152d.

📒 Files selected for processing (62)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/DeploymentVersionJobsTable.tsx (1 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/ReleaseTargetRow.tsx (1 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/policies/PoliciesPageContent.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/policies/page.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/policies/EnvFlowBuilder.tsx (1 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/policies/EnvFlowPanel.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/channel/drawer/DeploymentVersionChannelDrawer.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/channel/drawer/DeploymentVersionChannelDropdown.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/channel/drawer/Overview.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/channel/drawer/Usage.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/channel/drawer/useDeploymentVersionChannelDrawer.ts (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/DeploymentVersionConditionDialog.tsx (2 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/useDeploymentVersionSelector.ts (1 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/EnvironmentDrawer.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/EnvironmentDropdownMenu.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/Filter.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/Overview.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/policy-override/UpdateOverride.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/policy-override/useOverridePolicy.ts (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/tabs.ts (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/job/JobDropdownMenu.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/job/OverrideJobStatusDialog.tsx (1 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/drawer/EnvironmentPolicyDrawer.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/drawer/Overview.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/drawer/PolicyDeleteDialog.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/drawer/useUpdatePolicy.ts (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/ApprovalAndGovernance.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/DeploymentControl.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/DeploymentVersionChannels.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/ReleaseManagement.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/RolloutAndTiming.tsx (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/_hooks/channel/useDeploymentVersionChannel.ts (0 hunks)
  • apps/webservice/src/app/[workspaceSlug]/(app)/layout.tsx (0 hunks)
  • apps/webservice/src/app/api/v1/deployment-version-channels/openapi.ts (0 hunks)
  • apps/webservice/src/app/api/v1/deployment-version-channels/route.ts (0 hunks)
  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/deployment-version-channels/name/[name]/openapi.ts (0 hunks)
  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/deployment-version-channels/name/[name]/route.ts (0 hunks)
  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/release-channels/name/[name]/openapi.ts (0 hunks)
  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/release-channels/name/[name]/route.ts (0 hunks)
  • apps/webservice/src/app/api/v1/environments/openapi.ts (0 hunks)
  • apps/webservice/src/app/api/v1/environments/route.ts (2 hunks)
  • apps/webservice/src/app/api/v1/release-channels/openapi.ts (0 hunks)
  • apps/webservice/src/app/api/v1/release-channels/route.ts (0 hunks)
  • e2e/api/schema.ts (0 hunks)
  • openapi.v1.json (1 hunks)
  • packages/api/src/router/deployment-version.ts (0 hunks)
  • packages/api/src/router/deployment.ts (1 hunks)
  • packages/api/src/router/environment-page/deployments/deployment-stats.ts (2 hunks)
  • packages/api/src/router/environment-policy.ts (0 hunks)
  • packages/api/src/router/environment.ts (0 hunks)
  • packages/auth/src/utils/rbac.ts (0 hunks)
  • packages/db/drizzle/0120_eminent_frank_castle.sql (1 hunks)
  • packages/db/drizzle/meta/_journal.json (1 hunks)
  • packages/db/src/schema/deployment-version.ts (0 hunks)
  • packages/db/src/schema/environment-policy-relations.ts (0 hunks)
  • packages/db/src/schema/environment.ts (0 hunks)
  • packages/db/src/schema/index.ts (0 hunks)
  • packages/db/src/schema/rbac.ts (0 hunks)
  • packages/db/src/schema/release-channel-relations.ts (0 hunks)
  • packages/db/src/schema/release-channel.ts (0 hunks)
  • packages/db/src/utils/upsert-env.ts (1 hunks)
  • packages/validators/src/auth/index.ts (0 hunks)
💤 Files with no reviewable changes (49)
  • apps/webservice/src/app/api/v1/environments/openapi.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/layout.tsx
  • packages/db/src/schema/rbac.ts
  • packages/api/src/router/environment.ts
  • packages/db/src/schema/environment-policy-relations.ts
  • packages/validators/src/auth/index.ts
  • packages/auth/src/utils/rbac.ts
  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/release-channels/name/[name]/route.ts
  • packages/db/src/schema/release-channel-relations.ts
  • apps/webservice/src/app/api/v1/deployment-version-channels/route.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/policies/page.tsx
  • packages/db/src/schema/index.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/drawer/Overview.tsx
  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/release-channels/name/[name]/openapi.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/tabs.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/policies/EnvFlowPanel.tsx
  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/deployment-version-channels/name/[name]/route.ts
  • packages/db/src/schema/deployment-version.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/Overview.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_hooks/channel/useDeploymentVersionChannel.ts
  • packages/db/src/schema/environment.ts
  • packages/api/src/router/deployment-version.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/channel/drawer/useDeploymentVersionChannelDrawer.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/channel/drawer/Usage.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/ReleaseManagement.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/DeploymentControl.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/drawer/useUpdatePolicy.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/EnvironmentDropdownMenu.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/Filter.tsx
  • apps/webservice/src/app/api/v1/release-channels/openapi.ts
  • apps/webservice/src/app/api/v1/release-channels/route.ts
  • apps/webservice/src/app/api/v1/deployments/[deploymentId]/deployment-version-channels/name/[name]/openapi.ts
  • packages/db/src/schema/release-channel.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/ApprovalAndGovernance.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/channel/drawer/DeploymentVersionChannelDrawer.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/environments/[environmentId]/policies/PoliciesPageContent.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/policy-override/useOverridePolicy.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/channel/drawer/Overview.tsx
  • apps/webservice/src/app/api/v1/deployment-version-channels/openapi.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/drawer/EnvironmentPolicyDrawer.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/drawer/PolicyDeleteDialog.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/channel/drawer/DeploymentVersionChannelDropdown.tsx
  • packages/api/src/router/environment-policy.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/EnvironmentDrawer.tsx
  • e2e/api/schema.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/environment/drawer/policy-override/UpdateOverride.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/RolloutAndTiming.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/job/JobDropdownMenu.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/policy/form/DeploymentVersionChannels.tsx
🧰 Additional context used
📓 Path-based instructions (4)
`**/*.{ts,tsx}`: Use TypeScript with explicit types (prefer interfaces for public APIs) Consistent type imports: `import type { Type } from "module"`

**/*.{ts,tsx}: Use TypeScript with explicit types (prefer interfaces for public APIs)
Consistent type imports: import type { Type } from "module"

📄 Source: CodeRabbit Inference Engine (CLAUDE.md)

List of files the instruction was applied to:

  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/DeploymentVersionJobsTable.tsx
  • apps/webservice/src/app/api/v1/environments/route.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/ReleaseTargetRow.tsx
  • packages/api/src/router/deployment.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/policies/EnvFlowBuilder.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/useDeploymentVersionSelector.ts
  • packages/db/src/utils/upsert-env.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/DeploymentVersionConditionDialog.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/job/OverrideJobStatusDialog.tsx
  • packages/api/src/router/environment-page/deployments/deployment-stats.ts
`**/*.{js,jsx,ts,tsx}`: Import styles: Use named imports, group imports by sourc...

**/*.{js,jsx,ts,tsx}: Import styles: Use named imports, group imports by source (std lib > external > internal)
Prefer async/await over raw promises
Handle errors explicitly (use try/catch and typed error responses)

📄 Source: CodeRabbit Inference Engine (CLAUDE.md)

List of files the instruction was applied to:

  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/DeploymentVersionJobsTable.tsx
  • apps/webservice/src/app/api/v1/environments/route.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/ReleaseTargetRow.tsx
  • packages/api/src/router/deployment.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/policies/EnvFlowBuilder.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/useDeploymentVersionSelector.ts
  • packages/db/src/utils/upsert-env.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/DeploymentVersionConditionDialog.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/job/OverrideJobStatusDialog.tsx
  • packages/api/src/router/environment-page/deployments/deployment-stats.ts
`**/*.{js,jsx,ts,tsx,json,css,md,yml,yaml}`: Formatting: Prettier is used with `@ctrlplane/prettier-config`

**/*.{js,jsx,ts,tsx,json,css,md,yml,yaml}: Formatting: Prettier is used with @ctrlplane/prettier-config

📄 Source: CodeRabbit Inference Engine (CLAUDE.md)

List of files the instruction was applied to:

  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/DeploymentVersionJobsTable.tsx
  • packages/db/drizzle/meta/_journal.json
  • apps/webservice/src/app/api/v1/environments/route.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/ReleaseTargetRow.tsx
  • packages/api/src/router/deployment.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/policies/EnvFlowBuilder.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/useDeploymentVersionSelector.ts
  • packages/db/src/utils/upsert-env.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/DeploymentVersionConditionDialog.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/job/OverrideJobStatusDialog.tsx
  • packages/api/src/router/environment-page/deployments/deployment-stats.ts
  • openapi.v1.json
`**/*.{ts,tsx}`: **Note on Error Handling:** Avoid strict enforcement of try/cat...

**/*.{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.

⚙️ Source: CodeRabbit Configuration File

List of files the instruction was applied to:

  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/DeploymentVersionJobsTable.tsx
  • apps/webservice/src/app/api/v1/environments/route.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/ReleaseTargetRow.tsx
  • packages/api/src/router/deployment.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/policies/EnvFlowBuilder.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/useDeploymentVersionSelector.ts
  • packages/db/src/utils/upsert-env.ts
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/DeploymentVersionConditionDialog.tsx
  • apps/webservice/src/app/[workspaceSlug]/(app)/_components/job/OverrideJobStatusDialog.tsx
  • packages/api/src/router/environment-page/deployments/deployment-stats.ts
🧠 Learnings (13)
📓 Common learnings
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#515
File: apps/webservice/src/app/api/v1/release-targets/[releaseTargetId]/releases/route.ts:103-108
Timestamp: 2025-04-28T18:41:58.813Z
Learning: In this project, full records from the `deployment` and `deployment_version` tables are considered safe for public API consumption, and there's no need to create restricted DTOs for them.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#187
File: apps/jobs/src/ephemeral-env-checker/index.ts:57-0
Timestamp: 2024-10-30T23:10:58.869Z
Learning: In the codebase, deployments are decoupled from environments. When deleting environments (e.g., in `apps/jobs/src/ephemeral-env-checker/index.ts`), associated deployments should not be deleted.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#181
File: packages/auth/src/utils/rbac.ts:102-118
Timestamp: 2024-10-29T02:05:46.185Z
Learning: The `releaseChannel` scope type is included in the `scopeType` enum in `packages/db/src/schema/rbac.ts`.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#601
File: e2e/tests/api/policies/retry-policy.spec.ts:23-24
Timestamp: 2025-06-24T23:52:50.732Z
Learning: The user adityachoudhari26 prefers not to add null safety checks or defensive programming in test code, particularly in e2e tests, as they prioritize simplicity and focus on the main functionality being tested rather than comprehensive error handling within the test itself.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#601
File: e2e/tests/api/policies/retry-policy.spec.ts:117-130
Timestamp: 2025-06-24T23:53:25.398Z
Learning: User adityachoudhari26 prefers to keep non-null assertions in e2e test code without extensive null safety checks, reasoning that test failures serve the same purpose of catching issues and the extra validation doesn't add much value in test contexts.
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/DeploymentVersionJobsTable.tsx (8)
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx:42-44
Timestamp: 2024-11-01T02:35:07.352Z
Learning: In `apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx`, within the `Usage` component, the arrays used for filtering inherited environments are expected to remain small. Therefore, performance optimizations for this filtering logic are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#237
File: apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/DeploymentResourceDrawer.tsx:43-50
Timestamp: 2024-11-27T23:16:35.580Z
Learning: In `DeploymentResourceDrawer.tsx`, the `isOpen` variable already checks whether `deploymentId`, `environmentId`, and `resourceId` are non-null, so additional null checks in query `enabled` conditions are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#187
File: apps/jobs/src/ephemeral-env-checker/index.ts:57-0
Timestamp: 2024-10-30T23:10:58.869Z
Learning: In the codebase, deployments are decoupled from environments. When deleting environments (e.g., in `apps/jobs/src/ephemeral-env-checker/index.ts`), associated deployments should not be deleted.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#408
File: apps/webservice/src/components/form/job-agent/JobAgentJenkinsPipelineConfig.tsx:26-31
Timestamp: 2025-04-12T22:08:13.790Z
Learning: For Jenkins job configuration, two approaches are needed: (1) a simple URL input form for airgapped environments (current focus) and (2) a dropdown selection interface for non-airgapped environments where the Jenkins server is accessible. A component similar to DeploymentJobAgentGithubConfig.tsx is preferred.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#408
File: apps/webservice/src/components/form/job-agent/JobAgentJenkinsPipelineConfig.tsx:26-31
Timestamp: 2025-04-12T22:08:13.790Z
Learning: For Jenkins job configuration, two approaches are needed: (1) a simple URL input form for airgapped environments (current focus) and (2) a dropdown selection interface for non-airgapped environments where the Jenkins server is accessible. A component similar to DeploymentJobAgentGithubConfig.tsx is preferred.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#287
File: packages/validators/src/jobs/conditions/status-condition.ts:4-4
Timestamp: 2025-01-21T19:52:22.838Z
Learning: In apps/webservice/src/app/api/github/webhook/workflow/handler.ts, the external "completed" status is intentionally mapped to JobStatus.Successful to handle GitHub workflow status conversions.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#183
File: apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/Overview.tsx:46-57
Timestamp: 2024-10-30T00:03:57.878Z
Learning: Accessibility and validation feedback improvements are not desired for form fields in the `Overview` component within `apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/Overview.tsx`.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#515
File: apps/webservice/src/app/api/v1/release-targets/[releaseTargetId]/releases/route.ts:103-108
Timestamp: 2025-04-28T18:41:58.813Z
Learning: In this project, full records from the `deployment` and `deployment_version` tables are considered safe for public API consumption, and there's no need to create restricted DTOs for them.
apps/webservice/src/app/api/v1/environments/route.ts (12)
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx:42-44
Timestamp: 2024-11-01T02:35:07.352Z
Learning: In `apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx`, within the `Usage` component, the arrays used for filtering inherited environments are expected to remain small. Therefore, performance optimizations for this filtering logic are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#187
File: apps/jobs/src/ephemeral-env-checker/index.ts:57-0
Timestamp: 2024-10-30T23:10:58.869Z
Learning: In the codebase, deployments are decoupled from environments. When deleting environments (e.g., in `apps/jobs/src/ephemeral-env-checker/index.ts`), associated deployments should not be deleted.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#181
File: packages/api/src/router/deployment.ts:116-131
Timestamp: 2024-10-29T02:04:50.312Z
Learning: In `packages/api/src/router/deployment.ts`, the `list.byDeploymentId` procedure requires multiple database queries due to limitations of the `releaseMatchesCondition` function.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#515
File: apps/event-worker/src/workers/compute-systems-release-targets.ts:86-110
Timestamp: 2025-04-28T18:38:21.163Z
Learning: In SQL queries that use `inArray()` with arrays like `deploymentIds` or `environmentIds`, if these arrays are empty, it will generate an invalid `IN ()` clause that PostgreSQL rejects. Adding condition checks (e.g., `if (array.length > 0)`) before executing such queries prevents SQL syntax errors.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#237
File: apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/DeploymentResourceDrawer.tsx:43-50
Timestamp: 2024-11-27T23:16:35.580Z
Learning: In `DeploymentResourceDrawer.tsx`, the `isOpen` variable already checks whether `deploymentId`, `environmentId`, and `resourceId` are non-null, so additional null checks in query `enabled` conditions are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#237
File: packages/api/src/router/job.ts:362-365
Timestamp: 2024-11-27T23:18:42.055Z
Learning: In the file `packages/api/src/router/job.ts`, the function `releaseMatchesCondition` returns undefined if the `filter` parameter is null. This behavior ensures that when constructing the query with `and(...)`, the condition is omitted, allowing the query to function correctly even if there is no release channel associated with the environment.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#181
File: packages/auth/src/utils/rbac.ts:102-118
Timestamp: 2024-10-29T02:05:46.185Z
Learning: The `releaseChannel` scope type is included in the `scopeType` enum in `packages/db/src/schema/rbac.ts`.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#578
File: apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/integrations/github/GithubDialog.tsx:58-58
Timestamp: 2025-05-30T21:48:48.868Z
Learning: In the ctrlplane codebase, the shadcn form UI version allows initializing forms with `useForm({ schema: formSchema })` directly, without needing to import and use `zodResolver` from '@hookform/resolvers/zod'. This is different from standard react-hook-form usage.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#395
File: packages/api/src/router/environment-page/resources/router.ts:40-45
Timestamp: 2025-03-24T18:46:38.894Z
Learning: The `takeFirst` utility function in the codebase (from `@ctrlplane/db`) throws an Error with message "Found non unique or inexistent value" if the result array doesn't contain exactly one element, making additional null/undefined checks unnecessary after its use.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#579
File: packages/db/src/schema/rules/concurrency.ts:0-0
Timestamp: 2025-06-01T19:10:11.535Z
Learning: In the ctrlplane codebase, when defining database schemas with Drizzle ORM, it's an intentional pattern to spread base fields (like `basePolicyRuleFields`) and then redefine specific fields to add additional constraints (like unique constraints or foreign key references). The TypeScript field overwriting behavior is deliberately used to override base field definitions with more specific requirements.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#280
File: integrations/terraform-cloud-scanner/src/scanner.ts:0-0
Timestamp: 2025-01-14T16:41:56.796Z
Learning: In the Terraform Cloud scanner implementation, functional programming is preferred over imperative approaches, utilizing lodash's chain API and functional methods for data transformation and processing.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#601
File: packages/job-dispatch/src/job-update.ts:264-270
Timestamp: 2025-06-24T23:56:54.799Z
Learning: In this codebase, the `Tx` type is just an alias for the database client type (`Omit<typeof db, "$client">`) and does not necessarily indicate an active transaction context. Functions like `createReleaseJob` need to be called within a transaction, which is why they are wrapped with `db.transaction()` even when the parameter is typed as `Tx`. Drizzle supports nested transactions via breakpoints, so additional transaction wrappers are safe even if already within a transaction.
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/ReleaseTargetRow.tsx (6)
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx:42-44
Timestamp: 2024-11-01T02:35:07.352Z
Learning: In `apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx`, within the `Usage` component, the arrays used for filtering inherited environments are expected to remain small. Therefore, performance optimizations for this filtering logic are not necessary.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#408
File: apps/webservice/src/components/form/job-agent/JobAgentJenkinsPipelineConfig.tsx:26-31
Timestamp: 2025-04-12T22:08:13.790Z
Learning: For Jenkins job configuration, two approaches are needed: (1) a simple URL input form for airgapped environments (current focus) and (2) a dropdown selection interface for non-airgapped environments where the Jenkins server is accessible. A component similar to DeploymentJobAgentGithubConfig.tsx is preferred.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#408
File: apps/webservice/src/components/form/job-agent/JobAgentJenkinsPipelineConfig.tsx:26-31
Timestamp: 2025-04-12T22:08:13.790Z
Learning: For Jenkins job configuration, two approaches are needed: (1) a simple URL input form for airgapped environments (current focus) and (2) a dropdown selection interface for non-airgapped environments where the Jenkins server is accessible. A component similar to DeploymentJobAgentGithubConfig.tsx is preferred.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#237
File: apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/DeploymentResourceDrawer.tsx:43-50
Timestamp: 2024-11-27T23:16:35.580Z
Learning: In `DeploymentResourceDrawer.tsx`, the `isOpen` variable already checks whether `deploymentId`, `environmentId`, and `resourceId` are non-null, so additional null checks in query `enabled` conditions are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#287
File: packages/validators/src/jobs/conditions/status-condition.ts:4-4
Timestamp: 2025-01-21T19:52:22.838Z
Learning: In apps/webservice/src/app/api/github/webhook/workflow/handler.ts, the external "completed" status is intentionally mapped to JobStatus.Successful to handle GitHub workflow status conversions.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#183
File: apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/Overview.tsx:46-57
Timestamp: 2024-10-30T00:03:57.878Z
Learning: Accessibility and validation feedback improvements are not desired for form fields in the `Overview` component within `apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/Overview.tsx`.
packages/api/src/router/deployment.ts (11)
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#181
File: packages/api/src/router/deployment.ts:116-131
Timestamp: 2024-10-29T02:04:50.312Z
Learning: In `packages/api/src/router/deployment.ts`, the `list.byDeploymentId` procedure requires multiple database queries due to limitations of the `releaseMatchesCondition` function.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: packages/api/src/router/deployment.ts:144-161
Timestamp: 2024-11-01T02:37:25.510Z
Learning: In `packages/api/src/router/deployment.ts`, when using Drizzle ORM, there is a limitation when referencing the same table twice in a relational builder query (rbq), requiring separate queries to avoid issues.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#515
File: apps/webservice/src/app/api/v1/release-targets/[releaseTargetId]/releases/route.ts:103-108
Timestamp: 2025-04-28T18:41:58.813Z
Learning: In this project, full records from the `deployment` and `deployment_version` tables are considered safe for public API consumption, and there's no need to create restricted DTOs for them.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#237
File: packages/api/src/router/job.ts:362-365
Timestamp: 2024-11-27T23:18:42.055Z
Learning: In the file `packages/api/src/router/job.ts`, the function `releaseMatchesCondition` returns undefined if the `filter` parameter is null. This behavior ensures that when constructing the query with `and(...)`, the condition is omitted, allowing the query to function correctly even if there is no release channel associated with the environment.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#187
File: apps/jobs/src/ephemeral-env-checker/index.ts:57-0
Timestamp: 2024-10-30T23:10:58.869Z
Learning: In the codebase, deployments are decoupled from environments. When deleting environments (e.g., in `apps/jobs/src/ephemeral-env-checker/index.ts`), associated deployments should not be deleted.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#237
File: apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/DeploymentResourceDrawer.tsx:43-50
Timestamp: 2024-11-27T23:16:35.580Z
Learning: In `DeploymentResourceDrawer.tsx`, the `isOpen` variable already checks whether `deploymentId`, `environmentId`, and `resourceId` are non-null, so additional null checks in query `enabled` conditions are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx:42-44
Timestamp: 2024-11-01T02:35:07.352Z
Learning: In `apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx`, within the `Usage` component, the arrays used for filtering inherited environments are expected to remain small. Therefore, performance optimizations for this filtering logic are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#395
File: packages/api/src/router/environment-page/resources/router.ts:40-45
Timestamp: 2025-03-24T18:46:38.894Z
Learning: The `takeFirst` utility function in the codebase (from `@ctrlplane/db`) throws an Error with message "Found non unique or inexistent value" if the result array doesn't contain exactly one element, making additional null/undefined checks unnecessary after its use.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#593
File: packages/rule-engine/src/manager/version-manager-rules/version-approval.ts:55-70
Timestamp: 2025-06-18T21:46:51.459Z
Learning: The `takeFirst` utility function from the database layer throws an error if no record is found, rather than returning `undefined`. This means functions using `takeFirst` already have error handling built-in and don't require additional null checks.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#280
File: integrations/terraform-cloud-scanner/src/scanner.ts:0-0
Timestamp: 2025-01-14T16:41:56.796Z
Learning: In the Terraform Cloud scanner implementation, functional programming is preferred over imperative approaches, utilizing lodash's chain API and functional methods for data transformation and processing.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#604
File: packages/rule-engine/src/manager/version-manager.ts:124-139
Timestamp: 2025-06-30T21:19:43.835Z
Learning: In packages/rule-engine/src/manager/version-manager.ts, the findDesiredVersion method should use takeFirst (not takeFirstOrNull) because if a desiredVersionId is set but the query fails to find exactly one matching version, it indicates a data integrity or configuration issue that should fail loudly rather than be handled silently.
apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/policies/EnvFlowBuilder.tsx (7)
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx:42-44
Timestamp: 2024-11-01T02:35:07.352Z
Learning: In `apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx`, within the `Usage` component, the arrays used for filtering inherited environments are expected to remain small. Therefore, performance optimizations for this filtering logic are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/EnvironmentDrawer.tsx:139-154
Timestamp: 2024-11-01T02:36:23.101Z
Learning: In `EnvironmentDrawer.tsx`, for the `EnvironmentDrawer` component, when there are only a few `TabButton` instances (e.g., 3), it's acceptable to define them individually without extracting them into a configuration to reduce repetition.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#237
File: apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/DeploymentResourceDrawer.tsx:43-50
Timestamp: 2024-11-27T23:16:35.580Z
Learning: In `DeploymentResourceDrawer.tsx`, the `isOpen` variable already checks whether `deploymentId`, `environmentId`, and `resourceId` are non-null, so additional null checks in query `enabled` conditions are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#187
File: apps/jobs/src/ephemeral-env-checker/index.ts:57-0
Timestamp: 2024-10-30T23:10:58.869Z
Learning: In the codebase, deployments are decoupled from environments. When deleting environments (e.g., in `apps/jobs/src/ephemeral-env-checker/index.ts`), associated deployments should not be deleted.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#183
File: apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/Overview.tsx:46-57
Timestamp: 2024-10-30T00:03:57.878Z
Learning: Accessibility and validation feedback improvements are not desired for form fields in the `Overview` component within `apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/Overview.tsx`.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#165
File: apps/webservice/src/app/[workspaceSlug]/_components/relationships/RelationshipsDiagramDependencies.tsx:185-189
Timestamp: 2024-10-24T21:31:17.820Z
Learning: In `RelationshipsDiagramDependencies.tsx`, when using React Flow's `BaseEdge`, the `markerStart` prop may intentionally use the `markerEnd` value to flip the arrow direction because 'source depends on target' logic is applied. These are intrinsic attributes of the React Flow `BaseEdge` component and cannot be renamed or changed.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#183
File: apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/EnvironmentDrawer.tsx:55-57
Timestamp: 2024-10-29T23:49:24.855Z
Learning: In `EnvironmentDrawer.tsx`, we prefer to fetch all data upfront and show a loading indicator until everything is fetched, unless performance becomes an issue.
apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/useDeploymentVersionSelector.ts (7)
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#237
File: apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/DeploymentResourceDrawer.tsx:43-50
Timestamp: 2024-11-27T23:16:35.580Z
Learning: In `DeploymentResourceDrawer.tsx`, the `isOpen` variable already checks whether `deploymentId`, `environmentId`, and `resourceId` are non-null, so additional null checks in query `enabled` conditions are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx:42-44
Timestamp: 2024-11-01T02:35:07.352Z
Learning: In `apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx`, within the `Usage` component, the arrays used for filtering inherited environments are expected to remain small. Therefore, performance optimizations for this filtering logic are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#237
File: packages/api/src/router/job.ts:362-365
Timestamp: 2024-11-27T23:18:42.055Z
Learning: In the file `packages/api/src/router/job.ts`, the function `releaseMatchesCondition` returns undefined if the `filter` parameter is null. This behavior ensures that when constructing the query with `and(...)`, the condition is omitted, allowing the query to function correctly even if there is no release channel associated with the environment.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#187
File: apps/jobs/src/ephemeral-env-checker/index.ts:57-0
Timestamp: 2024-10-30T23:10:58.869Z
Learning: In the codebase, deployments are decoupled from environments. When deleting environments (e.g., in `apps/jobs/src/ephemeral-env-checker/index.ts`), associated deployments should not be deleted.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#181
File: packages/api/src/router/deployment.ts:116-131
Timestamp: 2024-10-29T02:04:50.312Z
Learning: In `packages/api/src/router/deployment.ts`, the `list.byDeploymentId` procedure requires multiple database queries due to limitations of the `releaseMatchesCondition` function.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#382
File: apps/webservice/src/app/api/v1/deployments/[deploymentId]/route.ts:82-88
Timestamp: 2025-03-16T19:41:44.129Z
Learning: In Next.js 15, dynamic route parameters (params) return Promises instead of direct values in async contexts. When accessing properties like `params.deploymentId` in an async function, use `(await params).deploymentId` to avoid the "params should be awaited before using its properties" error. This applies to API routes, page components, and other async contexts.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#382
File: apps/webservice/src/app/api/v1/deployments/[deploymentId]/route.ts:82-88
Timestamp: 2025-03-16T19:41:44.129Z
Learning: In Next.js 15, params in dynamic routes must be awaited before accessing their properties in async contexts. For example, `params.deploymentId` should be accessed as `(await params).deploymentId` in async functions.
packages/db/drizzle/0120_eminent_frank_castle.sql (2)
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#181
File: packages/auth/src/utils/rbac.ts:102-118
Timestamp: 2024-10-29T02:05:46.185Z
Learning: The `releaseChannel` scope type is included in the `scopeType` enum in `packages/db/src/schema/rbac.ts`.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#515
File: apps/webservice/src/app/api/v1/release-targets/[releaseTargetId]/releases/route.ts:103-108
Timestamp: 2025-04-28T18:41:58.813Z
Learning: In this project, full records from the `deployment` and `deployment_version` tables are considered safe for public API consumption, and there's no need to create restricted DTOs for them.
packages/db/src/utils/upsert-env.ts (3)
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#187
File: apps/jobs/src/ephemeral-env-checker/index.ts:57-0
Timestamp: 2024-10-30T23:10:58.869Z
Learning: In the codebase, deployments are decoupled from environments. When deleting environments (e.g., in `apps/jobs/src/ephemeral-env-checker/index.ts`), associated deployments should not be deleted.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx:42-44
Timestamp: 2024-11-01T02:35:07.352Z
Learning: In `apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx`, within the `Usage` component, the arrays used for filtering inherited environments are expected to remain small. Therefore, performance optimizations for this filtering logic are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#579
File: packages/db/src/schema/rules/concurrency.ts:0-0
Timestamp: 2025-06-01T19:10:11.535Z
Learning: In the ctrlplane codebase, when defining database schemas with Drizzle ORM, it's an intentional pattern to spread base fields (like `basePolicyRuleFields`) and then redefine specific fields to add additional constraints (like unique constraints or foreign key references). The TypeScript field overwriting behavior is deliberately used to override base field definitions with more specific requirements.
apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/DeploymentVersionConditionDialog.tsx (10)
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#237
File: apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/DeploymentResourceDrawer.tsx:43-50
Timestamp: 2024-11-27T23:16:35.580Z
Learning: In `DeploymentResourceDrawer.tsx`, the `isOpen` variable already checks whether `deploymentId`, `environmentId`, and `resourceId` are non-null, so additional null checks in query `enabled` conditions are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx:42-44
Timestamp: 2024-11-01T02:35:07.352Z
Learning: In `apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx`, within the `Usage` component, the arrays used for filtering inherited environments are expected to remain small. Therefore, performance optimizations for this filtering logic are not necessary.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#408
File: apps/webservice/src/components/form/job-agent/JobAgentJenkinsPipelineConfig.tsx:26-31
Timestamp: 2025-04-12T22:08:13.790Z
Learning: For Jenkins job configuration, two approaches are needed: (1) a simple URL input form for airgapped environments (current focus) and (2) a dropdown selection interface for non-airgapped environments where the Jenkins server is accessible. A component similar to DeploymentJobAgentGithubConfig.tsx is preferred.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#408
File: apps/webservice/src/components/form/job-agent/JobAgentJenkinsPipelineConfig.tsx:26-31
Timestamp: 2025-04-12T22:08:13.790Z
Learning: For Jenkins job configuration, two approaches are needed: (1) a simple URL input form for airgapped environments (current focus) and (2) a dropdown selection interface for non-airgapped environments where the Jenkins server is accessible. A component similar to DeploymentJobAgentGithubConfig.tsx is preferred.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#183
File: apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/Overview.tsx:46-57
Timestamp: 2024-10-30T00:03:57.878Z
Learning: Accessibility and validation feedback improvements are not desired for form fields in the `Overview` component within `apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/Overview.tsx`.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/EnvironmentDrawer.tsx:139-154
Timestamp: 2024-11-01T02:36:23.101Z
Learning: In `EnvironmentDrawer.tsx`, for the `EnvironmentDrawer` component, when there are only a few `TabButton` instances (e.g., 3), it's acceptable to define them individually without extracting them into a configuration to reduce repetition.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#187
File: apps/jobs/src/ephemeral-env-checker/index.ts:57-0
Timestamp: 2024-10-30T23:10:58.869Z
Learning: In the codebase, deployments are decoupled from environments. When deleting environments (e.g., in `apps/jobs/src/ephemeral-env-checker/index.ts`), associated deployments should not be deleted.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#578
File: apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/integrations/github/GithubDialog.tsx:58-58
Timestamp: 2025-05-30T21:48:48.868Z
Learning: In the ctrlplane codebase, the shadcn form UI version allows initializing forms with `useForm({ schema: formSchema })` directly, without needing to import and use `zodResolver` from '@hookform/resolvers/zod'. This is different from standard react-hook-form usage.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#183
File: apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/Overview.tsx:28-34
Timestamp: 2024-10-30T00:03:58.927Z
Learning: In the Ctrlplane project, error handling for API mutations in React components is not required unless specified by the user.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#181
File: packages/api/src/router/deployment.ts:116-131
Timestamp: 2024-10-29T02:04:50.312Z
Learning: In `packages/api/src/router/deployment.ts`, the `list.byDeploymentId` procedure requires multiple database queries due to limitations of the `releaseMatchesCondition` function.
apps/webservice/src/app/[workspaceSlug]/(app)/_components/job/OverrideJobStatusDialog.tsx (5)
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#408
File: apps/webservice/src/components/form/job-agent/JobAgentJenkinsPipelineConfig.tsx:26-31
Timestamp: 2025-04-12T22:08:13.790Z
Learning: For Jenkins job configuration, two approaches are needed: (1) a simple URL input form for airgapped environments (current focus) and (2) a dropdown selection interface for non-airgapped environments where the Jenkins server is accessible. A component similar to DeploymentJobAgentGithubConfig.tsx is preferred.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#408
File: apps/webservice/src/components/form/job-agent/JobAgentJenkinsPipelineConfig.tsx:26-31
Timestamp: 2025-04-12T22:08:13.790Z
Learning: For Jenkins job configuration, two approaches are needed: (1) a simple URL input form for airgapped environments (current focus) and (2) a dropdown selection interface for non-airgapped environments where the Jenkins server is accessible. A component similar to DeploymentJobAgentGithubConfig.tsx is preferred.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#183
File: apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/Overview.tsx:46-57
Timestamp: 2024-10-30T00:03:57.878Z
Learning: Accessibility and validation feedback improvements are not desired for form fields in the `Overview` component within `apps/webservice/src/app/[workspaceSlug]/_components/environment-drawer/Overview.tsx`.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#287
File: packages/validators/src/jobs/conditions/status-condition.ts:4-4
Timestamp: 2025-01-21T19:52:22.838Z
Learning: In apps/webservice/src/app/api/github/webhook/workflow/handler.ts, the external "completed" status is intentionally mapped to JobStatus.Successful to handle GitHub workflow status conversions.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#578
File: apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/integrations/github/GithubDialog.tsx:58-58
Timestamp: 2025-05-30T21:48:48.868Z
Learning: In the ctrlplane codebase, the shadcn form UI version allows initializing forms with `useForm({ schema: formSchema })` directly, without needing to import and use `zodResolver` from '@hookform/resolvers/zod'. This is different from standard react-hook-form usage.
packages/api/src/router/environment-page/deployments/deployment-stats.ts (17)
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#181
File: packages/api/src/router/deployment.ts:116-131
Timestamp: 2024-10-29T02:04:50.312Z
Learning: In `packages/api/src/router/deployment.ts`, the `list.byDeploymentId` procedure requires multiple database queries due to limitations of the `releaseMatchesCondition` function.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#187
File: apps/jobs/src/ephemeral-env-checker/index.ts:57-0
Timestamp: 2024-10-30T23:10:58.869Z
Learning: In the codebase, deployments are decoupled from environments. When deleting environments (e.g., in `apps/jobs/src/ephemeral-env-checker/index.ts`), associated deployments should not be deleted.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#237
File: apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployment-resource-drawer/DeploymentResourceDrawer.tsx:43-50
Timestamp: 2024-11-27T23:16:35.580Z
Learning: In `DeploymentResourceDrawer.tsx`, the `isOpen` variable already checks whether `deploymentId`, `environmentId`, and `resourceId` are non-null, so additional null checks in query `enabled` conditions are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: packages/api/src/router/deployment.ts:144-161
Timestamp: 2024-11-01T02:37:25.510Z
Learning: In `packages/api/src/router/deployment.ts`, when using Drizzle ORM, there is a limitation when referencing the same table twice in a relational builder query (rbq), requiring separate queries to avoid issues.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#188
File: apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx:42-44
Timestamp: 2024-11-01T02:35:07.352Z
Learning: In `apps/webservice/src/app/[workspaceSlug]/_components/release-channel-drawer/Usage.tsx`, within the `Usage` component, the arrays used for filtering inherited environments are expected to remain small. Therefore, performance optimizations for this filtering logic are not necessary.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#515
File: apps/webservice/src/app/api/v1/release-targets/[releaseTargetId]/releases/route.ts:103-108
Timestamp: 2025-04-28T18:41:58.813Z
Learning: In this project, full records from the `deployment` and `deployment_version` tables are considered safe for public API consumption, and there's no need to create restricted DTOs for them.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#395
File: packages/api/src/router/environment-page/resources/router.ts:40-45
Timestamp: 2025-03-24T18:46:38.894Z
Learning: The `takeFirst` utility function in the codebase (from `@ctrlplane/db`) throws an Error with message "Found non unique or inexistent value" if the result array doesn't contain exactly one element, making additional null/undefined checks unnecessary after its use.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#579
File: packages/db/src/schema/rules/concurrency.ts:0-0
Timestamp: 2025-06-01T19:10:11.535Z
Learning: In the ctrlplane codebase, when defining database schemas with Drizzle ORM, it's an intentional pattern to spread base fields (like `basePolicyRuleFields`) and then redefine specific fields to add additional constraints (like unique constraints or foreign key references). The TypeScript field overwriting behavior is deliberately used to override base field definitions with more specific requirements.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#593
File: packages/rule-engine/src/manager/version-manager-rules/version-approval.ts:55-70
Timestamp: 2025-06-18T21:46:51.459Z
Learning: The `takeFirst` utility function from the database layer throws an error if no record is found, rather than returning `undefined`. This means functions using `takeFirst` already have error handling built-in and don't require additional null checks.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#578
File: apps/webservice/src/app/[workspaceSlug]/(app)/resources/(sidebar)/providers/integrations/github/GithubDialog.tsx:58-58
Timestamp: 2025-05-30T21:48:48.868Z
Learning: In the ctrlplane codebase, the shadcn form UI version allows initializing forms with `useForm({ schema: formSchema })` directly, without needing to import and use `zodResolver` from '@hookform/resolvers/zod'. This is different from standard react-hook-form usage.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#280
File: integrations/terraform-cloud-scanner/src/scanner.ts:0-0
Timestamp: 2025-01-14T16:41:56.796Z
Learning: In the Terraform Cloud scanner implementation, functional programming is preferred over imperative approaches, utilizing lodash's chain API and functional methods for data transformation and processing.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#237
File: packages/api/src/router/job.ts:362-365
Timestamp: 2024-11-27T23:18:42.055Z
Learning: In the file `packages/api/src/router/job.ts`, the function `releaseMatchesCondition` returns undefined if the `filter` parameter is null. This behavior ensures that when constructing the query with `and(...)`, the condition is omitted, allowing the query to function correctly even if there is no release channel associated with the environment.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#287
File: packages/validators/src/jobs/conditions/status-condition.ts:4-4
Timestamp: 2025-01-21T19:52:22.838Z
Learning: In apps/webservice/src/app/api/github/webhook/workflow/handler.ts, the external "completed" status is intentionally mapped to JobStatus.Successful to handle GitHub workflow status conversions.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#408
File: apps/webservice/src/components/form/job-agent/JobAgentJenkinsPipelineConfig.tsx:26-31
Timestamp: 2025-04-12T22:08:13.790Z
Learning: For Jenkins job configuration, two approaches are needed: (1) a simple URL input form for airgapped environments (current focus) and (2) a dropdown selection interface for non-airgapped environments where the Jenkins server is accessible. A component similar to DeploymentJobAgentGithubConfig.tsx is preferred.
Learnt from: zacharyblasczyk
PR: ctrlplanedev/ctrlplane#408
File: apps/webservice/src/components/form/job-agent/JobAgentJenkinsPipelineConfig.tsx:26-31
Timestamp: 2025-04-12T22:08:13.790Z
Learning: For Jenkins job configuration, two approaches are needed: (1) a simple URL input form for airgapped environments (current focus) and (2) a dropdown selection interface for non-airgapped environments where the Jenkins server is accessible. A component similar to DeploymentJobAgentGithubConfig.tsx is preferred.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#601
File: packages/job-dispatch/src/job-update.ts:264-270
Timestamp: 2025-06-24T23:56:54.799Z
Learning: In this codebase, the `Tx` type is just an alias for the database client type (`Omit<typeof db, "$client">`) and does not necessarily indicate an active transaction context. Functions like `createReleaseJob` need to be called within a transaction, which is why they are wrapped with `db.transaction()` even when the parameter is typed as `Tx`. Drizzle supports nested transactions via breakpoints, so additional transaction wrappers are safe even if already within a transaction.
Learnt from: adityachoudhari26
PR: ctrlplanedev/ctrlplane#604
File: packages/rule-engine/src/manager/version-manager.ts:124-139
Timestamp: 2025-06-30T21:19:43.835Z
Learning: In packages/rule-engine/src/manager/version-manager.ts, the findDesiredVersion method should use takeFirst (not takeFirstOrNull) because if a desiredVersionId is set but the query fails to find exactly one matching version, it indicates a data integrity or configuration issue that should fail loudly rather than be handled silently.
openapi.v1.json (3)

undefined

<retrieved_learning>
Learnt from: adityachoudhari26
PR: #515
File: apps/webservice/src/app/api/v1/release-targets/[releaseTargetId]/releases/route.ts:103-108
Timestamp: 2025-04-28T18:41:58.813Z
Learning: In this project, full records from the deployment and deployment_version tables are considered safe for public API consumption, and there's no need to create restricted DTOs for them.
</retrieved_learning>

<retrieved_learning>
Learnt from: adityachoudhari26
PR: #181
File: packages/api/src/router/deployment.ts:116-131
Timestamp: 2024-10-29T02:04:50.312Z
Learning: In packages/api/src/router/deployment.ts, the list.byDeploymentId procedure requires multiple database queries due to limitations of the releaseMatchesCondition function.
</retrieved_learning>

<retrieved_learning>
Learnt from: adityachoudhari26
PR: #288
File: apps/event-worker/src/job-dispatch/github.ts:126-129
Timestamp: 2025-01-22T07:38:08.877Z
Learning: GitHub API accepts both 'Bearer' and 'token' schemes for authentication with installation tokens.
</retrieved_learning>

🧬 Code Graph Analysis (1)
packages/api/src/router/environment-page/deployments/deployment-stats.ts (1)
packages/db/src/schema/deployment.ts (1)
  • deployment (69-93)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Typecheck
  • GitHub Check: Lint
  • GitHub Check: build (linux/amd64)
  • GitHub Check: build (linux/amd64)
  • GitHub Check: build (linux/amd64)
🔇 Additional comments (18)
packages/db/src/utils/upsert-env.ts (1)

13-13: LGTM! Clean removal of version channels support.

The removal of versionChannels from the destructuring correctly implements the deprecation of version channel functionality while preserving all other environment creation logic.

packages/db/drizzle/0120_eminent_frank_castle.sql (1)

1-6: Well-structured database migration for version channels removal.

The migration correctly handles the complex enum type modification by:

  1. Converting the column to text first to avoid type conflicts
  2. Dropping the old enum type
  3. Creating the new enum without deploymentVersionChannel
  4. Converting the column back to the new enum type

The CASCADE option on table drops ensures dependent objects are properly cleaned up.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/DeploymentVersionJobsTable.tsx (1)

28-28: Import path correctly updated for component refactoring.

The import change from JobDropdownMenu to OverrideJobStatusDialog aligns with the extraction of the dialog into its own standalone component file.

packages/db/drizzle/meta/_journal.json (1)

845-851: Migration journal entry correctly added.

The new journal entry properly documents the version channels removal migration with the correct index, version, and tag matching the migration file.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(raw)/deployments/[deploymentSlug]/(raw)/releases/[releaseId]/jobs/_components/ReleaseTargetRow.tsx (1)

30-30: Import path correctly updated for component refactoring.

The import change from JobDropdownMenu to OverrideJobStatusDialog properly reflects the extraction of the dialog into its own component file, consistent with the same change in DeploymentVersionJobsTable.tsx.

apps/webservice/src/app/[workspaceSlug]/(app)/(deploy)/(raw)/systems/[systemSlug]/(sidebar)/policies/EnvFlowBuilder.tsx (1)

258-258: LGTM: Simplified node click handling.

The simplification to only set the selected node ID is appropriate given the removal of environment and policy drawer components as part of the version channel deprecation.

packages/api/src/router/deployment.ts (1)

375-375: LGTM: Simplified deployment mapping.

The mapping logic has been appropriately simplified by removing version channel processing. The change correctly removes the complex extraction and filtering of versionChannels that was previously done.

packages/api/src/router/environment-page/deployments/deployment-stats.ts (2)

6-6: LGTM: Updated imports reflect removed functionality.

The import changes correctly reflect the removal of the getVersionSelector function and related version channel filtering logic.


102-102: LGTM: Simplified query filtering.

The WHERE clause has been appropriately simplified to filter only by deployment ID, removing the version selector condition that was previously used for deployment version channel filtering.

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

7-7: LGTM: Removed unused import.

The inArray import is no longer needed since deployment version channel processing has been removed.


16-18: LGTM: Simplified schema definition.

The removal of deploymentVersionChannels from the request body schema is consistent with the deprecation of version channel functionality.


38-38: LGTM: Simplified environment upsert logic.

The direct call to upsertEnv appropriately removes the complex transaction logic that previously handled deployment version channels.

apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/useDeploymentVersionSelector.ts (1)

24-25: LGTM: Simplified function signature.

The removal of the optional deploymentVersionChannelId parameter from setSelector is appropriate given the deprecation of deployment version channel functionality. The function now correctly focuses only on managing the selector parameter.

apps/webservice/src/app/[workspaceSlug]/(app)/_components/job/OverrideJobStatusDialog.tsx (1)

1-35: LGTM: Clean imports and setup

The imports are well-organized and properly typed. The zod schema definition is appropriate for the use case.

apps/webservice/src/app/[workspaceSlug]/(app)/_components/deployments/version/condition/DeploymentVersionConditionDialog.tsx (4)

27-32: LGTM: Props simplified appropriately

The prop changes correctly remove deployment version channel support while maintaining the core functionality for condition editing.


36-49: Clean removal of channel-related logic

The component logic has been properly simplified to focus only on condition editing, removing all channel-related state and hooks while preserving the validation logic.


58-69: UI appropriately simplified

The dialog header and content have been updated to reflect the simplified functionality, removing channel selection UI while maintaining the core condition editing interface.


71-105: Validation and save logic preserved correctly

The validation logic and error handling have been maintained while simplifying the save operation to work with the new single-condition onChange callback. The logic correctly handles empty conditions and validation errors.

Comment on lines 6681 to 6686
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer"
"apiKey": {
"type": "apiKey",
"in": "header",
"name": "x-api-key"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Inconsistent security scheme update – existing endpoints still reference bearerAuth.

You replaced the sole entry in components.securitySchemes with the new apiKey definition, but several paths (e.g. /v1/relationship/resource-to-resource, lines 2508-2512) still declare:

"security": [{ "bearerAuth": [] }]

Removing the bearerAuth component makes the spec invalid; tools like swagger-ui and generators will fail to resolve the scheme.

Quick fix – keep both schemes until all paths are migrated:

       "securitySchemes": {
+        "bearerAuth": {
+          "type": "http",
+          "scheme": "bearer",
+          "bearerFormat": "JWT"
+        },
         "apiKey": {
           "type": "apiKey",
           "in": "header",
           "name": "x-api-key"
         }
       }

Then follow-up PRs can systematically swap each path’s security array to "apiKey" (or drop it if the endpoint is now public) and finally delete bearerAuth.

Run a grep to see remaining references:


🏁 Script executed:

#!/bin/bash
rg -n '"bearerAuth"' openapi.v1.json

Length of output: 72


Re-add bearerAuth to components.securitySchemes before migrating endpoints

To keep the spec valid and ensure tools like Swagger UI or generators don’t break, restore the bearerAuth entry alongside your new apiKey scheme and then update each path’s security in follow-up PRs.

• Locations to update:

  • openapi.v1.json around lines 6681–6686 (the securitySchemes block)
  • openapi.v1.json, line 2510 (existing reference to "bearerAuth": [])

Suggested diff:

   "components": {
     "securitySchemes": {
+      "bearerAuth": {
+        "type": "http",
+        "scheme": "bearer",
+        "bearerFormat": "JWT"
+      },
       "apiKey": {
         "type": "apiKey",
         "in": "header",
         "name": "x-api-key"
       }
     }
   }

After restoring both schemes, you can systematically:

  1. Swap each path’s "security" array to use "apiKey" (or remove it if now public).
  2. Remove the bearerAuth definition once no endpoints reference it.
📝 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
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer"
"apiKey": {
"type": "apiKey",
"in": "header",
"name": "x-api-key"
}
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
},
"apiKey": {
"type": "apiKey",
"in": "header",
"name": "x-api-key"
}
}
}
🤖 Prompt for AI Agents
In openapi.v1.json around lines 6681 to 6686, re-add the bearerAuth entry to the
components.securitySchemes alongside the existing apiKey scheme to maintain spec
validity and compatibility with tools. Also, verify and keep the existing
reference to "bearerAuth": [] at line 2510 intact. After restoring both schemes,
plan to update each endpoint's security array in subsequent PRs to use apiKey or
remove security if public, and finally remove bearerAuth from securitySchemes
once no endpoints reference it.

@adityachoudhari26 adityachoudhari26 merged commit 9de1290 into main Jul 1, 2025
4 of 10 checks passed
@adityachoudhari26 adityachoudhari26 deleted the deprecate-version-channels branch July 1, 2025 02:15
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