Skip to content

Conversation

raghavyuva
Copy link
Owner

@raghavyuva raghavyuva commented Sep 2, 2025

Summary by CodeRabbit

  • New Features
    • Introduced application labels: view existing labels and add/edit them directly on application pages and cards.
  • API
    • Added an endpoint to update application labels.
  • Chores
    • Updated backend dependencies and Go tooling versions.
    • Adjusted API version metadata (release date).
  • Migrations
    • Database updated to store labels and indexed for efficient querying.

Copy link
Contributor

coderabbitai bot commented Sep 2, 2025

Walkthrough

Introduces application labels across backend and frontend: database migration adds a labels column and index; API gains a PUT endpoint to update labels; service/storage implement update; types extended. Frontend displays and edits labels via new component and Redux mutation. Also updates api version timestamp and adjusts Go module dependencies.

Changes

Cohort / File(s) Change Summary
API version metadata
api/api/versions.json
Updated v1 release_date timestamp only; no other fields changed.
Go module/deps
api/go.mod
Downgraded Go to 1.24.4 and adjusted multiple direct/indirect dependencies (testify, golang.org/x modules, Prometheus libs, quic-go, etc.); added new indirects (pprof, ginkgo/v2, libdns); several version downgrades.
Backend: labels endpoint (controller/service/storage/routes/types)
api/internal/features/deploy/controller/application_labels.go, api/internal/features/deploy/service/application_labels.go, api/internal/features/deploy/storage/init.go, api/internal/routes.go, api/internal/types/application.go
Added UpdateApplicationLabels HTTP handler, service method, repository/storage method updating labels array, route registration (PUT /labels), and Application struct gains Labels []string.
DB migrations
api/migrations/applications/034_add_labels_to_applications_up.sql, api/migrations/applications/034_add_labels_to_applications_down.sql
Added labels TEXT[] column with default and GIN index; down migration drops column and index (IF EXISTS).
Frontend UI: application labels
view/app/self-host/application/[id]/page.tsx, view/app/self-host/components/application-details/header.tsx, view/app/self-host/components/application-details/labels.tsx, view/app/self-host/components/application.tsx
New Labels component for viewing/editing; integrated into application page and listing; header shows badges for existing labels.
Frontend Redux API/types
view/redux/api-conf.ts, view/redux/services/deploy/applicationsApi.ts, view/redux/types/applications.ts
Added DEPLOY.UPDATE_APPLICATION_LABELS path; new RTK Query mutation updateApplicationLabels (PUT with id, labels) and exported hook; Application type gains optional labels.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant UI as Frontend UI (Labels)
    participant RTK as Redux RTK Query
    participant API as API Router
    participant C as DeployController
    participant S as DeployService
    participant ST as DeployStorage
    participant DB as PostgreSQL

    U->>UI: Add/Edit label
    UI->>RTK: invoke updateApplicationLabels({id, labels})
    RTK->>API: PUT /v1/deploy/application/labels?id={id}\nBody: { labels }
    API->>C: route to UpdateApplicationLabels
    C->>C: validate body, id, auth/org
    C->>S: UpdateApplicationLabels(appID, labels, orgID)
    S->>ST: UpdateApplicationLabels(appID, labels, orgID)
    ST->>DB: UPDATE applications SET labels = ARRAY[...], updated_at=now()\nWHERE id=? AND organization_id=?
    DB-->>ST: ok
    ST-->>S: ok
    S-->>C: ok
    C-->>RTK: 200 { status:"success", data: labels }
    RTK-->>UI: labels array
    UI-->>U: Render updated labels
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

I nibble notes on labels new,
A carrot-colored tag or two. 🥕
From schema fields to badges bright,
I hop through routes that set it right.
With PUTs and purrs of SQL lore,
Our apps wear names they love to store.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/project_labels

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 29120c3 and 7230676.

⛔ Files ignored due to path filters (1)
  • api/go.sum is excluded by !**/*.sum
📒 Files selected for processing (16)
  • api/api/versions.json (1 hunks)
  • api/go.mod (9 hunks)
  • api/internal/features/deploy/controller/application_labels.go (1 hunks)
  • api/internal/features/deploy/service/application_labels.go (1 hunks)
  • api/internal/features/deploy/storage/init.go (3 hunks)
  • api/internal/routes.go (1 hunks)
  • api/internal/types/application.go (1 hunks)
  • api/migrations/applications/034_add_labels_to_applications_down.sql (1 hunks)
  • api/migrations/applications/034_add_labels_to_applications_up.sql (1 hunks)
  • view/app/self-host/application/[id]/page.tsx (3 hunks)
  • view/app/self-host/components/application-details/header.tsx (2 hunks)
  • view/app/self-host/components/application-details/labels.tsx (1 hunks)
  • view/app/self-host/components/application.tsx (5 hunks)
  • view/redux/api-conf.ts (1 hunks)
  • view/redux/services/deploy/applicationsApi.ts (2 hunks)
  • view/redux/types/applications.ts (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

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

@raghavyuva raghavyuva changed the title Feat/project labels feat: add labels to projects Sep 2, 2025
Copy link
Collaborator

@zhravan zhravan left a comment

Choose a reason for hiding this comment

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

Overall LGTM, minor suggestions

fuego.Get(f, "/logs/{application_id}", deployController.GetLogs)
fuego.Get(f, "/deployments/{deployment_id}/logs", deployController.GetDeploymentLogs)
fuego.Get(f, "/deployments", deployController.GetApplicationDeployments)
fuego.Put(f, "/labels", deployController.UpdateApplicationLabels)
Copy link
Collaborator

Choose a reason for hiding this comment

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

ideally better to keep it as /application/{appID}/labels right?
query string would make sense if it was optional value, but in our case this is mandatory

)

func (s *DeployService) UpdateApplicationLabels(applicationID uuid.UUID, labels []string, organizationID uuid.UUID) error {
return s.storage.UpdateApplicationLabels(applicationID, labels, organizationID)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we remove duplicate strings just incase if its there in labels array? Like sanity before storing in db? In FE, should we keep max character limit otherwise might be able to add a big string, looking odd in the UI?

setNewLabel('');
return;
}
const updated = [...localLabels, value];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const updated = [...localLabels, value];
const updated = [...new Set([...localLabels, value])];

removes duplication

type UpdateOptions struct {
Force bool
ForceWithoutCache bool
} No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
}
}


generatePorts := "seq 49152 65535"

getUsedPorts := "command -v ss >/dev/null 2>&1 && ss -tan | awk '{print $4}' | cut -d':' -f2 | grep '[0-9]\\{1,5\\}' | sort -u || netstat -tan | awk '{print $4}' | grep ':[0-9]' | cut -d':' -f2 | sort -u"
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we move this to utils?

@raghavyuva raghavyuva self-assigned this Sep 9, 2025
@zhravan zhravan deleted the branch master September 10, 2025 18:02
@zhravan zhravan closed this Sep 10, 2025
@raghavyuva raghavyuva reopened this Sep 14, 2025
@raghavyuva raghavyuva changed the base branch from feat/develop to master September 14, 2025 16:36
@raghavyuva raghavyuva changed the base branch from master to feat/develop September 14, 2025 16:36
@raghavyuva
Copy link
Owner Author

reopened accidental closure of this PR, @zhravan for your notice

@zhravan zhravan deleted the branch master September 16, 2025 20:37
@zhravan zhravan closed this Sep 16, 2025
@zhravan zhravan reopened this Sep 16, 2025
Base automatically changed from feat/develop to master September 19, 2025 16:19
@raghavyuva
Copy link
Owner Author

@coderabbitai summary

Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

✅ Actions performed

Summary regeneration triggered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants