-
Notifications
You must be signed in to change notification settings - Fork 665
Implement Action Completion Reporting System #4490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Action Completion Reporting System #4490
Conversation
87907a3 to
b48c727
Compare
296588a to
d095309
Compare
d095309 to
bfd06af
Compare
9d89306 to
d56f5b3
Compare
cb9db36 to
af0210d
Compare
4285f53 to
23e606e
Compare
f6af630 to
7df42ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a comprehensive action completion reporting system that provides structured, hierarchical feedback about command execution status. The system introduces data structures to track completion states from individual actions up to complete scenario results, enabling clear user feedback and establishing a foundation for future reporting enhancements.
- Introduces hierarchical data structures (
CompletionStateInfo,ActionResult,ScenarioResults,ScenariosResults) for tracking execution states - Integrates completion state reporting across provisioners, verifiers, and command execution flow
- Updates logging system to provide real-time feedback with structured scenario and step context
Reviewed Changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/molecule/reporting.py |
New core reporting system with dataclasses and result aggregation logic |
src/molecule/constants.py |
Centralized ANSI codes using StrEnum and dynamic markup mapping |
src/molecule/logger.py |
Enhanced section_logger decorator with completion state integration |
src/molecule/provisioner/ansible_playbook.py |
Integration of completion state reporting for playbook execution |
src/molecule/verifier/ansible.py |
Added completion state tracking for verify operations |
src/molecule/command/base.py |
Updated command execution to work with new reporting hierarchy |
tests/unit/test_reporting.py |
Comprehensive test coverage for the new reporting system |
tests/unit/test_constants.py |
Test coverage for ANSI codes and markup validation |
tests/integration/test_command.py |
Updated integration tests to validate user-facing output formatting |
Comments suppressed due to low confidence (1)
tests/unit/test_ansi_output.py:64
- The function name 'test_process_markup' is ambiguous as it doesn't indicate what aspect of markup processing is being tested. Consider renaming to 'test_process_markup_disabled' to match the docstring.
def test_process_markup(monkeypatch: pytest.MonkeyPatch) -> None:
ssbarnea
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need few minor tunning related to colours but we will do them based on feelback.
Implement Action Completion Reporting System
DEMO
Overview
This PR introduces a structured action completion reporting system that provides users with clear, consistent feedback about command execution status while maintaining semantic clarity in the codebase. The implementation focuses on improving user experience through better visual feedback and establishing a solid foundation for future reporting enhancements.
Core Data Structure Hierarchy
The new reporting system introduces a hierarchical data structure:
Result Capture Flow
The reporting system follows a clear capture pattern where results flow from individual actions up to the final scenarios collection:
1. Scenario Initialization
When a scenario starts, a
ScenarioResultscontainer is initialized:2. Action Container Creation
Before each action executes, an
ActionResultcontainer is created:3. Completion State Capture
Individual playbooks and operations report their completion states:
4. Scenario Collection
After scenario completion, the
ScenarioResultsis appended to the global collection:5. Summary Generation
The
ActionResult.summaryproperty intelligently aggregates multiple completion states:6. Real-time Log Messages
The
section_loggerdecorator uses completion states for immediate user feedback:7. Final Report Generation
At execution end, the complete results generate a user-facing summary:
File Changes by Category
Core Reporting Infrastructure
src/molecule/reporting.py(NEW): Complete reporting system implementation with dataclasses forCompletionStateInfo,ActionResult,ScenarioResults, andScenariosResults. Includes the mainreport()function for generating user-facing summaries.Constants and ANSI Management
src/molecule/constants.py: Refactored to centralize ANSI codes usingStrEnum, introducedCompletionStateclass with predefined completion states as class attributes, and implemented dynamicMARKUP_MAPwith__missing__method for robust key lookups.Logger Integration
src/molecule/logger.py: Enhancedsection_loggerdecorator to integrate with the new completion state system, adding structured logging withmolecule_scenarioandmolecule_stepextras for better traceability.Command Execution Integration
src/molecule/provisioner/ansible_playbook.py: Updated to report completion states (missing,failed,successful) through the new result tracking system.src/molecule/verifier/ansible.py: Integrated completion state reporting for verify operations, handling both disabled and missing playbook scenarios.src/molecule/command/base.py: Enhanced base command execution to work with the new reporting hierarchy.Test Coverage and Quality
tests/unit/test_constants.py(NEW): Comprehensive test coverage for ANSI codes, markup mapping, and constant validation with proper handling ofStrEnumcomparison quirks.tests/unit/test_reporting.py(NEW): Full test suite for the reporting system using pytest-only approach with monkeypatch for mocking.tests/integration/test_command.py: Updated integration tests to validate actual user-facing output formatting, including proper spacing and completion message validation.caplog.textassertions withcaplog.recordsinspection for better reliability.User Experience Enhancements
The new system provides:
Breaking Changes
None. The changes are fully backward compatible and maintain existing CLI behavior while enhancing the underlying reporting infrastructure.
This implementation establishes a solid foundation for future reporting enhancements while immediately improving user experience through clearer, more consistent feedback during command execution.