Skip to content

SRVKP-10037: Fixed task node status in pipeline run topology which was not updating in real time#1027

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift-pipelines:masterfrom
anwesha-palit-redhat:fix/SRVKP-10037
Apr 8, 2026
Merged

SRVKP-10037: Fixed task node status in pipeline run topology which was not updating in real time#1027
openshift-merge-bot[bot] merged 1 commit intoopenshift-pipelines:masterfrom
anwesha-palit-redhat:fix/SRVKP-10037

Conversation

@anwesha-palit-redhat
Copy link
Copy Markdown
Contributor

Summary

Pipeline topology task nodes were not reflecting live TaskRun status updates — statuses only appeared after hovering on a node or switching tabs. This was caused by a dual MobX instance problem: PipelineTaskNode imported observer from the plugin-bundled mobx-react, while @patternfly/react-topology (a shared module loaded from the host console) uses its own MobX instance. The mismatched instances meant observable changes on topology elements were invisible to the plugin's observer.
Additionally, the task status derivation logic in appendPipelineRunStatus had issues with mutation, a deprecated Tekton v0 field lookup, and incorrect failure defaults. The useTRRuns hook also violated React's rules of hooks with a conditional early return before hook calls.

Changes

  • PipelineTaskNode.tsx: Import observer from @patternfly/react-topology instead of mobx-react to use the host console's MobX instance, ensuring topology observable changes trigger re-renders. This essentially fixed the main issue we were encountering. Removed redundant memo wrapper.

  • pipeline-utils.ts (appendPipelineRunStatus): Replaced _.merge with immutable object spreads to prevent stale status persisting via direct mutation of pipeline.spec.tasks.

Removed deprecated pipelineRun.status.taskRuns lookup (not present in Tekton v1 — status is now sourced from individual TaskRun objects resolved via childReferences).

Fixed fallback logic so tasks default to Pending instead of Failed when TaskRuns haven't been fetched yet; tasks are only marked Failed when the PipelineRun itself has failed.

  • useTektonResults.ts (useTRRuns): Moved the !isTektonResultEnabled early return below all hook calls to comply with React's rules of hooks. The guard is now applied inside the useEffect condition instead.

Screen Recording Before

before-10306.mov

Screen Recording After

after-10306.mov

@openshift-ci-robot
Copy link
Copy Markdown
Collaborator

openshift-ci-robot commented Apr 7, 2026

@anwesha-palit-redhat: This pull request references SRVKP-10306 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

Pipeline topology task nodes were not reflecting live TaskRun status updates — statuses only appeared after hovering on a node or switching tabs. This was caused by a dual MobX instance problem: PipelineTaskNode imported observer from the plugin-bundled mobx-react, while @patternfly/react-topology (a shared module loaded from the host console) uses its own MobX instance. The mismatched instances meant observable changes on topology elements were invisible to the plugin's observer.
Additionally, the task status derivation logic in appendPipelineRunStatus had issues with mutation, a deprecated Tekton v0 field lookup, and incorrect failure defaults. The useTRRuns hook also violated React's rules of hooks with a conditional early return before hook calls.

Changes

  • PipelineTaskNode.tsx: Import observer from @patternfly/react-topology instead of mobx-react to use the host console's MobX instance, ensuring topology observable changes trigger re-renders. This essentially fixed the main issue we were encountering. Removed redundant memo wrapper.

  • pipeline-utils.ts (appendPipelineRunStatus): Replaced _.merge with immutable object spreads to prevent stale status persisting via direct mutation of pipeline.spec.tasks.

Removed deprecated pipelineRun.status.taskRuns lookup (not present in Tekton v1 — status is now sourced from individual TaskRun objects resolved via childReferences).

Fixed fallback logic so tasks default to Pending instead of Failed when TaskRuns haven't been fetched yet; tasks are only marked Failed when the PipelineRun itself has failed.

  • useTektonResults.ts (useTRRuns): Moved the !isTektonResultEnabled early return below all hook calls to comply with React's rules of hooks. The guard is now applied inside the useEffect condition instead.

Screen Recording Before

before-10306.mov

Screen Recording After

after-10306.mov

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci Bot added the approved Label for Approved PRs label Apr 7, 2026
@anwesha-palit-redhat anwesha-palit-redhat requested review from arvindk-softwaredev and removed request for lokanandaprabhu and vdemeester April 7, 2026 11:11
return _.merge(task, { status: { reason: ComputedStatus.Failed } });
if (pipelineRunStatus(pipelineRun) === ComputedStatus.Failed) {
return { ...task, status: { reason: ComputedStatus.Failed } };
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated the default tasknode to show as pending instead of failed


const mTask = _.merge(task, {
status: pipelineRun?.status?.taskRuns
? _.get(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

pipelineRun.status.taskRuns is deprecated therefore removed this

observer,
} from '@patternfly/react-topology';
import classNames from 'classnames';
import { observer } from 'mobx-react';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this essentially fixed the issue, mobx-react shouldn't be directly used, PF internally uses it

@anwesha-palit-redhat anwesha-palit-redhat changed the title SRVKP-10306: Fixed task node status in pipeline run topology which was not updating in real time SRVKP-10037: Fixed task node status in pipeline run topology which was not updating in real time Apr 7, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Collaborator

openshift-ci-robot commented Apr 7, 2026

@anwesha-palit-redhat: This pull request references SRVKP-10037 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

Summary

Pipeline topology task nodes were not reflecting live TaskRun status updates — statuses only appeared after hovering on a node or switching tabs. This was caused by a dual MobX instance problem: PipelineTaskNode imported observer from the plugin-bundled mobx-react, while @patternfly/react-topology (a shared module loaded from the host console) uses its own MobX instance. The mismatched instances meant observable changes on topology elements were invisible to the plugin's observer.
Additionally, the task status derivation logic in appendPipelineRunStatus had issues with mutation, a deprecated Tekton v0 field lookup, and incorrect failure defaults. The useTRRuns hook also violated React's rules of hooks with a conditional early return before hook calls.

Changes

  • PipelineTaskNode.tsx: Import observer from @patternfly/react-topology instead of mobx-react to use the host console's MobX instance, ensuring topology observable changes trigger re-renders. This essentially fixed the main issue we were encountering. Removed redundant memo wrapper.

  • pipeline-utils.ts (appendPipelineRunStatus): Replaced _.merge with immutable object spreads to prevent stale status persisting via direct mutation of pipeline.spec.tasks.

Removed deprecated pipelineRun.status.taskRuns lookup (not present in Tekton v1 — status is now sourced from individual TaskRun objects resolved via childReferences).

Fixed fallback logic so tasks default to Pending instead of Failed when TaskRuns haven't been fetched yet; tasks are only marked Failed when the PipelineRun itself has failed.

  • useTektonResults.ts (useTRRuns): Moved the !isTektonResultEnabled early return below all hook calls to comply with React's rules of hooks. The guard is now applied inside the useEffect condition instead.

Screen Recording Before

before-10306.mov

Screen Recording After

after-10306.mov

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

}
};
!skipFetch && fetchResults();
!skipFetch && isTektonResultEnabled && fetchResults();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

good catch for violation of Rules of Hooks

Copy link
Copy Markdown
Contributor

@arvindk-softwaredev arvindk-softwaredev left a comment

Choose a reason for hiding this comment

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

/approve

@openshift-ci openshift-ci Bot added the lgtm Looks Good to Me Label label Apr 8, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 8, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: anwesha-palit-redhat, arvindk-softwaredev

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [anwesha-palit-redhat,arvindk-softwaredev]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot Bot merged commit a635dae into openshift-pipelines:master Apr 8, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Label for Approved PRs jira/valid-reference lgtm Looks Good to Me Label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants