Skip to content

fix(engine): correctly set prune confirmation message in setRunningPhase#25915

Merged
agaudreault merged 1 commit intoargoproj:masterfrom
MrFreezeex:fix-empty-task-message
Feb 17, 2026
Merged

fix(engine): correctly set prune confirmation message in setRunningPhase#25915
agaudreault merged 1 commit intoargoproj:masterfrom
MrFreezeex:fix-empty-task-message

Conversation

@MrFreezeex
Copy link
Copy Markdown
Contributor

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Title of the PR
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

Restore the behavior before commit 95d19f2 to not force the message to an empty string if the tasks slice is empty. This broke the Prune=confirm features that set a message but get overwritten here. Also add a Prune=confirm unit test to prevent further regression.

@MrFreezeex MrFreezeex requested a review from a team as a code owner January 9, 2026 18:07
@bunnyshell
Copy link
Copy Markdown

bunnyshell bot commented Jan 9, 2026

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

@MrFreezeex
Copy link
Copy Markdown
Contributor Author

Hi again @agaudreault 👋, while investigating why #23370 unit test was not working I discovered this regression in master linked to an improvement you made a few weeks ago in this PR: #25668

rumstead
rumstead previously approved these changes Jan 12, 2026
Copy link
Copy Markdown
Member

@rumstead rumstead left a comment

Choose a reason for hiding this comment

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

LGTM


func (sc *syncContext) setRunningPhase(tasks syncTasks, isPendingDeletion bool) {
if tasks.Len() == 0 {
sc.setOperationPhase(common.OperationRunning, "")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Running should not preserve the last message. Instead, it should by able based on the list of task to determine the message that the sync is waiting for applications to be pruned. In this case, it might not receive the correct list of task if it is empty.

Copy link
Copy Markdown
Member

@agaudreault agaudreault Jan 12, 2026

Choose a reason for hiding this comment

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

You should investigate what sets the message to "Waiting for pruning confirmation" and move the logic to setRunningPhase. You will also need to investigate what calls setRunningPhase with an empty list of task.

IMO, not setting the operation to Running in the setRunningPhase is incorrect. There is a unit test missing that should validate that setRunningPhase sets the phase to running if tasks is empty.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah ok I see, is something my last push what you would be looking for then?

@MrFreezeex MrFreezeex force-pushed the fix-empty-task-message branch 2 times, most recently from d805a32 to 7ef43a9 Compare January 12, 2026 20:34
@MrFreezeex MrFreezeex changed the title fix(engine): preserve message in setRunningPhase when task list is empty fix(engine): correctly set prune confirmation message in setRunningPhase Jan 12, 2026
@rumstead rumstead dismissed their stale review January 12, 2026 20:46

dismiss

@MrFreezeex MrFreezeex force-pushed the fix-empty-task-message branch from 7ef43a9 to 8a174c5 Compare February 11, 2026 11:46
@MrFreezeex
Copy link
Copy Markdown
Contributor Author

Hi @agaudreault 👋, small reminder of this in case it dropped out of your radar, FYI the test added in this PR still fails on the master branch (so there's still a regression there essentially).

@agaudreault agaudreault self-assigned this Feb 12, 2026
return
}

{
Copy link
Copy Markdown
Member

@agaudreault agaudreault Feb 12, 2026

Choose a reason for hiding this comment

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

Code looks to be at the right place, but can you reuse the implementation below and set the reason to "pruning confirmation" instead of having a completely new code block? This way, we make sure the message pattern and overall logic is the same.

So in the end, it is something like "Waiting for pruning confirmation of foo/bar and X more" where X is the total number (-1) of resources to prune.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@agaudreault Oh yes good idea! I just implemented your suggestion let me know if this looks right!

@MrFreezeex MrFreezeex force-pushed the fix-empty-task-message branch from 8a174c5 to 44c3271 Compare February 13, 2026 16:59
setRunningPhase was overwriting the message when it receives an empty
list of tasks while we were setting the message before setRunningPhase
was called which broke the prune confirmation message since commit
95d19f2.

This moves the message logic in setRunningPhase with the rest of the message
logic and remove the tasks filtering when the sync is pending to allow
retrieving the pruning tasks and construct the message indicating to
wait for pruning confirmation.

Also add a unit test covering this recently broken behavior

Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@ledger.fr>
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.69%. Comparing base (e8539be) to head (cd11dea).
⚠️ Report is 34 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #25915      +/-   ##
==========================================
+ Coverage   62.65%   62.69%   +0.04%     
==========================================
  Files         412      412              
  Lines       55562    55566       +4     
==========================================
+ Hits        34814    34839      +25     
+ Misses      17426    17411      -15     
+ Partials     3322     3316       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown
Member

@agaudreault agaudreault left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the refactor :)

@agaudreault agaudreault merged commit a1d68ca into argoproj:master Feb 17, 2026
27 checks passed
devopsjedi pushed a commit to devopsjedi/argo-cd that referenced this pull request Mar 7, 2026
…ase (argoproj#25915)

Signed-off-by: Arthur Outhenin-Chalandre <arthur.outhenin-chalandre@ledger.fr>
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.

3 participants