feat: [AAP-64171] Backport project sync feature branch to main#1482
Open
hsong-rh wants to merge 4 commits intoansible:mainfrom
Open
feat: [AAP-64171] Backport project sync feature branch to main#1482hsong-rh wants to merge 4 commits intoansible:mainfrom
hsong-rh wants to merge 4 commits intoansible:mainfrom
Conversation
…ible#1471) https://issues.redhat.com/browse/AAP-64075 https://issues.redhat.com/browse/AAP-64076 - Add project auto-sync configuration fields (`update_revision_on_launch`, `scm_update_cache_timeout`, `last_synced_at`) with `needs_update_on_launch` property and grace period protection against infinite restart loops - Enhance project sync task management to add comprehensive exception handling with `_get_project_safely()`, `_handle_project_error_recovery()`, and enhanced monitoring for stuck projects - Replace broad exception catching with specific `ObjectDoesNotExist` and `DatabaseError` handling
…e#1473) https://issues.redhat.com/browse/AAP-64077 Replace the proposed ActivationSyncDependency table with a simple `awaiting_project_sync` boolean flag on the Activation model. Add SHA256 hash fields for efficient rulebook content change detection. - **Boolean flag**: awaiting_project_sync on Activation replaces the dependency table - **SHA256 hashing**: rulesets_sha256 on Rulebook, rulebook_rulesets_sha256 on Activation - **Sync-before-launch**: Enable/restart checks needs_project_update_on_launch, sets flag, triggers sync, returns 202 - **Auto-restart**: After sync, activations with restart_on_project_update=True and changed content are restarted - **Error handling**: sync_project() failure resets flag; sync failure sets waiting activations to ERROR - **Safety nets**: disable()/destroy() clear the flag; monitor recovers orphaned flags - **No double-restart**: Auto-restart query excludes awaiting_project_sync=True activations - **Migration 0069**: Adds all new fields + RunPython to backfill SHA256 hashes - [x] Enable returns 202 when project needs sync - [x] Enable skips sync_project when project already syncing - [x] Enable proceeds normally (204) when no sync needed - [x] Restart returns 202 when project needs sync - [x] sync_project() failure resets flag and returns error - [x] Disable clears awaiting_project_sync flag - [x] Destroy clears awaiting_project_sync flag - [x] Auto-restart triggers on content change (SHA256 mismatch) - [x] Auto-restart skips unchanged content - [x] Auto-restart skips awaiting-sync activations (no double restart) - [x] Hash-only change updates metadata without restart - [x] Resume enables disabled waiting activations - [x] Resume restarts enabled waiting activations - [x] Resume handles multiple activations per project - [x] Resume failure sets activation to ERROR - [x] Sync failure sets ERROR on waiting activations - [x] Sync failure ignores non-waiting activations - [x] Deleted project cleans up waiting activations - [x] Monitor recovers orphaned awaiting activations (completed project) - [x] Monitor recovers orphaned awaiting activations (failed project) - [x] Monitor skips actively syncing projects - [x] Migration populates SHA256 for existing rulebooks - [x] Migration populates SHA256 for existing activations - [x] Migration handles empty rulesets
…gs (ansible#1480) https://issues.redhat.com/browse/AAP-65811 Skip auto-restart for activations with source_mappings when rulebook content changes during project sync, freezing their cached content so the stale state is preserved for warning detection. Add a computed `warnings` list field to the activation detail API endpoint that surfaces when the activation's rulebook SHA256 differs from the current upstream rulebook, or when the linked rulebook has been deleted. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace check_project_queue_health with check_default_worker_health (renamed on main) - Add check_dispatcherd_workers_health mocks to sync dependency tests (new health check added on main) - Remove stale check_project_queue_health import from test_projects.py Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #1482 +/- ##
==========================================
+ Coverage 91.44% 91.74% +0.30%
==========================================
Files 235 237 +2
Lines 10135 10444 +309
==========================================
+ Hits 9268 9582 +314
+ Misses 867 862 -5
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Contributor
Author
|
/run-e2e |
Contributor
Author
|
The e2e test is passed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



https://issues.redhat.com/browse/AAP-64171
Summary
Backport the project-sync feature branch into main. This PR includes three features and a rebase conflict resolution commit:
update_revision_on_launchandscm_update_cache_timeoutfields to the Project model, enabling automatic project synchronization before activation launch (migration 0068)awaiting_project_syncflag. When a project sync changes rulebook content, enabled activations withrestart_on_project_update=Trueare automatically restarted (migration 0069)source_mappingsand surfaces a computedwarningsfield on the activation detail API when rulebook content has driftedcheck_project_queue_health→check_default_worker_health) and addscheck_dispatcherd_workers_healthmocks to sync dependency testsTest plan
test_projects.py,test_activation.py,test_project.py🤖 Generated with Claude Code