EDM-4999: Redefine which statuses allow start/stop actions - #763
Conversation
Made-with: Cursor
WalkthroughThe 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. ChangesApplication lifecycle action handling
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
libs/ui-components/src/components/DetailsPage/Tables/ApplicationLifecycleActions.tsxlibs/ui-components/src/utils/applicationLifecycle.ts
| type ApplicationLifecycleAction, | ||
| hasAplicationStatusMismatch, | ||
| startableStatuses, | ||
| stoppableStatuses, |
There was a problem hiding this comment.
🎯 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.
| ApplicationStatusType.ApplicationStatusUnknown, | ||
| ]; | ||
|
|
||
| export const stoppableStatuses = [ | ||
| ApplicationStatusType.ApplicationStatusRunning, | ||
| ApplicationStatusType.ApplicationStatusError, | ||
| ApplicationStatusType.ApplicationStatusUnknown, |
There was a problem hiding this comment.
🎯 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.
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.Errorstatus can use Stop.Unknownstatus can use Start and Stop.Unaffected areas
libs/types/,libs/i18n/,libs/cypress/, platform-specific app code, the Go auth proxy, container builds, E2E tests, or CI configuration.