Skip to content

fix(Operation): progress in intermediate state [YTFRONT-5634]#1461

Open
SimbiozizV wants to merge 1 commit intomainfrom
YTFRONT-5634
Open

fix(Operation): progress in intermediate state [YTFRONT-5634]#1461
SimbiozizV wants to merge 1 commit intomainfrom
YTFRONT-5634

Conversation

@SimbiozizV
Copy link
Collaborator

@SimbiozizV SimbiozizV commented Mar 16, 2026

https://nda.ya.ru/t/SlfKKTTf7Wsh6h

## Summary by Sourcery

Bug Fixes:

  • Ensure intermediate operation states display job-based progress instead of defaulting to generic state-based progress bars.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 16, 2026

Reviewer's Guide

Adjusts OperationProgress rendering logic so that stacked job-based progress is always shown while an operation is in an intermediate state, and the state-based progress bar is only used otherwise.

Class diagram for OperationProgress and Progress components

classDiagram
    class OperationProgress {
        +render()
        -operation
        -state
        -jobsProgress
        -completedJobsProgress
        -runningJobsProgress
    }

    class Operation {
        +inIntermediateState() bool
    }

    class Progress {
        +size
        +value
        +theme
        +stack
    }

    OperationProgress --> Operation : uses
    OperationProgress --> Progress : renders
Loading

Flow diagram for OperationProgress progressBar selection logic

flowchart LR
    A["Render OperationProgress"] --> B{"operation.inIntermediateState()"}
    B -->|"true"| C["Set progressBar to Progress with stacked jobsProgress, completedJobsProgress, runningJobsProgress"]
    B -->|"false"| D{"state"}

    D -->|"completed"| E["Set progressBar to Progress with RESOLVED_PROGRESS and theme success"]
    D -->|"failed"| F["Set progressBar to Progress with RESOLVED_PROGRESS and theme danger"]
    D -->|"aborted"| G["Set progressBar to Progress with RESOLVED_PROGRESS and theme default"]
    D -->|"other"| H["Set progressBar to Progress with PENDING_PROGRESS or 0"]

    C --> I["Render progressBar"]
    E --> I
    F --> I
    G --> I
    H --> I
Loading

File-Level Changes

Change Details Files
Show stacked jobs-based progress bar whenever the operation is in an intermediate state, falling back to state-based progress for non-intermediate states.
  • Replace switch-based handling of the 'running' state with an early conditional that checks operation.inIntermediateState()
  • Render the stacked Progress component with jobsProgress, completedJobsProgress, and runningJobsProgress when in an intermediate state regardless of the operation state value
  • Restrict the switch statement to non-intermediate states, mapping completed/failed/aborted/default to resolved/pending Progress variants
packages/ui/src/ui/pages/operations/OperationProgress/OperationProgress.js

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 16, 2026

E2E-local report is ready.
E2E-remote report is ready.
E2E-screenshots report is ready.
E2E-passwd report is ready.

@github-actions
Copy link
Contributor

Storybook is ready.

@github-actions
Copy link
Contributor

Playwright components report is ready.

@github-actions
Copy link
Contributor

Statoscope report is ready.

@SimbiozizV SimbiozizV marked this pull request as ready for review March 16, 2026 09:47
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Consider extracting the operation.inIntermediateState() rendering into a small helper (e.g. renderIntermediateProgress()) to keep the main render logic more readable and reduce nesting.
  • If PENDING_PROGRESS is always defined and numeric, you can drop the || 0 fallback to avoid suggesting that it may be falsy and simplify the default case.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider extracting the `operation.inIntermediateState()` rendering into a small helper (e.g. `renderIntermediateProgress()`) to keep the main render logic more readable and reduce nesting.
- If `PENDING_PROGRESS` is always defined and numeric, you can drop the `|| 0` fallback to avoid suggesting that it may be falsy and simplify the default case.

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.

default:
progressBar = <Progress size="s" value={PENDING_PROGRESS || 0} />;
break;
if (operation.inIntermediateState()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to destruct inIntermediateState as over variables?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

calling inIntermediateState() will have an incorrect this and will break the logic.

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.

2 participants