Skip to content

Add --progress option to report command for incremental status updates#343

Merged
kkaarreell merged 1 commit into
mainfrom
ks_report_progress
Apr 14, 2026
Merged

Add --progress option to report command for incremental status updates#343
kkaarreell merged 1 commit into
mainfrom
ks_report_progress

Conversation

@kkaarreell

@kkaarreell kkaarreell commented Apr 11, 2026

Copy link
Copy Markdown
Collaborator

This introduces a new --progress flag to the 'newa report' command that allows reporting current test execution status without finalizing results. This is useful for providing intermediate updates during long-running test executions.

When --progress is used:

  • Updates TF request statuses to get current execution state
  • Adds Jira comments with "test execution is in progress" message
  • Uses Testing Farm API URLs for requests not yet scheduled/finished
  • Skips ReportPortal launch finalization and description updates
  • Skips Jira issue state transitions
  • Skips Errata Tool and RoG comments

Changes:

  • Add --progress flag to report command (report_cmd.py)
  • Modify execute_jobs_summary to use API URLs when artifacts_url is unavailable
  • Update _build_jira_comment to support progress mode messaging
  • Update _process_jira_id_reports to conditionally skip finalization steps
  • Add documentation for --progress option to README.md

🤖 Generated with Claude Code

Summary by Sourcery

Add a progress-only reporting mode to the report command that allows intermediate status updates without finalizing external systems.

New Features:

  • Introduce a --progress flag to the report CLI command to report current test execution status without finalizing results.

Enhancements:

  • Use Testing Farm API URLs as a fallback when artifacts URLs are not yet available in execution summaries.
  • Adjust Jira comment generation and per-Jira reporting flow to support both progress-mode messaging and full finalization workflows.

Documentation:

  • Document the new --progress option for the report command, including behavior details and example usage in the README.

@kkaarreell kkaarreell self-assigned this Apr 11, 2026
@sourcery-ai

sourcery-ai Bot commented Apr 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implements a new --progress mode for the newa report command that lets users post in-progress Jira updates and view current Testing Farm status without finalizing ReportPortal launches or performing downstream transitions, plus minor URL handling improvements and documentation updates.

Sequence diagram for newa report command with --progress option

sequenceDiagram
    actor User
    participant CLI as NewaCLI
    participant ReportCmd as cmd_report
    participant Helpers as report_helpers

    User->>CLI: newa report --progress
    CLI->>ReportCmd: invoke cmd_report(ctx, progress=True)
    ReportCmd->>ReportCmd: ctx.enter_command("report")
    ReportCmd->>ReportCmd: load execute_jobs
    ReportCmd->>ReportCmd: group execute_jobs by jira_id

    loop for each jira_id
        ReportCmd->>Helpers: _process_jira_id_reports(ctx, jira_id, execute_jobs,
        Note over ReportCmd,Helpers: rp, jira_connection, et, rog,
        Note over ReportCmd,Helpers: jira_comment_limit, progress_mode=True

        activate Helpers
        Helpers->>Helpers: _get_rp_launch_details(execute_jobs)
        Helpers->>Helpers: execute_jobs_summary(..., target=ReportPortal)
        Helpers->>Helpers: _compute_jira_descriptions(...)

        alt progress_mode = True
            Helpers->>Helpers: build jira_description parts
            loop for each jira_description
                Helpers->>Helpers: _build_jira_comment(..., progress_mode=True)
                Helpers->>Jira: _add_jira_comment_for_report(...)
                Jira-->>Helpers: comment added
            end

            Helpers->>Helpers: skip _finalize_rp_launch
            Helpers->>Helpers: skip _transition_jira_issue_based_on_results
            Helpers->>Helpers: skip _add_erratum_comment_for_report
            Helpers->>Helpers: skip _add_rog_comment_for_report
        end

        deactivate Helpers
    end

    ReportCmd-->>CLI: reporting progress complete
    CLI-->>User: show completion of progress report only
Loading

Updated class diagram for report helpers and report command progress mode

classDiagram
    class CLIContext {
    }

    class ReportCommand {
        +cmd_report(ctx: CLIContext, progress: bool) void
    }

    class ReportHelpers {
        +execute_jobs_summary(ctx: CLIContext, jira_id: str, execute_jobs: list, target: str) tuple
        +_build_jira_comment(status: str, all_tests_finished: bool, launch_uuid: str?, launch_url: str?, jira_description: str, footer: str = '', first_comment: bool = True, progress_mode: bool = False) str
        +_process_jira_id_reports(ctx: CLIContext, jira_id: str, execute_jobs: list, rp: Any, jira_connection: Any, et: ErrataTool?, rog: RoGTool?, jira_comment_limit: int, progress_mode: bool = False) void
        +_finalize_rp_launch(ctx: CLIContext, rp: Any, launch_uuid: str, launch_url: str, launch_description: str) void
        +_transition_jira_issue_based_on_results(ctx: CLIContext, jira_connection: Any, jira_id: str, execute_job: Any, all_tests_passed: bool, all_tests_finished: bool) void
        +_add_jira_comment_for_report(ctx: CLIContext, jira_connection: Any, jira_id: str, execute_job: Any, comment: str) void
        +_add_erratum_comment_for_report(ctx: CLIContext, et: ErrataTool, jira_connection: Any, jira_id: str, execute_job: Any, launch_url: str?) void
        +_add_rog_comment_for_report(ctx: CLIContext, rog: RoGTool, jira_connection: Any, jira_id: str, execute_job: Any, launch_url: str?) void
    }

    class ExecuteJob {
        +request: Request
        +execution: Execution
    }

    class Request {
        +id: str
        +tmt: dict
        +reportportal: dict?
    }

    class Execution {
        +state: str
        +result: Enum
        +request_uuid: str
        +artifacts_url: str?
        +request_api: str?
    }

    class ErrataTool {
    }

    class RoGTool {
    }

    ReportCommand --> CLIContext
    ReportCommand --> ReportHelpers
    ReportHelpers --> CLIContext
    ReportHelpers --> ExecuteJob
    ExecuteJob --> Request
    ExecuteJob --> Execution
    ReportHelpers --> ErrataTool
    ReportHelpers --> RoGTool
Loading

File-Level Changes

Change Details Files
Add --progress flag to the report CLI command and thread the mode into reporting logic.
  • Introduce a --progress click option on the report command and pass the resulting boolean through the command handler
  • Update the report command docstring to describe behavior differences when using progress mode
  • Propagate the progress flag into _process_jira_id_reports via a new progress_mode parameter
newa/cli/commands/report_cmd.py
newa/cli/report_helpers.py
Support in-progress Jira messaging and conditional finalization behavior based on progress mode.
  • Extend _build_jira_comment with a progress_mode flag and branch comment text to say "test execution is in progress" when enabled, including variants for presence/absence of a ReportPortal launch and first vs subsequent comments
  • Update _process_jira_id_reports to conditionally call _build_jira_comment with progress_mode, and to skip ReportPortal launch finalization, Jira transitions, Errata Tool comments, and RoG comments when in progress mode while preserving normal behavior otherwise
newa/cli/report_helpers.py
Improve job summary URL selection to fall back to Testing Farm API URLs when artifacts URLs are missing.
  • Adjust execute_jobs_summary to prefer execution.artifacts_url when present and otherwise use execution.request_api as the URL in the results map
newa/cli/report_helpers.py
Document the new --progress option and its workflow in the README.
  • Add a README section describing --progress, detailing which integrations are updated or skipped, and providing an example workflow showing separate progress and finalization runs
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The branching in _build_jira_comment for progress_mode vs normal mode duplicates a lot of logic (especially around launch_uuid and first_comment handling); consider refactoring to a single flow with small conditional pieces for status text and presence of launch_url to make it easier to maintain.
  • Now that _process_jira_id_reports has a progress_mode flag, it might be worth adding a small guard or helper (e.g., _should_finalize(progress_mode, launch_uuid, rp)) so future changes don’t accidentally reintroduce finalization, transitions, or external comments when --progress is set.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The branching in `_build_jira_comment` for `progress_mode` vs normal mode duplicates a lot of logic (especially around `launch_uuid` and `first_comment` handling); consider refactoring to a single flow with small conditional pieces for status text and presence of `launch_url` to make it easier to maintain.
- Now that `_process_jira_id_reports` has a `progress_mode` flag, it might be worth adding a small guard or helper (e.g., `_should_finalize(progress_mode, launch_uuid, rp)`) so future changes don’t accidentally reintroduce finalization, transitions, or external comments when `--progress` is set.

## Individual Comments

### Comment 1
<location path="newa/cli/report_helpers.py" line_range="352" />
<code_context>
         max_length=jira_comment_limit - len(footer))
     launch_description = execute_jobs_summary(ctx, jira_id, execute_jobs, target='ReportPortal')[0]

-    # Finalize RP launch if needed
</code_context>
<issue_to_address>
**suggestion (performance):** Avoid building `launch_description` when running in progress mode if it is not used.

Since `_finalize_rp_launch` is skipped when `progress_mode=True`, `launch_description` is never used in that path and becomes unnecessary work. Consider only calling `execute_jobs_summary` (or computing `launch_description`) when `progress_mode` is false, or moving this computation lazily into `_finalize_rp_launch` to avoid extra processing for large job sets.

```suggestion
    launch_uuid, launch_url = _get_rp_launch_details(execute_jobs)
        max_length=jira_comment_limit - len(footer))

    # Only compute the (potentially expensive) launch_description when it will be used
    launch_description = None
    if not progress_mode:
        launch_description = execute_jobs_summary(
            ctx,
            jira_id,
            execute_jobs,
            target="ReportPortal",
        )[0]
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread newa/cli/report_helpers.py
This introduces a new --progress flag to the 'newa report' command that allows
reporting current test execution status without finalizing results. This is
useful for providing intermediate updates during long-running test executions.

When --progress is used:
- Updates TF request statuses to get current execution state
- Adds Jira comments with "test execution is in progress" message
- Uses Testing Farm API URLs for requests not yet scheduled/finished
- Skips ReportPortal launch finalization and description updates
- Skips Jira issue state transitions
- Skips Errata Tool and RoG comments

Changes:
- Add --progress flag to report command (report_cmd.py)
- Modify execute_jobs_summary to use API URLs when artifacts_url is unavailable
- Update _build_jira_comment to support progress mode messaging
- Update _process_jira_id_reports to conditionally skip finalization steps
- Add documentation for --progress option to README.md

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@kkaarreell kkaarreell merged commit d423de8 into main Apr 14, 2026
18 checks passed
@kkaarreell kkaarreell deleted the ks_report_progress branch April 14, 2026 17:24
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