Skip to content

Conversation

chetan-rns
Copy link
Collaborator

What does this PR do / why we need it:

This PR extends #400

All updates to the AppProject and the Repository must come from the source, i.e, the principal in managed mode and the agent in autonomous mode. Any changes made by the user on the non-source cluster must be reverted to keep the resources in sync with the source cluster. In this PR:

  • Use a generic cache to store spec to avoid code repetition.
  • Revert the invalid updates and deletions in the respective callbacks
  • We also use the same cache to differentiate between user-initiated deletion and the valid deletions coming from the source.
  • Include unit tests and e2e tests

Which issue(s) this PR fixes:

Fixes #546

How to test changes / Special notes to the reviewer:

  1. Update/Delete the AppProject on a non-source cluster.
  2. It must be reverted to be in sync with the source
  3. Update/Delete the Repository on the agent and observe the agent reverting the changes.

Checklist

  • Documentation update is required by this PR (and has been updated) OR no documentation update is required.

@codecov-commenter
Copy link

codecov-commenter commented Oct 7, 2025

Codecov Report

❌ Patch coverage is 43.36043% with 209 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.50%. Comparing base (d314838) to head (0f1b8e1).

Files with missing lines Patch % Lines
agent/agent.go 10.25% 35 Missing ⚠️
internal/manager/repository/repository.go 0.00% 31 Missing ⚠️
internal/manager/appproject/appproject.go 0.00% 29 Missing ⚠️
agent/outbound.go 16.66% 19 Missing and 6 partials ⚠️
principal/server.go 54.16% 16 Missing and 6 partials ⚠️
internal/cache/resource_cache.go 67.30% 17 Missing ⚠️
agent/inbound.go 73.33% 9 Missing and 3 partials ⚠️
internal/manager/application/application.go 15.38% 11 Missing ⚠️
principal/callbacks.go 16.66% 10 Missing ⚠️
principal/event.go 52.63% 9 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #596      +/-   ##
==========================================
- Coverage   45.86%   45.50%   -0.36%     
==========================================
  Files          90       90              
  Lines       12066    12314     +248     
==========================================
+ Hits         5534     5604      +70     
- Misses       6085     6251     +166     
- Partials      447      459      +12     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chetan-rns chetan-rns force-pushed the revert-appproject-changes branch 2 times, most recently from 0059af7 to 00feb32 Compare October 10, 2025 10:58
Signed-off-by: Chetan Banavikalmutt <[email protected]>
Assisted-by: Cursor
Signed-off-by: Chetan Banavikalmutt <[email protected]>
Signed-off-by: Chetan Banavikalmutt <[email protected]>
Assisted-by: Cursor
Signed-off-by: Chetan Banavikalmutt <[email protected]>
@chetan-rns chetan-rns force-pushed the revert-appproject-changes branch from 00feb32 to 7a1fbcf Compare October 10, 2025 13:16
Signed-off-by: Chetan Banavikalmutt <[email protected]>
@chetan-rns chetan-rns force-pushed the revert-appproject-changes branch from 7a1fbcf to 0f1b8e1 Compare October 10, 2025 14:07
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.

Direct updates on AppProject and Repository must be reverted by the agent

2 participants