Skip to content

CNV-89816: Cancel all pending uploads when VM creation is canceled or VM is deleted#4077

Open
galkremer1 wants to merge 1 commit into
kubevirt-ui:mainfrom
galkremer1:CNV-89816-abort-pending-uploads
Open

CNV-89816: Cancel all pending uploads when VM creation is canceled or VM is deleted#4077
galkremer1 wants to merge 1 commit into
kubevirt-ui:mainfrom
galkremer1:CNV-89816-abort-pending-uploads

Conversation

@galkremer1

@galkremer1 galkremer1 commented Jun 16, 2026

Copy link
Copy Markdown
Member

📝 Description

When a user cancels or navigates away from the VM creation wizard, or deletes an existing VM, all in-flight uploads (CD-ROM ISO, disk) associated with that VM should be automatically canceled.

🔗 Links

Jira ticket: CNV-89816

🎥 Demo

Demo.mov

Summary by CodeRabbit

  • New Features
    • Added bulk cancellation of pending VM uploads when the VM creation wizard is reset/closed.
    • Added VM-scoped cancellation for in-progress disk/CD-ROM uploads, avoiding interruption of unrelated uploads.
  • Bug Fixes
    • Improved upload progress toasts by removing stale entries and warning when uploads were aborted.
    • Fixed VM disk/CD-ROM upload key/cluster selection for legacy (empty-cluster) VMs and ensured context/success links are only shown when VM identity is available.
    • Enhanced cancellation robustness during VM deletion with safer fallbacks.

@openshift-ci-robot

openshift-ci-robot commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

@galkremer1: This pull request references CNV-89816 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 sub-task to target either version "5.0." or "openshift-5.0.", but it targets "CNV v4.23.0" instead.

Details

In response to this:

📝 Description

When a user cancels or navigates away from the VM creation wizard, or deletes an existing VM, all in-flight uploads (CD-ROM ISO, disk) associated with that VM should be automatically canceled.

🔗 Links

Jira ticket: CNV-89816

🎥 Demo

Demo.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 requested a review from adamviktora June 16, 2026 14:12
@openshift-ci

openshift-ci Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: galkremer1

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 openshift-ci Bot requested a review from Pedro-S-Abreu June 16, 2026 14:12
@openshift-ci openshift-ci Bot added the approved This issue is something we want to fix label Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Extends the upload progress store with VM-scoped and bulk cancellation actions, introducing helpers to match uploads by VM scope and cancel them on deletion or wizard reset. Upload key derivation gains cluster normalization for empty-cluster VMs, upload success/context links are gated on VM UID presence, and a new cleanup utility removes stale toast notifications for disappeared uploads.

Changes

VM Upload Cancellation Lifecycle

Layer / File(s) Summary
Upload key helpers and cluster normalization
src/utils/hooks/useUploadProgressToast/utils/uploadKeys.ts, src/utils/hooks/useUploadProgressToast/utils/uploadKeys.test.ts, src/utils/resources/template/utils/processOpenShiftTemplate.ts
Introduces getUploadClusterForVm with empty-string fallback for unset clusters, isVmScopedUploadKey for matching VM-scoped keys, and collectVmScopedUploadKeys for filtering uploads by VM scope; updates cdrom key derivation to use normalized cluster; processOpenShiftTemplate conditionally stamps cluster onto returned VM objects.
Store types, bulk cancellation, and wiring
src/utils/hooks/useUploadProgressToast/utils/types.ts, src/utils/hooks/useUploadProgressToast/utils/cancelUpload.ts, src/utils/hooks/useUploadProgressToast/uploadProgressStore.ts, src/utils/hooks/useUploadProgressToast/uploadProgressStore.test.ts
Extends UploadProgressStoreState with cancelAllPendingUploads and cancelUploadsForVm async methods; reworks performCancelTrackedUpload with optional removeAfterCancel flag and PVC fallback on cancellation failure; adds performCancelTrackedUploads for concurrent bulk cancellation, performCancelUploadsForVm for VM-scoped filtering, and performCancelAllPendingUploads for store-wide cleanup; wires into Zustand store; includes comprehensive integration tests.
Public cancel helpers for components
src/utils/hooks/useUploadProgressToast/utils/cancelPendingVmUploads.ts, src/utils/hooks/useUploadProgressToast/utils/cancelPendingVmUploads.test.ts
Introduces cancelPendingVmUploads which resolves target VM from optional argument or vmSignal.value, validates namespace/name identity, and delegates to store's cancelUploadsForVm; adds cancelAllWizardPendingUploads to trigger store's cancelAllPendingUploads; both exported with Jest coverage.
Toast cleanup for removed uploads
src/utils/hooks/useUploadProgressToast/utils/cleanupRemovedUploads.ts, src/utils/hooks/useUploadProgressToast/UploadProgressToastListener.tsx
Adds cleanupRemovedUploads utility to diff previous and current upload maps, remove stale toast entries for disappeared uploads, and emit i18n warning toasts for aborted uploads; integrates into UploadProgressToastListener via a useRef-tracked previous state.
Upload track metadata builder and form refactor
src/utils/components/DiskModal/utils/helpers.ts, src/utils/components/DiskModal/utils/types.ts, src/utils/components/DiskModal/utils/submit.ts
Extracts inline uploadTrackMetadata construction from uploadDataVolume into a new buildUploadTrackMetadata helper; helper conditionally returns undefined when required inputs are missing, otherwise builds CdiUploadTrackMetadata gated on VM UID presence for success links; standardizes parameter shape via BuildUploadTrackMetadataParams type.
UID-gated success links and cluster normalization in modal
src/utils/hooks/useUploadProgressToast/utils/uploadCompletion.ts, src/utils/components/DiskModal/UploadDiskModal.tsx
Gates successLinks in completeVmDiskUpload and completeVmCdromUpload on getUID(vm) presence; UploadDiskModal replaces getCluster(vm) with getUploadClusterForVm(vm) for both modal-close cancellation and form submission upload key computation.
VM deletion and wizard integration
src/views/virtualmachines/actions/actions.ts, src/views/virtualmachines/actions/components/DeleteVMModal/utils/deleteVM.ts, src/views/virtualmachines/creation-wizard/state/vm-wizard-store/useVMWizardStore.ts
Calls cancelPendingVmUploads(vm) in both deleteVM and deleteVMWithResources before Kubernetes operations, with error logging in try/catch blocks; calls cancelAllWizardPendingUploads() in resetWizardState before clearing wizard-related stores.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • kubevirt-ui/kubevirt-plugin#3434: Both PRs modify deleteVMWithResources in src/views/virtualmachines/actions/components/DeleteVMModal/utils/deleteVM.ts — this PR adds cancelPendingVmUploads at the start of deletion, the retrieved PR refactors the same deletion flow for sharable disk support.
  • kubevirt-ui/kubevirt-plugin#3944: Both PRs modify processOpenShiftTemplate in src/utils/resources/template/utils/processOpenShiftTemplate.ts — this PR adjusts how virtualMachine.cluster is conditionally set, the retrieved PR adds optional vmName/NAME parameter injection.
  • kubevirt-ui/kubevirt-plugin#4062: Both PRs are related to VM-scoped CDI upload tracking — this PR extends upload cancellation actions and cluster normalization, building directly on the retrieved PR's upload-progress toast store and modal cancel utilities.

Suggested labels

lgtm

Suggested reviewers

  • metalice
  • benbassatido
  • lkladnit
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely summarizes the main change: canceling all pending uploads when VM creation is canceled or VM is deleted, with proper Jira ticket ID prefix.
Description check ✅ Passed The PR description adequately covers the main objective, includes a Jira ticket link, and provides a demo video, meeting the template requirements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

@github-actions

Copy link
Copy Markdown
Contributor

Jira Validation Passed

CNV-89816

Check Status Details
Story Points Story points: 2
Fix Version Fix version matches target branch main (expected: 4.23)
Component Component "CNV User Interface" is set
Activity Type Activity Type is set

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/utils/hooks/useUploadProgressToast/uploadProgressStore.test.ts`:
- Around line 351-385: The test for cancelAllPendingUploads only validates the
success path where all cancelUpload callbacks resolve. Add a new test case
within the same describe block that sets up at least one upload with a
cancelUpload callback that rejects or throws an error, then call
cancelAllPendingUploads() and assert the entry is not silently dropped.
Explicitly verify the intended fallback or retention behavior when a
cancellation fails, ensuring this failure scenario is properly handled and
documented as a regression test.

In `@src/utils/hooks/useUploadProgressToast/utils/cancelUpload.ts`:
- Around line 26-28: The removeUpload call in the cancelUpload function is
executed immediately after initiating cancellation, but before confirming that
the cancellation actually succeeded. This creates a race condition where the
upload entry is removed from the store while the cancellation request is still
in flight, causing loss of visibility if the cancellation fails. Move the
get().removeUpload(uploadKey) call to execute only after the cancellation
operation completes successfully, ensuring the upload remains trackable if the
cancellation fails. Apply this same fix at the other occurrence in the file
around lines 66-68 where this pattern also exists.
🪄 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: Enterprise

Run ID: 37527289-3317-453f-b030-2285c79fc8bd

📥 Commits

Reviewing files that changed from the base of the PR and between 3d579c1 and 5cd9dee.

⛔ Files ignored due to path filters (6)
  • locales/en/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/es/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/fr/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/ja/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/ko/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/zh/plugin__kubevirt-plugin.json is excluded by !locales/**
📒 Files selected for processing (17)
  • src/utils/components/DiskModal/UploadDiskModal.tsx
  • src/utils/components/DiskModal/utils/submit.ts
  • src/utils/hooks/useUploadProgressToast/UploadProgressToastListener.tsx
  • src/utils/hooks/useUploadProgressToast/uploadProgressStore.test.ts
  • src/utils/hooks/useUploadProgressToast/uploadProgressStore.ts
  • src/utils/hooks/useUploadProgressToast/utils/cancelPendingVmUploads.test.ts
  • src/utils/hooks/useUploadProgressToast/utils/cancelPendingVmUploads.ts
  • src/utils/hooks/useUploadProgressToast/utils/cancelUpload.ts
  • src/utils/hooks/useUploadProgressToast/utils/cleanupRemovedUploads.ts
  • src/utils/hooks/useUploadProgressToast/utils/types.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadCompletion.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadKeys.test.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadKeys.ts
  • src/utils/resources/template/utils/processOpenShiftTemplate.ts
  • src/views/virtualmachines/actions/actions.ts
  • src/views/virtualmachines/actions/components/DeleteVMModal/utils/deleteVM.ts
  • src/views/virtualmachines/creation-wizard/state/vm-wizard-store/useVMWizardStore.ts

Comment thread src/utils/hooks/useUploadProgressToast/uploadProgressStore.test.ts
Comment thread src/utils/hooks/useUploadProgressToast/utils/cancelUpload.ts Outdated
@galkremer1 galkremer1 force-pushed the CNV-89816-abort-pending-uploads branch from 5cd9dee to d552f41 Compare June 16, 2026 14:36

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/views/virtualmachines/actions/components/DeleteVMModal/utils/deleteVM.ts`:
- Line 36: The cancelPendingVmUploads function call is not being awaited, which
can cause race conditions where the delete proceeds before upload cancellation
completes. Add await before the cancelPendingVmUploads(vm) invocation to ensure
it finishes before continuing, and wrap it in a try-catch block to handle any
errors that may occur during cancellation rather than silently swallowing them.
Log any caught errors with meaningful context to aid debugging.
🪄 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: Enterprise

Run ID: ecf25837-e541-463f-9d2f-2cbb55f95b00

📥 Commits

Reviewing files that changed from the base of the PR and between 5cd9dee and d552f41.

⛔ Files ignored due to path filters (6)
  • locales/en/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/es/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/fr/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/ja/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/ko/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/zh/plugin__kubevirt-plugin.json is excluded by !locales/**
📒 Files selected for processing (17)
  • src/utils/components/DiskModal/UploadDiskModal.tsx
  • src/utils/components/DiskModal/utils/submit.ts
  • src/utils/hooks/useUploadProgressToast/UploadProgressToastListener.tsx
  • src/utils/hooks/useUploadProgressToast/uploadProgressStore.test.ts
  • src/utils/hooks/useUploadProgressToast/uploadProgressStore.ts
  • src/utils/hooks/useUploadProgressToast/utils/cancelPendingVmUploads.test.ts
  • src/utils/hooks/useUploadProgressToast/utils/cancelPendingVmUploads.ts
  • src/utils/hooks/useUploadProgressToast/utils/cancelUpload.ts
  • src/utils/hooks/useUploadProgressToast/utils/cleanupRemovedUploads.ts
  • src/utils/hooks/useUploadProgressToast/utils/types.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadCompletion.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadKeys.test.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadKeys.ts
  • src/utils/resources/template/utils/processOpenShiftTemplate.ts
  • src/views/virtualmachines/actions/actions.ts
  • src/views/virtualmachines/actions/components/DeleteVMModal/utils/deleteVM.ts
  • src/views/virtualmachines/creation-wizard/state/vm-wizard-store/useVMWizardStore.ts
🚧 Files skipped from review as they are similar to previous changes (14)
  • src/utils/components/DiskModal/utils/submit.ts
  • src/utils/hooks/useUploadProgressToast/utils/cleanupRemovedUploads.ts
  • src/utils/components/DiskModal/UploadDiskModal.tsx
  • src/utils/resources/template/utils/processOpenShiftTemplate.ts
  • src/utils/hooks/useUploadProgressToast/utils/types.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadKeys.test.ts
  • src/views/virtualmachines/creation-wizard/state/vm-wizard-store/useVMWizardStore.ts
  • src/utils/hooks/useUploadProgressToast/utils/cancelPendingVmUploads.test.ts
  • src/utils/hooks/useUploadProgressToast/UploadProgressToastListener.tsx
  • src/utils/hooks/useUploadProgressToast/utils/cancelPendingVmUploads.ts
  • src/views/virtualmachines/actions/actions.ts
  • src/utils/hooks/useUploadProgressToast/utils/cancelUpload.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadKeys.ts
  • src/utils/hooks/useUploadProgressToast/uploadProgressStore.test.ts

Comment thread src/views/virtualmachines/actions/components/DeleteVMModal/utils/deleteVM.ts Outdated
@galkremer1 galkremer1 force-pushed the CNV-89816-abort-pending-uploads branch from d552f41 to 5fcd9ed Compare June 16, 2026 14:47
@github-actions

Copy link
Copy Markdown
Contributor

CI Triage (auto-retest 1/5 for 5fcd9ed)

Classification: Infrastructure failure
Failed job(s): pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws

Log excerpt (infrastructure pattern matched)
level=error msg=failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: infrastructure was not ready within 15m0s
---

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066903109799514112/build-log.txt" | tail -300

Length of output: 19984



The failure is an infrastructure/environment flake, not a code issue. The setup step failed because the Playwright test could not complete the login flow on the ephemeral CI cluster (ci-op-xy5746mz-a8c7e.cnv-ci.syseng.devcluster.openshift.com):

  • Attempt 1: locator('[data-test="user-dropdown-toggle"]') was not found after navigating to the OpenShift console — the cluster console did not finish rendering the authenticated session within 60 seconds.
  • Retry #1: Navigation to the Settings page timed out (getByText('Configure features') not visible within 30 seconds).
  • As a result, all 38 downstream tests were skipped.

None of this is related to the code changes in this PR. This is a transient CI cluster readiness issue.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066934379787063296/build-log.txt" | tail -400

Length of output: 13014



This is another CI infrastructure flake, unrelated to the code changes in this PR. The failure root cause is:

  • RELEASE_IMAGE_LATEST: unbound variable — The kubevirt-e2e-aws-ipi-conf pre-step failed after only 12 seconds because the CI system did not inject the RELEASE_IMAGE_LATEST environment variable into the pod. This is a CI platform-level issue.
  • All subsequent failures (CLUSTER_PROFILE_DIR: unbound variable in deprovision steps) are cascading consequences — since the cluster was never provisioned, the cluster profile directory never existed.
  • The actual E2E test suite never ran at all. Total job runtime was only 7m32s.

None of this is related to the PR's code changes.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066936583629574144/build-log.txt" | tail -400

Length of output: 13468



This is the same CI infrastructure flake as the previous attempt — unrelated to the PR's code changes.

  • Root cause: The kubevirt-e2e-aws-ipi-conf pre-step failed after only 16 seconds because the CI platform did not inject the RELEASE_IMAGE_LATEST environment variable into the pod (/bin/bash: line 12: RELEASE_IMAGE_LATEST: unbound variable).
  • Cascading failures: Since the cluster was never provisioned, all deprovision/cleanup steps also failed with CLUSTER_PROFILE_DIR: unbound variable.
  • E2E tests: Never ran at all. Total job runtime was only 3m36s.

This is a CI platform-level environment injection issue, not a code problem.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066937873285779456/build-log.txt" | tail -400

Length of output: 13468



This is the same CI infrastructure flake as the two previous attempts — unrelated to the PR's code changes.

  • Root cause: The kubevirt-e2e-aws-ipi-conf pre-step failed after only 8 seconds because the CI platform did not inject the RELEASE_IMAGE_LATEST environment variable into the pod (/bin/bash: line 12: RELEASE_IMAGE_LATEST: unbound variable).
  • Cascading failures: Since the cluster was never provisioned, all deprovision/cleanup steps also failed with CLUSTER_PROFILE_DIR: unbound variable.
  • E2E tests: Never ran at all. Total job runtime was only 5m11s.

This is a CI platform-level environment injection issue, not a code problem.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066939639901458432/build-log.txt" | tail -400

Length of output: 13465



This is the same CI infrastructure flake as the four previous attempts — unrelated to the PR's code changes.

  • Root cause: The kubevirt-e2e-aws-ipi-conf pre-step failed after only 8 seconds because the CI platform did not inject the RELEASE_IMAGE_LATEST environment variable into the pod (/bin/bash: line 12: RELEASE_IMAGE_LATEST: unbound variable).
  • Cascading failures: Since the cluster was never provisioned, all deprovision/cleanup steps also failed with CLUSTER_PROFILE_DIR: unbound variable.
  • E2E tests: Never ran at all. Total job runtime was only 2m51s.

This is a CI platform-level environment injection issue, not a code problem.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066940722820419584/build-log.txt" | tail -400

Length of output: 13464



This is the same CI infrastructure flake as the five previous attempts — unrelated to the PR's code changes.

  • Root cause: The kubevirt-e2e-aws-ipi-conf pre-step failed after only 8 seconds because the CI platform did not inject the RELEASE_IMAGE_LATEST environment variable into the pod (/bin/bash: line 12: RELEASE_IMAGE_LATEST: unbound variable).
  • Cascading failures: Since the cluster was never provisioned, all deprovision/cleanup steps also failed with CLUSTER_PROFILE_DIR: unbound variable.
  • E2E tests: Never ran at all. Total job runtime was only 2m36s.

This is a CI platform-level environment injection issue, not a code problem.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066941742816432128/build-log.txt" | tail -400

Length of output: 13466



This is the same CI infrastructure flake as all previous attempts — unrelated to the PR's code changes.

  • Root cause: The kubevirt-e2e-aws-ipi-conf pre-step failed after only 7 seconds because the CI platform did not inject the RELEASE_IMAGE_LATEST environment variable into the pod (/bin/bash: line 12: RELEASE_IMAGE_LATEST: unbound variable).
  • Cascading failures: Since the cluster was never provisioned, all deprovision/cleanup steps also failed with CLUSTER_PROFILE_DIR: unbound variable.
  • E2E tests: Never ran at all. Total job runtime was only 3m23s.

This is a CI platform-level environment injection issue, not a code problem.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066943005801058304/build-log.txt" | tail -400

Length of output: 14344



This is the same CI infrastructure flake as all previous attempts — unrelated to the PR's code changes.

  • Root cause: The kubevirt-e2e-aws-ipi-conf pre-step failed after only 8 seconds because the CI platform did not inject the RELEASE_IMAGE_LATEST environment variable into the pod (/bin/bash: line 12: RELEASE_IMAGE_LATEST: unbound variable).
  • Cascading failures: Since the cluster was never provisioned, all deprovision/cleanup steps also failed with CLUSTER_PROFILE_DIR: unbound variable.
  • E2E tests: Never ran at all. Total job runtime was only 2m36s.

This is a CI platform-level environment injection issue, not a code problem.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066944130725974016/build-log.txt" | tail -400

Length of output: 14347



This is the same CI infrastructure flake as all previous attempts — unrelated to the PR's code changes.

  • Root cause: The kubevirt-e2e-aws-ipi-conf pre-step failed after only 7 seconds because the CI platform did not inject the RELEASE_IMAGE_LATEST environment variable into the pod (/bin/bash: line 12: RELEASE_IMAGE_LATEST: unbound variable).
  • Cascading failures: Since the cluster was never provisioned, all deprovision/cleanup steps also failed with CLUSTER_PROFILE_DIR: unbound variable.
  • E2E tests: Never ran at all. Total job runtime was only 3m57s.

This is a CI platform-level environment injection issue, not a code problem.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066945410357792768/build-log.txt" | tail -400

Length of output: 14347



This is the same CI infrastructure flake as all previous attempts — unrelated to the PR's code changes.

  • Root cause: The kubevirt-e2e-aws-ipi-conf pre-step failed after only 7 seconds because the CI platform did not inject the RELEASE_IMAGE_LATEST environment variable into the pod (/bin/bash: line 12: RELEASE_IMAGE_LATEST: unbound variable).
  • Cascading failures: Since the cluster was never provisioned, all deprovision/cleanup steps also failed with CLUSTER_PROFILE_DIR: unbound variable.
  • E2E tests: Never ran at all. Total job runtime was only 3m35s.

This is a CI platform-level environment injection issue, not a code problem.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066946624457805824/build-log.txt" | tail -400

Length of output: 14344



This is the same CI infrastructure flake as all previous attempts — unrelated to the PR's code changes.

  • Root cause: The kubevirt-e2e-aws-ipi-conf pre-step failed after only 8 seconds because the CI platform did not inject the RELEASE_IMAGE_LATEST environment variable into the pod (/bin/bash: line 12: RELEASE_IMAGE_LATEST: unbound variable).
  • Cascading failures: Since the cluster was never provisioned, all deprovision/cleanup steps also failed with CLUSTER_PROFILE_DIR: unbound variable.
  • E2E tests: Never ran at all. Total job runtime was only 3m49s.

This is a CI platform-level environment injection issue, not a code problem.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066947965666201600/build-log.txt" | tail -400

Length of output: 14345



This is the same CI infrastructure flake as all previous attempts — unrelated to the PR's code changes.

  • Root cause: The kubevirt-e2e-aws-ipi-conf pre-step failed after only 7 seconds because the CI platform did not inject the RELEASE_IMAGE_LATEST environment variable into the pod (/bin/bash: line 12: RELEASE_IMAGE_LATEST: unbound variable).
  • Cascading failures: Since the cluster was never provisioned, all deprovision/cleanup steps also failed with CLUSTER_PROFILE_DIR: unbound variable.
  • E2E tests: Never ran at all. Total job runtime was only 3m5s.

This is a CI platform-level environment injection issue, not a code problem.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066949021238300672/build-log.txt" | tail -400

Length of output: 14347



This is the same CI infrastructure flake as all previous attempts — unrelated to the PR's code changes.

  • Root cause: The kubevirt-e2e-aws-ipi-conf pre-step failed after only 7 seconds because the CI platform did not inject the RELEASE_IMAGE_LATEST environment variable into the pod (/bin/bash: line 12: RELEASE_IMAGE_LATEST: unbound variable).
  • Cascading failures: Since the cluster was never provisioned, all deprovision/cleanup steps also failed with CLUSTER_PROFILE_DIR: unbound variable.
  • E2E tests: Never ran at all. Total job runtime was only 6m3s.

This is a CI platform-level environment injection issue, not a code problem.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066950806975811584/build-log.txt" | tail -400

Length of output: 14346



This is the same CI infrastructure flake as all previous attempts — unrelated to the PR's code changes.

  • Root cause: The kubevirt-e2e-aws-ipi-conf pre-step failed after only 8 seconds because the CI platform did not inject the RELEASE_IMAGE_LATEST environment variable into the pod (/bin/bash: line 12: RELEASE_IMAGE_LATEST: unbound variable).
  • Cascading failures: Since the cluster was never provisioned, all deprovision/cleanup steps also failed with CLUSTER_PROFILE_DIR: unbound variable.
  • E2E tests: Never ran at all. Total job runtime was only 4m1s.

This is a CI platform-level environment injection issue, not a code problem.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ CI Failure Escalation

Automated regex triage could not classify this failure.

@coderabbitai Please analyze the build logs linked below.
If you determine the root cause is an infrastructure issue, network timeout,
or environment setup flake, please reply with exactly /retest on a new line.
Otherwise, explain the code failure.

Build Logs

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
curl -sL "https://storage.googleapis.com/test-platform-results/pr-logs/pull/kubevirt-ui_kubevirt-plugin/4077/pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws/2066952073127137280/build-log.txt" | tail -400

Length of output: 14345



This is the same CI infrastructure flake as all previous attempts — unrelated to the PR's code changes.

  • Root cause: The kubevirt-e2e-aws-ipi-conf pre-step failed after only 7 seconds because the CI platform did not inject the RELEASE_IMAGE_LATEST environment variable into the pod (/bin/bash: line 12: RELEASE_IMAGE_LATEST: unbound variable).
  • Cascading failures: Since the cluster was never provisioned, all deprovision/cleanup steps also failed with CLUSTER_PROFILE_DIR: unbound variable.
  • E2E tests: Never ran at all. Total job runtime was only 3m31s.

This is a CI platform-level environment injection issue, not a code problem.

/retest

@github-actions

Copy link
Copy Markdown
Contributor

CI Triage (auto-retest 2/5 for 5fcd9ed)

Classification: Infrastructure failure
Failed job(s): pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws

Log excerpt (infrastructure pattern matched)
level=error msg=failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: infrastructure was not ready within 15m0s
---

/retest

@github-actions

Copy link
Copy Markdown
Contributor

CI Triage (auto-retest 3/5 for 5fcd9ed)

Classification: Infrastructure failure
Failed job(s): pull-ci-kubevirt-ui-kubevirt-plugin-main-kubevirt-e2e-aws

Log excerpt (infrastructure pattern matched)
level=error msg=failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: infrastructure was not ready within 15m0s
---

/retest

Comment thread src/utils/components/DiskModal/utils/submit.ts Outdated
@galkremer1 galkremer1 force-pushed the CNV-89816-abort-pending-uploads branch from 5fcd9ed to 8464c95 Compare June 17, 2026 01:45

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/utils/components/DiskModal/utils/types.ts`:
- Around line 88-98: The BuildUploadTrackMetadataParams type declares file and t
as required properties, but the actual caller uploadDataVolume treats them as
optional, creating a runtime risk. In the buildUploadTrackMetadata function, add
a conditional guard for the translate parameter (the t parameter) before calling
getVmDiskUploadSuccessLinks, ensuring contextLinks is only constructed when
translate is defined, similar to how file is already guarded against undefined
values.
🪄 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: Enterprise

Run ID: 0e154a50-5c0d-449a-8805-5b5a36eba88f

📥 Commits

Reviewing files that changed from the base of the PR and between d552f41 and 8464c95.

⛔ Files ignored due to path filters (6)
  • locales/en/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/es/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/fr/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/ja/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/ko/plugin__kubevirt-plugin.json is excluded by !locales/**
  • locales/zh/plugin__kubevirt-plugin.json is excluded by !locales/**
📒 Files selected for processing (19)
  • src/utils/components/DiskModal/UploadDiskModal.tsx
  • src/utils/components/DiskModal/utils/helpers.ts
  • src/utils/components/DiskModal/utils/submit.ts
  • src/utils/components/DiskModal/utils/types.ts
  • src/utils/hooks/useUploadProgressToast/UploadProgressToastListener.tsx
  • src/utils/hooks/useUploadProgressToast/uploadProgressStore.test.ts
  • src/utils/hooks/useUploadProgressToast/uploadProgressStore.ts
  • src/utils/hooks/useUploadProgressToast/utils/cancelPendingVmUploads.test.ts
  • src/utils/hooks/useUploadProgressToast/utils/cancelPendingVmUploads.ts
  • src/utils/hooks/useUploadProgressToast/utils/cancelUpload.ts
  • src/utils/hooks/useUploadProgressToast/utils/cleanupRemovedUploads.ts
  • src/utils/hooks/useUploadProgressToast/utils/types.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadCompletion.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadKeys.test.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadKeys.ts
  • src/utils/resources/template/utils/processOpenShiftTemplate.ts
  • src/views/virtualmachines/actions/actions.ts
  • src/views/virtualmachines/actions/components/DeleteVMModal/utils/deleteVM.ts
  • src/views/virtualmachines/creation-wizard/state/vm-wizard-store/useVMWizardStore.ts
🚧 Files skipped from review as they are similar to previous changes (14)
  • src/utils/hooks/useUploadProgressToast/utils/types.ts
  • src/utils/components/DiskModal/UploadDiskModal.tsx
  • src/utils/resources/template/utils/processOpenShiftTemplate.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadCompletion.ts
  • src/utils/hooks/useUploadProgressToast/utils/cancelPendingVmUploads.ts
  • src/utils/hooks/useUploadProgressToast/uploadProgressStore.ts
  • src/utils/hooks/useUploadProgressToast/utils/cleanupRemovedUploads.ts
  • src/utils/hooks/useUploadProgressToast/UploadProgressToastListener.tsx
  • src/utils/hooks/useUploadProgressToast/utils/cancelPendingVmUploads.test.ts
  • src/views/virtualmachines/actions/components/DeleteVMModal/utils/deleteVM.ts
  • src/utils/hooks/useUploadProgressToast/utils/cancelUpload.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadKeys.test.ts
  • src/utils/hooks/useUploadProgressToast/utils/uploadKeys.ts
  • src/utils/hooks/useUploadProgressToast/uploadProgressStore.test.ts

Comment on lines +88 to +98
export type BuildUploadTrackMetadataParams = {
abortTooltip: UploadDataVolumeOptions['abortTooltip'];
data: V1DiskFormState;
dataVolume: V1beta1DataVolume;
file: File;
isCDROM: boolean;
onCancelCleanup: UploadDataVolumeOptions['onCancelCleanup'];
t: TFunction;
uploadKey: string | undefined;
vm: V1VirtualMachine;
};

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 | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== TypeScript compiler options =="
fd -i 'tsconfig*.json' | while read -r file; do
  echo "--- ${file} ---"
  jq '.compilerOptions | {strict, strictNullChecks}' "${file}"
done

echo
echo "== uploadDataVolume declarations and usages =="
rg -n --type=ts --type=tsx -C3 '\buploadDataVolume\s*\('

echo
echo "== buildUploadTrackMetadata usages =="
rg -n --type=ts --type=tsx -C3 '\bbuildUploadTrackMetadata\s*\('

Repository: kubevirt-ui/kubevirt-plugin

Length of output: 352


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Check tsconfig for strict mode =="
if [ -f tsconfig.json ]; then
  jq -r '.compilerOptions | "\(.strict // "not set") strict, \(.strictNullChecks // "not set") strictNullChecks"' tsconfig.json
fi

echo
echo "== Current BuildUploadTrackMetadataParams definition =="
cat src/utils/components/DiskModal/utils/types.ts

echo
echo "== Search for uploadDataVolume with correct syntax =="
rg -n 'uploadDataVolume' --glob='**/*.ts' --glob='**/*.tsx' -C 3

echo
echo "== Search for buildUploadTrackMetadata calls =="
rg -n 'buildUploadTrackMetadata' --glob='**/*.ts' --glob='**/*.tsx' -C 3

Repository: kubevirt-ui/kubevirt-plugin

Length of output: 12412


🏁 Script executed:

#!/bin/bash

echo "== uploadDataVolume full signature and buildUploadTrackMetadata call =="
sed -n '38,75p' src/utils/components/DiskModal/utils/submit.ts

echo
echo "== buildUploadTrackMetadata implementation =="
sed -n '479,510p' src/utils/components/DiskModal/utils/helpers.ts

echo
echo "== UploadDiskModal uploadDataVolume call context =="
sed -n '75,95p' src/utils/components/DiskModal/UploadDiskModal.tsx

echo
echo "== vmCdromBackgroundUpload uploadDataVolume call =="
sed -n '45,55p' src/utils/components/DiskModal/utils/vmCdromBackgroundUpload.ts

Repository: kubevirt-ui/kubevirt-plugin

Length of output: 2921


🏁 Script executed:

#!/bin/bash

echo "== getVmDiskUploadSuccessLinks implementation =="
rg -n 'getVmDiskUploadSuccessLinks' --glob='**/*.ts' --glob='**/*.tsx' -A 8 -B 2 | head -50

echo
echo "== Check UploadDataProps type =="
rg -n 'UploadDataProps' --glob='**/*.ts' --glob='**/*.tsx' -A 5 -B 2

Repository: kubevirt-ui/kubevirt-plugin

Length of output: 20454


Align BuildUploadTrackMetadataParams optionality with actual caller contract

file and t are required in BuildUploadTrackMetadataParams, but uploadDataVolume accepts both as optional (t?: TFunction and file = data?.uploadFile?.file). The type mismatch creates a runtime risk: buildUploadTrackMetadata guards against undefined file but not translate, so calling getVmDiskUploadSuccessLinks(translate, ...) with undefined translate could fail.

Suggested contract fix
 export type BuildUploadTrackMetadataParams = {
   abortTooltip: UploadDataVolumeOptions['abortTooltip'];
   data: V1DiskFormState;
   dataVolume: V1beta1DataVolume;
-  file: File;
+  file?: File;
   isCDROM: boolean;
   onCancelCleanup: UploadDataVolumeOptions['onCancelCleanup'];
-  t: TFunction;
-  uploadKey: string | undefined;
+  t?: TFunction;
+  uploadKey?: string;
   vm: V1VirtualMachine;
 };
// In buildUploadTrackMetadata (helpers.ts), gate link construction:
contextLinks:
  translate && getUID(vm)
    ? getVmDiskUploadSuccessLinks(translate, vm, diskName, dvName, isCDROM)
    : undefined;
📝 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
export type BuildUploadTrackMetadataParams = {
abortTooltip: UploadDataVolumeOptions['abortTooltip'];
data: V1DiskFormState;
dataVolume: V1beta1DataVolume;
file: File;
isCDROM: boolean;
onCancelCleanup: UploadDataVolumeOptions['onCancelCleanup'];
t: TFunction;
uploadKey: string | undefined;
vm: V1VirtualMachine;
};
export type BuildUploadTrackMetadataParams = {
abortTooltip: UploadDataVolumeOptions['abortTooltip'];
data: V1DiskFormState;
dataVolume: V1beta1DataVolume;
file?: File;
isCDROM: boolean;
onCancelCleanup: UploadDataVolumeOptions['onCancelCleanup'];
t?: TFunction;
uploadKey?: string;
vm: V1VirtualMachine;
};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/utils/components/DiskModal/utils/types.ts` around lines 88 - 98, The
BuildUploadTrackMetadataParams type declares file and t as required properties,
but the actual caller uploadDataVolume treats them as optional, creating a
runtime risk. In the buildUploadTrackMetadata function, add a conditional guard
for the translate parameter (the t parameter) before calling
getVmDiskUploadSuccessLinks, ensuring contextLinks is only constructed when
translate is defined, similar to how file is already guarded against undefined
values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved This issue is something we want to fix jira/valid-reference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants