Skip to content

EDM-4999: Redefine which statuses allow start/stop actions - #763

Open
celdrake wants to merge 1 commit into
flightctl:mainfrom
celdrake:EDM-4999-allow-start-stop-statuses
Open

EDM-4999: Redefine which statuses allow start/stop actions#763
celdrake wants to merge 1 commit into
flightctl:mainfrom
celdrake:EDM-4999-allow-start-stop-statuses

Conversation

@celdrake

@celdrake celdrake commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

The UI was not displaying the "Stop" action for applications in error status.

We'd now also allow Start/Stop for applications in an Unknown status.

Made-with: Cursor

Areas affected

  • libs/ui-components/: Updates shared application lifecycle actions.
  • Applications in Error status can use Stop.
  • Applications in Unknown status can use Start and Stop.
  • Shared UI behavior affects both standalone and OCP plugin consumers.

Unaffected areas

  • No changes to libs/types/, libs/i18n/, libs/cypress/, platform-specific app code, the Go auth proxy, container builds, E2E tests, or CI configuration.
  • No security impact.

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The lifecycle utilities now include unknown applications in startable statuses and define running, error, and unknown applications as stoppable. The application details action menu uses these statuses for Stop availability.

Changes

Application lifecycle action handling

Layer / File(s) Summary
Status-aware lifecycle actions
libs/ui-components/src/utils/applicationLifecycle.ts, libs/ui-components/src/components/DetailsPage/Tables/ApplicationLifecycleActions.tsx
startableStatuses now includes ApplicationStatusUnknown. The new stoppableStatuses collection includes running, error, and unknown states. The Stop menu item uses this collection. Start and restart behavior remain unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: ui-components

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the change to the statuses that allow application start and stop actions.
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.
No-Hardcoded-Secrets ✅ Passed The PR adds only application-status enum references and UI logic; scans found no credential URLs, secret-like assignments, token prefixes, private keys, or long base64 literals.
No-Weak-Crypto ✅ Passed The PR changes only application status lists and UI action rendering; no weak crypto, custom crypto, or secret-comparison code appears in the diff or scanned UI sources.
No-Injection-Vectors ✅ Passed The commit only adds status arrays and conditional checks; changed files contain no eval/exec, dangerouslySetInnerHTML, os.system, exec.Command, or unsafe yaml.load.
Container-Privileges ✅ Passed The commit changes only two TypeScript UI files. The exact diff adds status lists and Stop rendering; it adds no container/Kubernetes manifest or privilege setting.
No-Sensitive-Data-In-Logs ✅ Passed The PR changes only lifecycle status handling and UI action rendering; the added lines contain no logging calls or sensitive-data values.
Resource-Leaks ✅ Passed The patch changes only two TypeScript files. It adds no proxy Go files, resource operations, HTTP calls, or goroutines to assess for leaks.
Unchecked-Errors ✅ Passed The PR changes only two TypeScript files; git diff HEAD~1 HEAD -- proxy/ is empty, so the Go-specific check is not applicable.
Ai-Attribution ✅ Passed The PR and HEAD commit mention Cursor with the acceptable Made-with: Cursor trailer; HEAD has no Co-Authored-By AI attribution.
Generated-Files-Not-Hand-Edited ✅ Passed The commit changes only two ui-components source files; no paths under the specified generated models or English translation file were changed.
I18n-Compliance ✅ Passed The PR adds no user-visible string literals in .tsx; the changed component uses hardcoded string literals for every t() key, with no variable translation keys.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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
`@libs/ui-components/src/components/DetailsPage/Tables/ApplicationLifecycleActions.tsx`:
- Line 24: Remove the component-local stoppableStatuses declaration in
ApplicationLifecycleActions and retain the imported utility export as the sole
source of truth. Update any consumers in this module to use the imported
stoppableStatuses binding, ensuring the duplicate declaration is not exported or
referenced.

In `@libs/ui-components/src/utils/applicationLifecycle.ts`:
- Around line 32-38: Update shouldClearPendingLifecycleAction so the
pendingAction === 'stop' branch uses stoppableStatuses, or another predicate
that excludes ApplicationStatusUnknown, rather than startableStatuses; keep
ApplicationStatusUnknown in stoppableStatuses and add a regression test covering
a pending stop while the current status is unknown.
🪄 Autofix

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: ASSERTIVE

Plan: Enterprise

Run ID: 3270c673-ff4f-45ac-a6fe-b0866f98c825

📥 Commits

Reviewing files that changed from the base of the PR and between e17bc30 and 5c2109d.

📒 Files selected for processing (2)
  • libs/ui-components/src/components/DetailsPage/Tables/ApplicationLifecycleActions.tsx
  • libs/ui-components/src/utils/applicationLifecycle.ts

type ApplicationLifecycleAction,
hasAplicationStatusMismatch,
startableStatuses,
stoppableStatuses,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Remove the duplicate stoppableStatuses declaration.

The component imports stoppableStatuses at Line 24. The supplied graph context also shows export const stoppableStatuses in this module at Lines 35-39. TypeScript rejects the duplicate import/local binding, so the build cannot compile.

Keep the utility export as the single source of truth. Remove the component-local declaration and migrate any external consumers to the utility export.

Proposed fix
-export const stoppableStatuses = [
-  ApplicationStatusType.ApplicationStatusRunning,
-  ApplicationStatusType.ApplicationStatusError,
-  ApplicationStatusType.ApplicationStatusUnknown,
-];
🤖 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
`@libs/ui-components/src/components/DetailsPage/Tables/ApplicationLifecycleActions.tsx`
at line 24, Remove the component-local stoppableStatuses declaration in
ApplicationLifecycleActions and retain the imported utility export as the sole
source of truth. Update any consumers in this module to use the imported
stoppableStatuses binding, ensuring the duplicate declaration is not exported or
referenced.

Comment on lines +32 to +38
ApplicationStatusType.ApplicationStatusUnknown,
];

export const stoppableStatuses = [
ApplicationStatusType.ApplicationStatusRunning,
ApplicationStatusType.ApplicationStatusError,
ApplicationStatusType.ApplicationStatusUnknown,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not use startableStatuses as the stop-completion predicate.

ApplicationStatusUnknown is now included in startableStatuses, but shouldClearPendingLifecycleAction uses that collection for pendingAction === 'stop' at Line 174. A stop issued while the application remains ApplicationStatusUnknown is therefore cleared immediately. This can re-enable the action and allow duplicate stop requests before a stopped state is observed.

Keep ApplicationStatusUnknown in stoppableStatuses, but use a dedicated stop-completion collection or explicitly exclude it from the stop branch. Add a regression test for a pending stop with current status ApplicationStatusUnknown.

Minimal fix
     case 'stop':
-      return startableStatuses.includes(currentStatus);
+      return (
+        startableStatuses.includes(currentStatus) &&
+        currentStatus !== ApplicationStatusType.ApplicationStatusUnknown
+      );
🤖 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 `@libs/ui-components/src/utils/applicationLifecycle.ts` around lines 32 - 38,
Update shouldClearPendingLifecycleAction so the pendingAction === 'stop' branch
uses stoppableStatuses, or another predicate that excludes
ApplicationStatusUnknown, rather than startableStatuses; keep
ApplicationStatusUnknown in stoppableStatuses and add a regression test covering
a pending stop while the current status is unknown.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant