Skip to content
Merged
Changes from all commits
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
6 changes: 6 additions & 0 deletions work/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,12 @@ const (
// WorkManifestsComplete represents that all completable manifests in the work
// have the Complete condition
WorkManifestsComplete string = "ManifestsComplete"
// WorkProgressingReasonApplying indicates resources are being applied
WorkProgressingReasonApplying string = "Applying"
// WorkProgressingReasonCompleted indicates all resources are applied and available
WorkProgressingReasonCompleted string = "Completed"
// WorkProgressingReasonFailed indicates the work failed to apply
WorkProgressingReasonFailed string = "Failed"
Comment on lines +520 to +525
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Well-documented constants with clear semantic intent.

The three new progressing reason constants are well-named and clearly documented. The string values ("Applying", "Completed", "Failed") provide good semantic clarity for tracking work progression states.

However, verify the following:

  1. Ensure these constants are used in the codebase to avoid introducing dead code.
  2. Clarify the distinction between WorkProgressingReasonCompleted (line 523) and WorkComplete (line 509). While one is a reason value and the other is a condition type, the similar naming could cause confusion for API consumers.

Run the following script to verify usage of these new constants:


🏁 Script executed:

#!/bin/bash
# Description: Verify that the new progressing reason constants are used in the codebase

echo "Searching for WorkProgressingReasonApplying usage:"
rg -n "WorkProgressingReasonApplying" --type go

echo -e "\nSearching for WorkProgressingReasonCompleted usage:"
rg -n "WorkProgressingReasonCompleted" --type go

echo -e "\nSearching for WorkProgressingReasonFailed usage:"
rg -n "WorkProgressingReasonFailed" --type go

echo -e "\nSearching for raw string literals that might be using these reasons:"
rg -n '"(Applying|Completed|Failed)"' --type go -g '!**/types.go' -C 3

Length of output: 2377


Implement or remove unused progressing reasons
WorkProgressingReasonApplying, WorkProgressingReasonCompleted, and WorkProgressingReasonFailed (work/v1/types.go:520–525) have no references outside their own definitions. Wire them into the work status transitions where appropriate or remove to avoid dead code.

🤖 Prompt for AI Agents
In work/v1/types.go around lines 520–525, the three WorkProgressingReason*
constants are defined but unused; either remove them or wire them into the work
status transition logic. To fix: search the reconciler(s) and status update code
that set Work.Status/conditions for progressing/completed/failed and replace
hard-coded reason strings (or add missing reason values) to use these constants,
update any helper functions that construct Condition objects to reference
WorkProgressingReasonApplying, WorkProgressingReasonCompleted, and
WorkProgressingReasonFailed, and add/adjust unit tests to assert the correct
reason is set; alternatively, if these reasons are not needed, delete the unused
constants and any related dead code/comments. Ensure imports/compile and tests
pass after the change.

)

// ManifestCondition represents the conditions of the resources deployed on a
Expand Down