Skip to content

fix: handle mixed-state bulk toggle actions#104

Merged
larkly merged 2 commits intomainfrom
copilot/issue99-mixed-bulk-toggle
Mar 30, 2026
Merged

fix: handle mixed-state bulk toggle actions#104
larkly merged 2 commits intomainfrom
copilot/issue99-mixed-bulk-toggle

Conversation

@larkly
Copy link
Copy Markdown
Owner

@larkly larkly commented Mar 30, 2026

Summary

  • resolve concrete toggle action per selected server for bulk toggle operations
  • stop deriving one bulk action from the first selected server
  • include mixed-action confirmation text when selected servers require different concrete operations
  • execute per-target action in bulk execution path

Why

Issue #99 reports incorrect behavior for mixed-state bulk selections (for example ACTIVE + SHUTOFF with stop/start) where one wrong action was applied to part of the selection.

Changes

  • src/internal/app/actions_server.go
    • added shared toggle resolver helper
    • updated openToggleConfirm to build per-server action plan
    • updated executeBulkAction to execute per-server action
  • src/internal/ui/modal/confirm.go
    • extended modal.ServerRef with optional Action field for bulk plans
  • src/internal/app/actions_server_test.go
    • added resolver and action-count helper tests

Validation

  • cd src && make test
  • cd src && make build
  • cd src && make vet

Fixes #99

larkly added 2 commits March 30, 2026 15:29
Fixes #99 by resolving concrete toggle action per selected server instead of inferring one action from the first server. This prevents wrong operations on mixed selections and keeps single-server toggle behavior unchanged.

Implementation details:

- add shared resolver for toggle families (pause/unpause, suspend/resume, shelve/unshelve, stop/start, lock/unlock, rescue/unrescue)

- extend modal.ServerRef with optional per-server Action field for bulk execution plans

- build per-server plan in openToggleConfirm for bulk selections

- add mixed-action confirm title/body when selection spans multiple concrete actions

- execute per-server action in executeBulkAction, preserving existing error aggregation and rescue password reporting

- add unit tests for resolver and mixed-action counting/formatting helpers

Validation:

- cd src && make test

- cd src && make build

- cd src && make vet

Fixes #99
Follow-up to #99 implementation:

- add missing hard reboot handling in executeBulkAction

- preserve mixed-action summary when rescue passwords are reported

This avoids silent no-op on bulk hard reboot and keeps bulk result messaging accurate for mixed rescue/unrescue operations.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes incorrect behavior in bulk “toggle” actions when the selected server set contains mixed states (e.g., ACTIVE + SHUTOFF), by resolving and executing the concrete action per selected server instead of deriving a single action from the first selection.

Changes:

  • Added a shared toggle-action resolver and bulk action count/format helpers to build a per-server bulk execution plan.
  • Updated bulk toggle confirmation to show mixed-action messaging when concrete operations differ across selected servers.
  • Updated bulk execution to run each server’s concrete action (and improved bulk error labeling), with unit tests covering the new helpers.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/internal/app/actions_server.go Resolves per-server concrete toggle actions, displays mixed-action confirmation text, and executes per-target actions in the bulk path.
src/internal/ui/modal/confirm.go Extends modal.ServerRef to optionally carry a per-server concrete action for bulk plans.
src/internal/app/actions_server_test.go Adds unit tests for toggle resolution and action-count/format helpers used by the bulk plan UX/execution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@larkly larkly merged commit 8459c76 into main Mar 30, 2026
7 checks passed
@larkly larkly deleted the copilot/issue99-mixed-bulk-toggle branch March 30, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bulk toggle actions mishandle mixed server states

2 participants