Skip to content

feat(KFLUXUI-1008): add version details page#715

Open
marcin-michal wants to merge 15 commits intokonflux-ci:mainfrom
marcin-michal:KFLUXUI-1008
Open

feat(KFLUXUI-1008): add version details page#715
marcin-michal wants to merge 15 commits intokonflux-ci:mainfrom
marcin-michal:KFLUXUI-1008

Conversation

@marcin-michal
Copy link
Member

@marcin-michal marcin-michal commented Feb 20, 2026

Fixes

KFLUXUI-1008

Description

Adds the version details page, with version about the version and it's last commit/build pipeline run.

The information about commit and pipeline run is not working right now, as there is no label to identify versions pipeline runs yet.

Builds upon #712 which should be merged first.

Type of change

  • Feature
  • Bugfix
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Screen shots / Gifs for design review

image

How to test or reproduce?

  1. Spin up local Konflux cluster https://github.com/konflux-ci/konflux-ci/?tab=readme-ov-file#konflux-ci
  2. Once running, apply new Component CR https://github.com/sahil143/kflux-scripts/blob/main/yamls/crds/kflux-components-crd.yaml
kubectl apply -f yamls/crds/kflux-components-crd.yaml
  1. Change line 164 here https://github.com/sahil143/kflux-scripts/blob/main/scripts/mock-components.mjs#L164 to this
    await $`kubectl patch components.kflux.dev ${name} -n ${namespace} --type merge --subresource=status -p ${JSON.stringify(
      { status }
    )}`;
  1. Run yarn run create-mock-components on one of the precreated namespaces in the local cluster.
  2. Apply this to be able to view the new component CR
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: konflux-kflux-dev-components-admin
  labels:
    rbac.konflux-ci.dev/aggregate-to-admin: "true"
rules:
- apiGroups:
  - kflux.dev
  resources:
  - components
  verbs:
  - get
  - list
  - watch
  - create
  - update
  - patch
  - delete
  - deletecollection
  1. Configure Konflux UI to run with the local Konflux https://github.com/konflux-ci/konflux-ui?tab=readme-ov-file#running-with-konflux-ci
  2. Navigate to the new version page (any of the component names that were generated by the script) https://localhost:8080/ns/<ns>/components/<component>/versions/<versionREVISION>. Note that the revision should be used in the URL, not the name.

Summary by CodeRabbit

  • New Features
    • New Component Version details page (header, breadcrumbs) with Overview and Activity tabs; shows version info, git branch/tag, pipeline name, and Latest Build section with commit and pipeline run status. Activity tab placeholder added.
    • Page rendering is gated by a feature flag with a guided fallback when disabled.
    • Route and loader added so the page is reachable via app navigation.
  • Tests
    • Comprehensive unit tests for the details page, details tab, latest-build section, and version-lookup utility.

@marcin-michal marcin-michal self-assigned this Feb 20, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'version', 'include', 'exclude', 'rules', 'limits'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

Adds a feature-flag‑gated Component Version details UI: new details view, RBAC loader and routes, a Details tab, LatestBuildSection, version lookup util, hook signature extension, and comprehensive unit tests across these modules.

Changes

Cohort / File(s) Summary
Details view & routing
src/components/ComponentVersion/ComponentVersionDetailsView.tsx, src/components/ComponentVersion/index.ts, src/routes/page-routes/component-version.tsx, src/routes/index.tsx
New feature-flag‑gated details layout exported and re‑exported, RBAC loader (componentVersionDetailsViewLoader) for Component resources, and route entries wired into router children.
Details tab & util
src/components/ComponentVersion/tabs/ComponentVersionDetailsTab.tsx, src/utils/version-utils.ts, src/utils/__tests__/version-utils.spec.ts
New tab rendering version metadata (name, repo link/branch/tag, pipeline), uses getComponentVersion util to resolve versions; unit tests added for version lookup.
Latest build UI & hook change
src/components/LatestBuild/LatestBuildSection.tsx, src/hooks/useLatestPushBuildPipeline.ts
New LatestBuildSection component (memoized) that queries latest PipelineRun and renders commit and run info; hook signature extended to accept optional version parameter (no active behavior change).
Tests for views/tabs/latest build
src/components/ComponentVersion/__tests__/ComponentVersionDetailsView.spec.tsx, src/components/ComponentVersion/tabs/__tests__/ComponentVersionDetailsTab.spec.tsx, src/components/LatestBuild/__tests__/LatestBuildSection.spec.tsx
Comprehensive unit tests covering loading, error, 404, feature-flag fallback, tab UI, and LatestBuild behaviors with mocked hooks and data.
Routing integration
src/routes/page-routes/component-version.tsx, src/routes/index.tsx
Adds component-version route module and integrates its routes into main router children.

Sequence Diagram(s)

sequenceDiagram
  participant Router as Router
  participant Loader as RBAC Loader
  participant K8s as Kubernetes API
  participant View as ComponentVersionDetailsView
  participant Tab as ComponentVersionDetailsTab
  participant LatestHook as useLatestBuildPipelineRunForComponentV2
  participant CommitSvc as Commit utils

  rect rgba(63,81,181,0.5)
    Router->>Loader: route match (component, workspace)
    Loader->>K8s: k8sQueryGetResource(ComponentModel.get)
    K8s-->>Loader: Component resource (or error)
    Loader-->>View: provide component / error
  end

  rect rgba(0,150,136,0.5)
    View->>View: feature-flag check (components-page)
    View->>Tab: render selected tab (Details)
    Tab->>LatestHook: request latest build for component + version
    LatestHook->>K8s: query PipelineRuns (selector/filter)
    K8s-->>LatestHook: PipelineRun(s)
    LatestHook->>CommitSvc: getCommitsFromPLRs
    CommitSvc-->>LatestHook: commits[]
    LatestHook-->>Tab: pipelineRun + commits
    Tab-->>View: render commit, status, links
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested labels

ok-to-test

Suggested reviewers

  • rrosatti
  • sahil143
  • JoaoPedroPP
  • testcara
  • abhinandan13jan

Poem

A view for versions takes its stand,
Routes and loaders close at hand.
Commits and runs in tidy rows,
Flags that gate what UI shows.
Tests hum softly as it grows.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(KFLUXUI-1008): add version details page' clearly and accurately summarizes the main feature addition: a new version details page for components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@snyk-io
Copy link
Contributor

snyk-io bot commented Feb 20, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

<DescriptionListGroup>
<DescriptionListTerm>Latest build pipeline run</DescriptionListTerm>
<DescriptionListDescription data-test="latest-build-pipelinerun">
{pipelineRun.metadata?.name ?? '-'}
Copy link
Member

Choose a reason for hiding this comment

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

This should be link to pipeline run. Also we should show status of the pipeline run with all this information

Image

Copy link
Member Author

Choose a reason for hiding this comment

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

I left it as a text for now, as there is no updated pipeline run routes/components yet. Felt like it would be more fitting to update it in that PR.

Also I'm not sure what do you mean by show the status? The component details page shows the latest successful build pipeline.

Copy link
Member Author

Choose a reason for hiding this comment

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

updated to show the latest build (any status) with it's status
image

@marcin-michal marcin-michal marked this pull request as ready for review March 3, 2026 23:03
@marcin-michal marcin-michal requested a review from a team as a code owner March 3, 2026 23:03
@marcin-michal marcin-michal requested review from rakshett and sahil143 and removed request for a team March 3, 2026 23:03
@marcin-michal
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (5)
src/components/ComponentVersion/index.ts (1)

1-4: Use configured path aliases for imports in this new module.

Please switch these new relative imports to the repository aliases to match import restrictions and keep layering consistent.

♻️ Proposed refactor
-import { k8sQueryGetResource } from '../../k8s';
-import { ComponentModel } from '../../models';
-import { RouterParams } from '../../routes/utils';
-import { createLoaderWithAccessCheck } from '../../utils/rbac';
+import { k8sQueryGetResource } from '~/k8s';
+import { ComponentModel } from '~/models';
+import { RouterParams } from '~/routes/utils';
+import { createLoaderWithAccessCheck } from '~/utils/rbac';

As per coding guidelines: "Use absolute imports with configured path aliases: ~/components, ~/types, ~/k8s, ~/utils, ~/models, @routes."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/ComponentVersion/index.ts` around lines 1 - 4, Update the four
relative imports at the top of this module to use the project's configured path
aliases: replace '../../k8s' with '~/k8s' for k8sQueryGetResource,
'../../models' with '~/models' for ComponentModel, '../../routes/utils' with
'@routes/utils' (or '@routes' variant) for RouterParams, and '../../utils/rbac'
with '~/utils/rbac' for createLoaderWithAccessCheck so the module uses the
absolute alias imports required by the coding guidelines.
src/components/ComponentVersion/ComponentVersionDetailsView.tsx (1)

20-20: Use absolute import path for DetailsPage.

The import should use the configured path alias for consistency with the rest of the imports in this file.

♻️ Proposed fix
-import { DetailsPage } from '../DetailsPage';
+import { DetailsPage } from '~/components/DetailsPage';

As per coding guidelines: "Use absolute imports with configured path aliases."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/ComponentVersion/ComponentVersionDetailsView.tsx` at line 20,
The import for DetailsPage in ComponentVersionDetailsView uses a relative path;
update the import to use the project's configured absolute path/alias (e.g.,
import DetailsPage from the alias that resolves to the DetailsPage module) so
that the DetailsPage import follows the codebase's absolute import convention
and matches other imports in this file.
src/components/ComponentVersion/tabs/ComponentVersionDetailsTab.tsx (2)

49-81: Remove unnecessary fragment wrapper.

The fragment wrapper (<>...</>) is unnecessary since there's only a single child element (DetailsSection).

♻️ Proposed fix
-  return (
-    <>
-      <DetailsSection title="Version details">
+  return (
+    <DetailsSection title="Version details">
         <DescriptionList>
           ...
         </DescriptionList>
-      </DetailsSection>
-    </>
+    </DetailsSection>
   );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/ComponentVersion/tabs/ComponentVersionDetailsTab.tsx` around
lines 49 - 81, The JSX return in ComponentVersionDetailsTab wraps the lone
<DetailsSection> in an unnecessary fragment; remove the fragment wrapper and
return the <DetailsSection> element directly so the component returns a single
root element. Update the return expression that currently wraps
<DetailsSection>...</> to just <DetailsSection>...</DetailsSection>, leaving
inner children (DescriptionList, DescriptionListGroup, LatestBuildSection, etc.)
untouched.

18-18: Use absolute import path for DetailsSection.

The import should use the configured path alias for consistency.

♻️ Proposed fix
-import { DetailsSection } from '../../DetailsPage';
+import { DetailsSection } from '~/components/DetailsPage';

As per coding guidelines: "Use absolute imports with configured path aliases."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/ComponentVersion/tabs/ComponentVersionDetailsTab.tsx` at line
18, Replace the relative import of DetailsSection with the project's configured
path alias: update the import statement that currently imports DetailsSection
from '../../DetailsPage' in ComponentVersionDetailsTab.tsx to use the absolute
alias used across the repo (e.g., the configured alias for the DetailsPage
module) so DetailsSection is imported via the project's path-alias instead of a
relative path.
src/components/ComponentVersion/__tests__/ComponentVersionDetailsView.spec.tsx (1)

72-83: Consider moving namespace mock inside beforeEach for better test isolation.

The mockUseNamespaceHook('test-ns') call at line 73 is outside beforeEach, which may work but could lead to unexpected behavior if tests modify namespace state. Moving it inside beforeEach ensures consistent setup for each test.

♻️ Suggested improvement
 describe('ComponentVersionDetailsView', () => {
-  mockUseNamespaceHook('test-ns');
-
   beforeEach(() => {
+    mockUseNamespaceHook('test-ns');
     useParamsMock.mockReturnValue({
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/components/ComponentVersion/__tests__/ComponentVersionDetailsView.spec.tsx`
around lines 72 - 83, Move the call to mockUseNamespaceHook('test-ns') into the
beforeEach block to ensure namespace state is reset for every test; update the
beforeEach that currently sets useParamsMock, useComponentMock,
mockUseIsOnFeatureFlag, and mockUseFeatureFlags so it also calls
mockUseNamespaceHook('test-ns') at the top (or call a reset/cleanup helper prior
to setting the other mocks) to guarantee consistent isolation between tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/LatestBuild/LatestBuildSection.tsx`:
- Around line 2-9: In LatestBuildSection, replace the raw <div> layout wrappers
used around the loading Spinner (and the other raw divs noted around lines
39–42) with a PatternFly layout component such as Bullseye (import Bullseye from
'@patternfly/react-core') so the Spinner and any loading message/Alert are
centered and use PF layout primitives; update the JSX in the loading branch to
use <Bullseye><Spinner ... /></Bullseye> (and convert the other raw wrapper
<div> instances to appropriate PF layout components like Bullseye or Stack as
needed) and add the Bullseye import to the existing import list.

In `@src/routes/page-routes/component-version.tsx`:
- Around line 1-7: Replace the relative imports in this file with the project's
path aliases: change imports of ComponentVersionDetailsViewLayout and
componentVersionDetailsViewLoader from '../../components/ComponentVersion' to
'~/components/ComponentVersion', change ComponentVersionDetailsTab from
'../../components/ComponentVersion/tabs/ComponentVersionDetailsTab' to
'~/components/ComponentVersion/tabs/ComponentVersionDetailsTab', change
COMPONENT_VERSION_DETAILS_PATH from '../paths' to '@routes/paths', and change
RouteErrorBoundry from '../RouteErrorBoundary' to '@routes/RouteErrorBoundary'
so the file consistently uses the configured aliases.

---

Nitpick comments:
In
`@src/components/ComponentVersion/__tests__/ComponentVersionDetailsView.spec.tsx`:
- Around line 72-83: Move the call to mockUseNamespaceHook('test-ns') into the
beforeEach block to ensure namespace state is reset for every test; update the
beforeEach that currently sets useParamsMock, useComponentMock,
mockUseIsOnFeatureFlag, and mockUseFeatureFlags so it also calls
mockUseNamespaceHook('test-ns') at the top (or call a reset/cleanup helper prior
to setting the other mocks) to guarantee consistent isolation between tests.

In `@src/components/ComponentVersion/ComponentVersionDetailsView.tsx`:
- Line 20: The import for DetailsPage in ComponentVersionDetailsView uses a
relative path; update the import to use the project's configured absolute
path/alias (e.g., import DetailsPage from the alias that resolves to the
DetailsPage module) so that the DetailsPage import follows the codebase's
absolute import convention and matches other imports in this file.

In `@src/components/ComponentVersion/index.ts`:
- Around line 1-4: Update the four relative imports at the top of this module to
use the project's configured path aliases: replace '../../k8s' with '~/k8s' for
k8sQueryGetResource, '../../models' with '~/models' for ComponentModel,
'../../routes/utils' with '@routes/utils' (or '@routes' variant) for
RouterParams, and '../../utils/rbac' with '~/utils/rbac' for
createLoaderWithAccessCheck so the module uses the absolute alias imports
required by the coding guidelines.

In `@src/components/ComponentVersion/tabs/ComponentVersionDetailsTab.tsx`:
- Around line 49-81: The JSX return in ComponentVersionDetailsTab wraps the lone
<DetailsSection> in an unnecessary fragment; remove the fragment wrapper and
return the <DetailsSection> element directly so the component returns a single
root element. Update the return expression that currently wraps
<DetailsSection>...</> to just <DetailsSection>...</DetailsSection>, leaving
inner children (DescriptionList, DescriptionListGroup, LatestBuildSection, etc.)
untouched.
- Line 18: Replace the relative import of DetailsSection with the project's
configured path alias: update the import statement that currently imports
DetailsSection from '../../DetailsPage' in ComponentVersionDetailsTab.tsx to use
the absolute alias used across the repo (e.g., the configured alias for the
DetailsPage module) so DetailsSection is imported via the project's path-alias
instead of a relative path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e2336d34-09b9-46e3-a299-a52df48a0b84

📥 Commits

Reviewing files that changed from the base of the PR and between e54ec86 and 1a0a94a.

📒 Files selected for processing (14)
  • src/components/ComponentVersion/ComponentVersionDetailsView.tsx
  • src/components/ComponentVersion/__tests__/ComponentVersionDetailsView.spec.tsx
  • src/components/ComponentVersion/index.ts
  • src/components/ComponentVersion/tabs/ComponentVersionDetailsTab.tsx
  • src/components/ComponentVersion/tabs/__tests__/ComponentVersionDetailsTab.spec.tsx
  • src/components/LatestBuild/LatestBuildSection.tsx
  • src/components/LatestBuild/__tests__/LatestBuildSection.spec.tsx
  • src/hooks/useLatestPushBuildPipeline.ts
  • src/routes/index.tsx
  • src/routes/page-routes/component-version.tsx
  • src/routes/paths.ts
  • src/routes/utils.ts
  • src/utils/__tests__/version-utils.spec.ts
  • src/utils/version-utils.ts

@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 84.28571% with 55 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.14%. Comparing base (d910fd5) to head (26bf4b6).

Files with missing lines Patch % Lines
src/routes/page-routes/component-version.tsx 3.57% 26 Missing and 1 partial ⚠️
src/components/ComponentVersion/index.ts 4.34% 21 Missing and 1 partial ⚠️
src/hooks/useLatestPushBuildPipeline.ts 0.00% 4 Missing ⚠️
src/routes/index.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #715      +/-   ##
==========================================
+ Coverage   86.37%   87.14%   +0.77%     
==========================================
  Files         776      782       +6     
  Lines       59373    59723     +350     
  Branches     6138     7116     +978     
==========================================
+ Hits        51283    52048     +765     
+ Misses       7991     7456     -535     
- Partials       99      219     +120     
Flag Coverage Δ
e2e 43.67% <11.11%> (?)
unittests 86.35% <83.71%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...s/ComponentVersion/ComponentVersionDetailsView.tsx 100.00% <100.00%> (ø)
...mponentVersion/tabs/ComponentVersionDetailsTab.tsx 100.00% <100.00%> (ø)
src/components/LatestBuild/LatestBuildSection.tsx 100.00% <100.00%> (ø)
src/utils/version-utils.ts 100.00% <100.00%> (ø)
src/routes/index.tsx 2.50% <0.00%> (+2.50%) ⬆️
src/hooks/useLatestPushBuildPipeline.ts 13.40% <0.00%> (+13.40%) ⬆️
src/components/ComponentVersion/index.ts 4.34% <4.34%> (ø)
src/routes/page-routes/component-version.tsx 3.57% <3.57%> (ø)

... and 109 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d910fd5...26bf4b6. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/components/LatestBuild/__tests__/LatestBuildSection.spec.tsx (1)

9-15: Use the typed mock helper instead of as jest.Mock here.

These casts erase the hook/utility signatures, so the suite can return the wrong tuple or argument shape without TypeScript catching it. createJestMockFunction keeps the mocks aligned with the real APIs.

Based on learnings: use createJestMockFunction from ~/unit-test-utils/common for type-safe mock functions with specific signatures.

Also applies to: 25-26

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/LatestBuild/__tests__/LatestBuildSection.spec.tsx` around
lines 9 - 15, Replace the untyped jest.fn mocks for the hook and utility with
the typed helper: import and use createJestMockFunction from
'~/unit-test-utils/common' to create mocks for
useLatestBuildPipelineRunForComponentV2 and getCommitsFromPLRs so their
signatures are preserved (replace the jest.mock implementations that return
jest.fn() and any spots currently cast with "as jest.Mock" with
createJestMockFunction<T>() calls using the real function/type signatures);
ensure both the mock definitions shown for
useLatestBuildPipelineRunForComponentV2 and getCommitsFromPLRs (and the other
occurrences around the file) use the typed helper to keep return tuples/argument
shapes type-safe.
src/components/LatestBuild/LatestBuildSection.tsx (1)

18-19: Use path aliases for these internal imports.

These relative imports bypass the repo’s alias/layering convention and make moves/refactors noisier. Please switch them to ~/components/... imports.

As per coding guidelines: "Use absolute imports with configured path aliases: ~/components, ~/types, ~/k8s, ~/utils, ~/models, @routes"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/LatestBuild/LatestBuildSection.tsx` around lines 18 - 19, The
file LatestBuildSection.tsx uses relative imports for internal components
(CommitLabel and StatusIconWithTextLabel); replace the relative paths with the
project's path aliases (e.g., import CommitLabel from
'~/components/Commits/commit-label/CommitLabel' and import {
StatusIconWithTextLabel } from '~/components/StatusIcon/StatusIcon') so the
imports follow the repo convention and layering rules; update the import
statements referencing CommitLabel and StatusIconWithTextLabel accordingly and
run the TypeScript build to verify alias resolution.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/LatestBuild/LatestBuildSection.tsx`:
- Around line 29-30: The version-scoped lookup in LatestBuildSection uses
useLatestBuildPipelineRunForComponentV2(namespace, component.metadata.name,
version) which makes the hook filter by PipelineRunLabel.COMPONENT_VERSION (not
yet set) and causes false "No build pipeline available" empty state; fix by
removing the version filter for now (call
useLatestBuildPipelineRunForComponentV2(namespace, component.metadata.name) or
pass undefined for version) or, if you prefer to keep the call, detect a missing
PipelineRunLabel.COMPONENT_VERSION and render a temporary "Build data
unavailable for versions yet" message instead of the empty-state alert so users
know this is a known limitation. Ensure changes are made inside
LatestBuildSection and reference useLatestBuildPipelineRunForComponentV2 and the
empty-state render branch to update behavior.

---

Nitpick comments:
In `@src/components/LatestBuild/__tests__/LatestBuildSection.spec.tsx`:
- Around line 9-15: Replace the untyped jest.fn mocks for the hook and utility
with the typed helper: import and use createJestMockFunction from
'~/unit-test-utils/common' to create mocks for
useLatestBuildPipelineRunForComponentV2 and getCommitsFromPLRs so their
signatures are preserved (replace the jest.mock implementations that return
jest.fn() and any spots currently cast with "as jest.Mock" with
createJestMockFunction<T>() calls using the real function/type signatures);
ensure both the mock definitions shown for
useLatestBuildPipelineRunForComponentV2 and getCommitsFromPLRs (and the other
occurrences around the file) use the typed helper to keep return tuples/argument
shapes type-safe.

In `@src/components/LatestBuild/LatestBuildSection.tsx`:
- Around line 18-19: The file LatestBuildSection.tsx uses relative imports for
internal components (CommitLabel and StatusIconWithTextLabel); replace the
relative paths with the project's path aliases (e.g., import CommitLabel from
'~/components/Commits/commit-label/CommitLabel' and import {
StatusIconWithTextLabel } from '~/components/StatusIcon/StatusIcon') so the
imports follow the repo convention and layering rules; update the import
statements referencing CommitLabel and StatusIconWithTextLabel accordingly and
run the TypeScript build to verify alias resolution.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 23bfcd80-52b3-488b-90c9-147eb242c159

📥 Commits

Reviewing files that changed from the base of the PR and between 5989d60 and 040bfec.

📒 Files selected for processing (3)
  • src/components/LatestBuild/LatestBuildSection.tsx
  • src/components/LatestBuild/__tests__/LatestBuildSection.spec.tsx
  • src/hooks/useLatestPushBuildPipeline.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/hooks/useLatestPushBuildPipeline.ts

Assisted-by: Cursor
rrosatti
rrosatti previously approved these changes Mar 12, 2026
Copy link
Member

@rrosatti rrosatti left a comment

Choose a reason for hiding this comment

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

I left a minor comment, but overall code looks good! also tested locally and it's working fine. Nice job :)

}

if (!pipelineRun) {
return <Alert variant="info" isInline title="No build pipeline available" />;
Copy link
Member

Choose a reason for hiding this comment

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

nit: shouldn't we maybe show this Alert under the "Latest build pipeline run" section? With this early return, we won't display the "Latest commit" info.

diff --git a/src/components/LatestBuild/LatestBuildSection.tsx b/src/components/LatestBuild/LatestBuildSection.tsx
index c6d39ed2..8173fb40 100644
--- a/src/components/LatestBuild/LatestBuildSection.tsx
+++ b/src/components/LatestBuild/LatestBuildSection.tsx
@@ -46,12 +46,6 @@ const LatestBuildSection: React.FC<LatestBuildSectionProps> = ({ component, vers
     );
   }

-  if (!pipelineRun) {
-    return <Alert variant="info" isInline title="No build pipeline available" />;
-  }
-
-  const status = pipelineRunStatus(pipelineRun);
-
   return (
     <DescriptionList>
       <DescriptionListGroup>
@@ -79,10 +73,14 @@ const LatestBuildSection: React.FC<LatestBuildSectionProps> = ({ component, vers
       <DescriptionListGroup>
         <DescriptionListTerm>Latest build pipeline run</DescriptionListTerm>
         <DescriptionListDescription data-test="latest-build-pipelinerun">
-          <Flex direction={{ default: 'row' }}>
-            <StatusIconWithTextLabel status={status} />
-            {pipelineRun.metadata?.name ?? '-'}
-          </Flex>
+          {pipelineRun ? (
+            <Flex direction={{ default: 'row' }}>
+              <StatusIconWithTextLabel status={pipelineRunStatus(pipelineRun)} />
+              {pipelineRun.metadata?.name ?? '-'}
+            </Flex>
+          ) : (
+            <Alert variant="info" isInline title="No build pipeline available" />
+          )}
         </DescriptionListDescription>
       </DescriptionListGroup>
     </DescriptionList>

currently:

Image

with the suggested changes:

Image

Copy link
Member Author

Choose a reason for hiding this comment

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

I like the change, updated

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/components/LatestBuild/LatestBuildSection.tsx (1)

32-35: Consider simplifying the useMemo expression for readability.

The nested ternary with array access is functionally correct but somewhat dense. A more explicit form would improve maintainability.

♻️ Proposed refactor
 const commit = React.useMemo(
-  () => ((pipelineRunLoaded && pipelineRun && getCommitsFromPLRs([pipelineRun], 1)) || [])[0],
+  () => {
+    if (!pipelineRunLoaded || !pipelineRun) return undefined;
+    return getCommitsFromPLRs([pipelineRun], 1)?.[0];
+  },
   [pipelineRunLoaded, pipelineRun],
 );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/LatestBuild/LatestBuildSection.tsx` around lines 32 - 35, The
useMemo for commit is hard to read due to a nested ternary/array access; rewrite
the React.useMemo callback to explicitly check pipelineRunLoaded and pipelineRun
first, call getCommitsFromPLRs([pipelineRun], 1) only when both are truthy, then
return the first element (or undefined) — i.e., refactor the current expression
that assigns commit to use a clearer if/guard style within the useMemo callback
while keeping the same dependency array ([pipelineRunLoaded, pipelineRun]) and
using getCommitsFromPLRs to extract the commit.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/components/LatestBuild/LatestBuildSection.tsx`:
- Around line 32-35: The useMemo for commit is hard to read due to a nested
ternary/array access; rewrite the React.useMemo callback to explicitly check
pipelineRunLoaded and pipelineRun first, call getCommitsFromPLRs([pipelineRun],
1) only when both are truthy, then return the first element (or undefined) —
i.e., refactor the current expression that assigns commit to use a clearer
if/guard style within the useMemo callback while keeping the same dependency
array ([pipelineRunLoaded, pipelineRun]) and using getCommitsFromPLRs to extract
the commit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9fa85ca8-f7f7-44fd-846f-8c2824f12d04

📥 Commits

Reviewing files that changed from the base of the PR and between 4cc2e2d and 26bf4b6.

📒 Files selected for processing (1)
  • src/components/LatestBuild/LatestBuildSection.tsx

{pipelineRun ? (
<Flex direction={{ default: 'row' }}>
<StatusIconWithTextLabel status={status} />
{pipelineRun.metadata?.name ?? '-'}
Copy link
Member

Choose a reason for hiding this comment

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

how about using Link component here to navigate to PLR details page? :)

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.

3 participants