Skip to content

feat: auto delete dependency detection#549

Merged
ilya-lesikov merged 11 commits intomainfrom
feat/auto-delete-dependency
Feb 6, 2026
Merged

feat: auto delete dependency detection#549
ilya-lesikov merged 11 commits intomainfrom
feat/auto-delete-dependency

Conversation

@dmmordvi
Copy link
Contributor

@dmmordvi dmmordvi commented Jan 27, 2026

Summary by Bito

This PR introduces automatic dependency detection for resource deletion in the nelm deployment system, enabling the system to automatically identify and manage internal dependencies for various Kubernetes resource types during deletion operations. The changes refactor the core dependency logic by removing hardcoded conditional parsing in service account dependency detection, improving modularity and allowing the system to handle dependencies more effectively without manual assignments. This enhances the deployment tool's reliability in managing complex Kubernetes resource lifecycles by automating what was previously explicit and simplifying plan building operations.

Detailed Changes
  • Refactors parseServiceAccountDependencies in dependency.go to use a switch statement on GroupVersionKind().GroupKind() for determining nested paths to service account names, replacing hardcoded if-else conditions for different resource types like Pod, Deployment, DaemonSet, StatefulSet, ReplicaSet, ReplicationController, Job, and CronJob.
  • Modifies connectInternalDeployDependencies in plan_build.go to directly assign dependUponOps from findTrackAbsenceOpInStage and check length instead of using a found flag, adding a TODO comment for future multi-operation dependency handling in v2.
  • Simplifies connectInternalDeleteDependencies in plan_build.go by removing boolean variables and directly iterating over dependUponOps returned from findTrackAbsenceOpInStage to connect dependencies.
  • Changes findTrackAbsenceOpInStage in plan_build.go return type from ([]*Operation, bool) to []*Operation, updating logic to return nil on no matches or a single-operation slice, and removing redundant found checks.

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
Copy link

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #140492

Actionable Suggestions - 2
  • internal/resource/dependency.go - 2
    • Incomplete workload type handling in delete dependencies · Line 178-205
    • Incorrect CRD dependency namespaces · Line 692-695
Additional Suggestions - 1
  • internal/resource/dependency.go - 1
    • Variable shadowing in loop · Line 709-709
      The loop variable 'gk' shadows the function parameter 'gk', which can be confusing and error-prone. Consider renaming the loop variable for clarity.
      Code suggestion
       @@ -707,9 +707,9 @@
      -		itmGK := item.GroupVersionKind().GroupKind()
      -
      -		for _, gk := range gk {
      -			if itmGK == gk {
      -				return true
      -			}
      -		}
      -
      -		return false
      +		itmGK := item.GroupVersionKind().GroupKind()
      +
      +		for _, targetGK := range gk {
      +			if itmGK == targetGK {
      +				return true
      +			}
      +		}
      +
      +		return false
Review Details
  • Files reviewed - 4 · Commit Range: 5e184b7..e4cf977
    • internal/plan/plan_build.go
    • internal/resource/dependency.go
    • internal/resource/resource.go
    • internal/resource/resource_test.go
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Golangci-lint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at ilya.lesikov@flant.com.

Documentation & Help

AI Code Review powered by Bito Logo

@ilya-lesikov ilya-lesikov marked this pull request as ready for review February 2, 2026 17:02
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
Copy link

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #5d447f

Actionable Suggestions - 1
  • internal/resource/dependency.go - 1
    • Incorrect namespace matching for ClusterRoleBinding · Line 633-673
Review Details
  • Files reviewed - 4 · Commit Range: e4cf977..711fec2
    • internal/plan/plan_build.go
    • internal/resource/dependency.go
    • internal/resource/resource.go
    • internal/resource/resource_test.go
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Golangci-lint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at ilya.lesikov@flant.com.

Documentation & Help

AI Code Review powered by Bito Logo

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
@bito-code-review
Copy link

bito-code-review bot commented Feb 3, 2026

Code Review Agent Run #4f26ba

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: 711fec2..525ae9f
    • internal/plan/plan_build.go
    • internal/resource/dependency.go
    • internal/resource/resource.go
    • internal/resource/resource_test.go
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Golangci-lint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at ilya.lesikov@flant.com.

Documentation & Help

AI Code Review powered by Bito Logo

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>

# Conflicts:
#	internal/plan/plan_build.go
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
Copy link

@bito-code-review bito-code-review bot left a comment

Choose a reason for hiding this comment

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

Code Review Agent Run #405881

Actionable Suggestions - 1
  • internal/plan/plan_build.go - 1
Review Details
  • Files reviewed - 4 · Commit Range: 525ae9f..c85dd47
    • internal/plan/plan_build.go
    • internal/resource/dependency.go
    • internal/resource/resource.go
    • internal/resource/resource_test.go
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Golangci-lint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at ilya.lesikov@flant.com.

Documentation & Help

AI Code Review powered by Bito Logo

Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
@bito-code-review
Copy link

bito-code-review bot commented Feb 4, 2026

Code Review Agent Run #f5cbd2

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: c85dd47..e0783ee
    • internal/plan/plan_build.go
    • internal/resource/dependency.go
    • internal/resource/resource.go
    • internal/resource/resource_test.go
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Golangci-lint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at ilya.lesikov@flant.com.

Documentation & Help

AI Code Review powered by Bito Logo

@werf werf deleted a comment from bito-code-review bot Feb 5, 2026
@werf werf deleted a comment from bito-code-review bot Feb 5, 2026
Signed-off-by: Dmitry Mordvinov <dmitry.mordvinov@flant.com>
@dmmordvi dmmordvi requested a review from ilya-lesikov February 5, 2026 11:55
@bito-code-review
Copy link

bito-code-review bot commented Feb 5, 2026

Code Review Agent Run #5802f8

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: e0783ee..d02c404
    • internal/plan/plan_build.go
    • internal/resource/dependency.go
    • internal/resource/resource.go
    • internal/resource/resource_test.go
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Golangci-lint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at ilya.lesikov@flant.com.

Documentation & Help

AI Code Review powered by Bito Logo

@ilya-lesikov ilya-lesikov merged commit 22cd6a7 into main Feb 6, 2026
8 checks passed
@ilya-lesikov ilya-lesikov deleted the feat/auto-delete-dependency branch February 6, 2026 08:47
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