Skip to content

fix: keep sync hooks running on a forced sync - #275

Open
darksworm wants to merge 1 commit into
mainfrom
fix/force-sync-keeps-hooks
Open

fix: keep sync hooks running on a forced sync#275
darksworm wants to merge 1 commit into
mainfrom
fix/force-sync-keeps-hooks

Conversation

@darksworm

@darksworm darksworm commented Aug 18, 2026

Copy link
Copy Markdown
Owner

A forced sync sent strategy.apply, which is apply-only — the app's PreSync/PostSync/SyncFail hooks were silently skipped.

Upstream types.go: Hook is the default strategy; Apply means kubectl apply without hooks. The Web UI keeps the two independent (application-sync-panel.tsx): ApplyOnly picks the strategy, Force is a flag on whichever one is chosen.

Force now rides on strategy.hook. Apply-only is not exposed in argonaut, so nothing selects strategy.apply any more.

Summary by CodeRabbit

  • Bug Fixes

    • Forced application synchronizations now continue to run configured sync hooks while retaining forced execution behavior.
    • Standard synchronizations remain unchanged and do not send unnecessary strategy settings.
  • Tests

    • Added coverage verifying hook execution for forced synchronizations and request behavior for standard synchronizations.

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9149ea83-e32d-4e44-a566-2eedae1c04ff

📥 Commits

Reviewing files that changed from the base of the PR and between 61bc1c2 and 0fd8cb9.

📒 Files selected for processing (2)
  • pkg/api/applications.go
  • pkg/api/applications_sync_test.go

Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review.


Walkthrough

SyncApplication now sends forced sync requests with Argo CD’s hook strategy and force: true. Tests inspect request bodies for forced and non-forced syncs.

Changes

Application sync strategy

Layer / File(s) Summary
Forced sync hook strategy
pkg/api/applications.go, pkg/api/applications_sync_test.go
Forced syncs now send strategy.hook.force=true instead of strategy.apply. Tests verify the forced strategy and confirm that non-forced syncs send no strategy.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 0fd8c

This localized change restores hooks for forced syncs while preserving apply-only behavior, with no actionable merge-blocking risk remaining after normal checks and review.

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving sync hooks during forced synchronization.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Tests ✅ Passed The PR adds HTTP-level tests that inspect the serialized sync request: forced syncs require strategy.hook.force=true and reject strategy.apply; non-forced syncs require no strategy.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/force-sync-keeps-hooks

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.

@darksworm
darksworm marked this pull request as ready for review August 18, 2026 20:29
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.

1 participant