Skip to content

OLS-2770: OCP 4.22 support#1793

Open
kyoto wants to merge 4 commits intoopenshift:mainfrom
kyoto:4.22-support
Open

OLS-2770: OCP 4.22 support#1793
kyoto wants to merge 4 commits intoopenshift:mainfrom
kyoto:4.22-support

Conversation

@kyoto
Copy link
Copy Markdown
Member

@kyoto kyoto commented Apr 13, 2026

Summary by CodeRabbit

  • Refactor

    • Modernized modal dialogs to use standard header/body primitives and removed the legacy modal wrapper and close-button component.
    • Standardized modal button behavior to prevent accidental form submissions.
  • Bug Fixes

    • Removed a redundant "Close" localization entry and corrected an argument placeholder in a tool-rejection message.
  • Chores

    • Upgraded React, router, i18n and related types; switched JSX transform to the automatic runtime.
    • Updated CI cluster version selection.

@kyoto kyoto added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 13, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 13, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 13, 2026

@kyoto: This pull request references OLS-2770 which is a valid jira issue.

Details

In response to this:

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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 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
📝 Walkthrough

Walkthrough

Replaced a local Modal implementation with PatternFly Modal primitives across multiple components, removed the custom CloseButton and a Close i18n key, adjusted a tool-rejection i18n placeholder index, upgraded dependencies (including React 17→18 and router), switched several hooks to useUserPreference, and changed TS JSX emit.

Changes

Cohort / File(s) Summary
Modal Migration to PatternFly
src/components/AttachEventsModal.tsx, src/components/AttachLogModal.tsx, src/components/AttachmentModal.tsx, src/components/NewChatModal.tsx, src/components/ResponseToolModal.tsx
Replaced local Modal with @patternfly/react-core Modal, ModalHeader, ModalBody; moved titles into ModalHeader, wrapped content in ModalBody, added variant props, adjusted nesting and button type semantics.
Removed Local Modal & Close Button
src/components/Modal.tsx, src/components/CloseButton.tsx
Deleted custom Modal component and CloseButton file (default exports removed).
i18n Key & Placeholder Update
locales/en/plugin__lightspeed-console-plugin.json
Removed the "Close" translation key; updated tool-rejection message placeholder index from <3>{{argsFormatted}}</3> to <4>{{argsFormatted}}</4>.
Dependency & TS Config Updates
package.json, tsconfig.json
Bumped runtime deps (React → 18.x, react-dom, react-i18next, react-redux, @openshift-console/dynamic-plugin-sdk prerelease, added i18next, replaced react-router-dom-v5-compat with react-router); switched compilerOptions.jsx to react-jsx; removed React/ReactDOM overrides.
Router / Location Imports & Logic
src/components/ImportAction.tsx, src/hooks/useLocationContext.ts
Switched useLocation/useNavigate imports to react-router; in useLocationContext renamed modelsk8sModels, added modelsRef and effect to avoid subscribing models in main effect.
Preference Hook Adjustments
src/hooks/useFirstTimeUser.ts, src/hooks/useHideLightspeed.ts, src/hooks/useIsDarkTheme.ts
Replaced useUserSettings with useUserPreference for preference reads/updates; preserved keys, defaults, return shapes and behavior.
Type / TS Suppression & Typing Tweaks
src/components/GeneralPage.tsx, src/components/Prompt.tsx, src/hooks/useToolUIMapping.ts, src/error.ts
Removed @ts-expect-error comments, tightened callback typing, switched TFunction import to i18next, updated ToolUIExtension type to use Extension<'ols.tool-ui', ...>.
CI Tekton Version Bump
.tekton/integration-tests/lightspeed-console-pre-commit.yaml
Updated cluster OpenShift version prefix from 4.19. to 4.22. in pick-version step.
Miscellaneous Small Edits
src/components/* (various)
Minor layout/typing tweaks, relocation of descriptive text into Content component="p", removal of unused icon imports, and button-type fixes across modal components.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 I hopped through headers, bodies bright,
Swapped old modals for PatternFly light,
A Close key vanished in the night,
Preferences moved and routers right,
I twitched my nose—dependencies took flight.

🚥 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 clearly and concisely identifies the primary purpose of the PR: adding OCP 4.22 support, which aligns with the major dependency upgrades and CI configuration changes throughout the changeset.
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

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

@openshift-ci openshift-ci Bot requested review from syedriko and xrajesh April 13, 2026 07:09
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 13, 2026

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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:

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

1 similar comment
@openshift-ci
Copy link
Copy Markdown

openshift-ci Bot commented Apr 13, 2026

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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:

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

@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 13, 2026

@kyoto: This pull request references OLS-2770 which is a valid jira issue.

Details

In response to this:

Summary by CodeRabbit

  • Refactor

  • Modernized modal dialogs to use PatternFly design components for improved consistency and accessibility.

  • Upgraded React from v17 to v18 and modernized related dependencies (react-router, react-redux, react-i18next).

  • Updated routing to use modern React Router APIs.

  • Chores

  • Improved TypeScript configuration and type safety throughout the codebase.

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.

Copy link
Copy Markdown

@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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
package.json (1)

24-38: ⚠️ Potential issue | 🟠 Major

Add i18next as a direct runtime dependency.

src/error.ts imports TFunction from i18next directly, but package.json does not declare i18next. Relying on a peer/transitive install is brittle and can break clean installs or stricter package managers. Add i18next as an explicit dependency at a version compatible with react-i18next (currently 16.5.8).

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

In `@package.json` around lines 24 - 38, package.json is missing i18next even
though src/error.ts imports TFunction from i18next; add i18next as a direct
runtime dependency in package.json (use a version compatible with
react-i18next@16.5.8) so the import in src/error.ts (TFunction) is satisfied and
installs reliably rather than relying on a transitive/peer dependency.
🤖 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/AttachEventsModal.tsx`:
- Around line 180-185: The Cancel button is incorrectly using type="submit"
which can trigger form submission; update the Button component for Cancel (the
one with onClick={onClose} inside ActionGroup in AttachEventsModal) to use
type="button" instead of "submit" so clicking Cancel invokes onClose without
submitting the form; ensure the primary Attach button remains type="submit" and
nothing else changes (references: ActionGroup, Button with onClick={onClose},
onClose, onSubmit, numEvents).

In `@src/components/AttachLogModal.tsx`:
- Around line 487-488: The Cancel button in AttachLogModal is currently rendered
with type="submit" which will trigger form submission; change the Button element
that displays {t('Cancel')} to use type="button" instead so clicking it only
calls onClose and does not submit the form (look for the Button with
onClick={onClose}, {t('Cancel')} and update its type prop).

In `@src/components/AttachmentModal.tsx`:
- Around line 173-190: In AttachmentModal.tsx change the Button elements that
currently have type="submit" but are handled via click callbacks to use
type="button" instead; specifically update the Button rendering the Save action
(onSave) and the Button rendering the Edit action (setEditing) so they use
type="button" to avoid native form submission when the surrounding <Form> has no
submit handler; keep other buttons (e.g., Cancel) as-is.

In `@src/hooks/useLocationContext.ts`:
- Around line 15-19: The parsing useEffect in useLocationContext currently
replaces k8sModels with modelsRef (React.useRef) and thus drops model updates
from the effect dependencies; restore a stable representation of the model set
into the effect deps so re-parse runs when models meaningfully change (e.g.,
derive a stable key from k8sModels such as a sorted concatenation or JSON of
model identifiers/UIDs, or setState a version counter when k8sModels changes)
and include that key/version in the useEffect dependency array alongside
path/search; update references to modelsRef.current inside the effect as needed
so the effect re-runs when the model-set key changes while still avoiding
unstable object identity.

---

Outside diff comments:
In `@package.json`:
- Around line 24-38: package.json is missing i18next even though src/error.ts
imports TFunction from i18next; add i18next as a direct runtime dependency in
package.json (use a version compatible with react-i18next@16.5.8) so the import
in src/error.ts (TFunction) is satisfied and installs reliably rather than
relying on a transitive/peer dependency.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 91b5bc71-6e34-45b4-8196-ba4c221c4b28

📥 Commits

Reviewing files that changed from the base of the PR and between 3d81ca1 and e8f83ec.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (19)
  • locales/en/plugin__lightspeed-console-plugin.json
  • package.json
  • src/components/AttachEventsModal.tsx
  • src/components/AttachLogModal.tsx
  • src/components/AttachmentModal.tsx
  • src/components/CloseButton.tsx
  • src/components/GeneralPage.tsx
  • src/components/ImportAction.tsx
  • src/components/Modal.tsx
  • src/components/NewChatModal.tsx
  • src/components/Prompt.tsx
  • src/components/ResponseToolModal.tsx
  • src/error.ts
  • src/hooks/useFirstTimeUser.ts
  • src/hooks/useHideLightspeed.ts
  • src/hooks/useIsDarkTheme.ts
  • src/hooks/useLocationContext.ts
  • src/hooks/useToolUIMapping.ts
  • tsconfig.json
💤 Files with no reviewable changes (4)
  • src/components/Prompt.tsx
  • src/components/CloseButton.tsx
  • src/components/Modal.tsx
  • locales/en/plugin__lightspeed-console-plugin.json

Comment thread src/components/AttachEventsModal.tsx
Comment thread src/components/AttachLogModal.tsx Outdated
Comment thread src/components/AttachmentModal.tsx
Comment thread src/hooks/useLocationContext.ts
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 14, 2026

@kyoto: This pull request references OLS-2770 which is a valid jira issue.

Details

In response to this:

Summary by CodeRabbit

  • Refactor

  • Modernized modal dialogs to use PatternFly header/body primitives for more consistent layout and accessibility.

  • Standardized modal button behavior to prevent accidental form submissions (Cancel/secondary buttons no longer submit).

  • Updated routing and React-related libraries to modern versions (React 18 and modern router APIs).

  • Bug Fixes

  • Small localization cleanup (redundant "Close" entry removed).

  • Chores

  • Updated TypeScript JSX handling and dependency/type adjustments.

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-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 14, 2026

@kyoto: This pull request references OLS-2770 which is a valid jira issue.

Details

In response to this:

Summary by CodeRabbit

  • Refactor

  • Modernized modal dialogs to use standard header/body primitives for clearer structure and accessibility.

  • Standardized modal button behavior to prevent accidental form submissions (Cancel/secondary buttons no longer submit).

  • Updated routing hooks and React integration to align with modern React and router APIs.

  • Bug Fixes

  • Removed a redundant "Close" localization entry.

  • Chores

  • Upgraded React, routing, i18n, and related types; switched JSX compilation to the automatic transform; updated CI cluster version selection.

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.

@jgbernalp
Copy link
Copy Markdown

/retest-required

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 15, 2026
@JoaoFula
Copy link
Copy Markdown
Contributor

/retest

@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 16, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 16, 2026

@kyoto: This pull request references OLS-2770 which is a valid jira issue.

Details

In response to this:

Summary by CodeRabbit

  • Refactor

  • Modernized modal dialogs to use standard header/body primitives for clearer structure and accessibility.

  • Standardized modal button behavior to prevent accidental form submissions (Cancel/secondary buttons no longer submit).

  • Updated routing and React hook usage to align with newer React and router APIs.

  • Bug Fixes

  • Removed a redundant "Close" localization entry.

  • Chores

  • Upgraded React, routing, i18n, related types, and switched JSX compilation to the automatic transform.

  • Updated CI cluster version selection.

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.

Copy link
Copy Markdown

@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 (1)
package.json (1)

32-32: Consider exact-pinning i18next for consistency with other core dependencies.

react-i18next is exact-pinned to 16.5.8, while i18next uses a caret range. Aligning them would improve consistency across core runtime dependencies.

Suggested diff
-    "i18next": "^26.0.4",
+    "i18next": "26.0.4",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 32, Change the i18next dependency from a caret range to
an exact pin to match how react-i18next is pinned: update the "i18next" entry in
package.json from "^26.0.4" to the exact version string "26.0.4" (no leading ^)
so core runtime dependencies use consistent exact versions alongside
"react-i18next".
🤖 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/GeneralPage.tsx`:
- Line 505: Update the Prompt prop type to match the new scrollIntoView
signature: change PromptProps' scrollIntoView from () => void to (behavior?:
ScrollBehavior) => void (or React.Dispatch-like signature accepting an optional
ScrollBehavior) so it accepts an optional parameter; update the Prompt
component's prop type declaration in Prompt.tsx (the PromptProps interface/type
around line ~106) and any places that forward or call scrollIntoView to use the
optional parameter signature (calls can still omit the argument).

---

Nitpick comments:
In `@package.json`:
- Line 32: Change the i18next dependency from a caret range to an exact pin to
match how react-i18next is pinned: update the "i18next" entry in package.json
from "^26.0.4" to the exact version string "26.0.4" (no leading ^) so core
runtime dependencies use consistent exact versions alongside "react-i18next".
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bdd08335-6bc5-4a9c-afe8-8e51392c9ecc

📥 Commits

Reviewing files that changed from the base of the PR and between de414bd and 6a036a1.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (20)
  • .tekton/integration-tests/lightspeed-console-pre-commit.yaml
  • locales/en/plugin__lightspeed-console-plugin.json
  • package.json
  • src/components/AttachEventsModal.tsx
  • src/components/AttachLogModal.tsx
  • src/components/AttachmentModal.tsx
  • src/components/CloseButton.tsx
  • src/components/GeneralPage.tsx
  • src/components/ImportAction.tsx
  • src/components/Modal.tsx
  • src/components/NewChatModal.tsx
  • src/components/Prompt.tsx
  • src/components/ResponseToolModal.tsx
  • src/error.ts
  • src/hooks/useFirstTimeUser.ts
  • src/hooks/useHideLightspeed.ts
  • src/hooks/useIsDarkTheme.ts
  • src/hooks/useLocationContext.ts
  • src/hooks/useToolUIMapping.ts
  • tsconfig.json
💤 Files with no reviewable changes (4)
  • src/components/Prompt.tsx
  • locales/en/plugin__lightspeed-console-plugin.json
  • src/components/CloseButton.tsx
  • src/components/Modal.tsx
✅ Files skipped from review due to trivial changes (7)
  • .tekton/integration-tests/lightspeed-console-pre-commit.yaml
  • src/components/ImportAction.tsx
  • tsconfig.json
  • src/error.ts
  • src/components/AttachEventsModal.tsx
  • src/components/NewChatModal.tsx
  • src/hooks/useToolUIMapping.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/hooks/useHideLightspeed.ts
  • src/hooks/useLocationContext.ts
  • src/hooks/useIsDarkTheme.ts
  • src/hooks/useFirstTimeUser.ts

Comment thread src/components/GeneralPage.tsx
@JoaoFula
Copy link
Copy Markdown
Contributor

yeah, 4.22 is going to fail for the time being as discussed with @kyoto . Will check for health of 4.22 cluster pools in prow since there's a chance to leverage those. EaaS (process currently used in konflux) only supports to 4.19 or 4.20 (can't remember rn)

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 17, 2026
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 17, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 17, 2026

@kyoto: This pull request references OLS-2770 which is a valid jira issue.

Details

In response to this:

Summary by CodeRabbit

  • Refactor

  • Modernized modal dialogs to use standard header/body primitives and removed the legacy modal wrapper and close-button component.

  • Standardized modal button behavior to prevent accidental form submissions.

  • Bug Fixes

  • Removed a redundant "Close" localization entry and corrected an argument placeholder in a tool-rejection message.

  • Chores

  • Upgraded React, router, i18n and related types; switched JSX transform to the automatic runtime.

  • Updated CI cluster version selection.

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.

Copy link
Copy Markdown

@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

🤖 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/AttachmentModal.tsx`:
- Around line 197-205: The conditional that shows the Revert button uses a falsy
check on attachment?.originalValue so empty-string originals ('') hide the
button; change the predicate in the AttachmentModal render (the block that
references attachment?.originalValue, attachment.originalValue !==
attachment.value, and onRevert) to explicitly test for null/undefined instead of
truthiness (e.g., use attachment?.originalValue != null &&
attachment.originalValue !== attachment.value) so empty strings still allow the
Revert button to render when values differ.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c30c4ac-bfa1-406c-a4f6-25547c2726c8

📥 Commits

Reviewing files that changed from the base of the PR and between 6a036a1 and 612b560.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (20)
  • .tekton/integration-tests/lightspeed-console-pre-commit.yaml
  • locales/en/plugin__lightspeed-console-plugin.json
  • package.json
  • src/components/AttachEventsModal.tsx
  • src/components/AttachLogModal.tsx
  • src/components/AttachmentModal.tsx
  • src/components/CloseButton.tsx
  • src/components/GeneralPage.tsx
  • src/components/ImportAction.tsx
  • src/components/Modal.tsx
  • src/components/NewChatModal.tsx
  • src/components/Prompt.tsx
  • src/components/ResponseToolModal.tsx
  • src/error.ts
  • src/hooks/useFirstTimeUser.ts
  • src/hooks/useHideLightspeed.ts
  • src/hooks/useIsDarkTheme.ts
  • src/hooks/useLocationContext.ts
  • src/hooks/useToolUIMapping.ts
  • tsconfig.json
💤 Files with no reviewable changes (3)
  • src/components/Prompt.tsx
  • src/components/CloseButton.tsx
  • src/components/Modal.tsx
✅ Files skipped from review due to trivial changes (4)
  • src/error.ts
  • tsconfig.json
  • src/components/AttachEventsModal.tsx
  • src/components/ResponseToolModal.tsx
🚧 Files skipped from review as they are similar to previous changes (10)
  • src/hooks/useHideLightspeed.ts
  • src/hooks/useToolUIMapping.ts
  • src/components/ImportAction.tsx
  • src/hooks/useIsDarkTheme.ts
  • .tekton/integration-tests/lightspeed-console-pre-commit.yaml
  • src/components/NewChatModal.tsx
  • locales/en/plugin__lightspeed-console-plugin.json
  • src/components/AttachLogModal.tsx
  • src/hooks/useFirstTimeUser.ts
  • src/hooks/useLocationContext.ts

Comment on lines +197 to +205
{attachment?.originalValue && attachment.originalValue !== attachment.value && (
<SplitItem>
<ActionGroup>
<Button icon={<UndoIcon />} isDanger onClick={onRevert} variant="link">
{t('Revert to original')}
</Button>
</ActionGroup>
</SplitItem>
)}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Revert action can disappear incorrectly for empty-string originals.

Line 197 uses a truthy check on attachment?.originalValue. If the original value is '', the Revert button is hidden even when current value differs.

🔧 Proposed fix
-              {attachment?.originalValue && attachment.originalValue !== attachment.value && (
+              {attachment?.originalValue !== undefined &&
+                attachment.originalValue !== attachment.value && (
                 <SplitItem>
                   <ActionGroup>
                     <Button icon={<UndoIcon />} isDanger onClick={onRevert} variant="link">
                       {t('Revert to original')}
                     </Button>
                   </ActionGroup>
                 </SplitItem>
               )}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{attachment?.originalValue && attachment.originalValue !== attachment.value && (
<SplitItem>
<ActionGroup>
<Button icon={<UndoIcon />} isDanger onClick={onRevert} variant="link">
{t('Revert to original')}
</Button>
</ActionGroup>
</SplitItem>
)}
{attachment?.originalValue !== undefined &&
attachment.originalValue !== attachment.value && (
<SplitItem>
<ActionGroup>
<Button icon={<UndoIcon />} isDanger onClick={onRevert} variant="link">
{t('Revert to original')}
</Button>
</ActionGroup>
</SplitItem>
)}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/AttachmentModal.tsx` around lines 197 - 205, The conditional
that shows the Revert button uses a falsy check on attachment?.originalValue so
empty-string originals ('') hide the button; change the predicate in the
AttachmentModal render (the block that references attachment?.originalValue,
attachment.originalValue !== attachment.value, and onRevert) to explicitly test
for null/undefined instead of truthiness (e.g., use attachment?.originalValue !=
null && attachment.originalValue !== attachment.value) so empty strings still
allow the Revert button to render when values differ.

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 18, 2026
kyoto added 3 commits April 20, 2026 09:46
Also fixes some type errors resulting from the package upgrdes
This has been renamed in the latest version of the plugin SDK
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants