Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions backend/internal/services/project_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1006,6 +1006,13 @@ func (s *ProjectService) cleanupDBProjects(ctx context.Context, seen map[string]
continue
}

// Skip projects whose lifecycle is owned by the gitops system.
// Their compose files may not exist on disk yet (e.g. during a sync
// or after an SSH/clone failure) and should never be deleted here.
if p.GitOpsManagedBy != nil && *p.GitOpsManagedBy != "" {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Inconsistent whitespace guard vs. the parallel check

The existing check for the same field at line 397 uses strings.TrimSpace(*proj.GitOpsManagedBy) != "", but this new guard compares directly against "". Since GitOpsManagedBy values are always UUIDs in practice this will never differ, but for defensive consistency it's worth aligning the two.

Suggested change
if p.GitOpsManagedBy != nil && *p.GitOpsManagedBy != "" {
if p.GitOpsManagedBy != nil && strings.TrimSpace(*p.GitOpsManagedBy) != "" {
Prompt To Fix With AI
This is a comment left during a code review.
Path: backend/internal/services/project_service.go
Line: 1012

Comment:
**Inconsistent whitespace guard vs. the parallel check**

The existing check for the same field at line 397 uses `strings.TrimSpace(*proj.GitOpsManagedBy) != ""`, but this new guard compares directly against `""`. Since `GitOpsManagedBy` values are always UUIDs in practice this will never differ, but for defensive consistency it's worth aligning the two.

```suggestion
		if p.GitOpsManagedBy != nil && strings.TrimSpace(*p.GitOpsManagedBy) != "" {
```

How can I resolve this? If you propose a fix, please make it concise.

Fix in Codex

continue
}

validDir, err := projects.IsProjectDirectoryPath(p.Path, followProjectSymlinks)
if err != nil {
if os.IsNotExist(err) {
Expand Down
Loading