mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-04 07:08:31 +00:00
This comprehensive implementation replaces scattered status update logic across command runners with a centralized StatusManager architecture that provides policy-driven decisions about when to set, clear, or silence VCS status checks. ## Key Features ### 🏗️ Architecture - **StatusManager**: Central orchestrator for all VCS status decisions - **StatusPolicy**: Encapsulates silence flag logic and fork PR detection - **Clean Interface**: Command runners use semantic methods instead of direct status calls ### 🔧 Command Runner Integration - **ApplyCommandRunner**: Now uses StatusManager.HandleNoProjectsFound(), SetFailure(), SetSuccess() - **PolicyCheckCommandRunner**: Integrated with StatusManager for all status decisions - **ApprovePoliciesCommandRunner**: Added StatusManager integration - **DefaultCommandRunner**: Enhanced with StatusManager.HandleCommandStart() - **PlanCommandRunner**: Already properly integrated ### 🎯 Silence Flag Handling - **Complete Coverage**: All silence flags now work consistently across command types - **Fork PR Detection**: Uses ctx.HeadRepo.Owner != ctx.Pull.BaseRepo.Owner - **No Status When Silenced**: When silence flags are enabled, NO VCS status is set (not even success 0/0) - **Backward Compatible**: No new flags needed, existing configuration works seamlessly ### 🔍 Issues Resolved - ✅ **PR #5713**: VCS status no longer gets stuck in pending state when silence flags are enabled - ✅ **Consistency**: All command types now respect silence flags uniformly - ✅ **Fork PRs**: Proper handling of fork PR status updates with silence support - ✅ **Maintainability**: Single source of truth eliminates duplicate status logic ## Implementation Details ### Status Decision Flow 1. Command event occurs (start/end/no projects) 2. StatusManager delegates to StatusPolicy 3. Policy evaluates silence flags and fork PR status 4. Returns StatusDecision (Set/Clear/Silence) 5. StatusManager executes decision or skips VCS interaction ### Silence Flag Combinations - `SilenceNoProjects`: Controls PR comments - `SilenceVCSStatusNoPlans`: Controls plan command status when no projects found - `SilenceVCSStatusNoProjects`: Controls all command status when no projects found - `SilenceForkPRErrors`: Controls all status updates for fork PRs ### Files Modified - `server/events/apply_command_runner.go`: StatusManager integration - `server/events/policy_check_command_runner.go`: StatusManager integration - `server/events/approve_policies_command_runner.go`: StatusManager integration - `server/server.go`: StatusManager construction and injection - `server/events/command_runner_test.go`: Updated test expectations - `server/events/plan_command_runner_test.go`: Fixed silence behavior tests - `server/events/mocks/mock_status_manager.go`: Manual mock for testing - `docs/status-manager.md`: Comprehensive architecture documentation ## Testing - ✅ All StatusManager unit tests pass - ✅ Updated command runner tests to match new behavior - ✅ Verified silence flags work correctly (no status when enabled) - ✅ Fork PR detection working properly - ✅ Backward compatibility maintained ## Documentation - **Architecture Guide**: Complete StatusManager documentation with diagrams - **Configuration Reference**: All silence flag combinations explained - **Migration Guide**: How status logic changed from scattered to centralized - **Troubleshooting**: Common issues and debugging techniques - **API Reference**: Full interface documentation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>