Skip to content

Comments

feat: instance groups for organizing related services#739

Open
mathiasbourgoin wants to merge 10 commits intomainfrom
feat/instance-groups
Open

feat: instance groups for organizing related services#739
mathiasbourgoin wants to merge 10 commits intomainfrom
feat/instance-groups

Conversation

@mathiasbourgoin
Copy link
Collaborator

@mathiasbourgoin mathiasbourgoin commented Feb 20, 2026

Summary

Implements instance groups (#335) — logical deployments that tie related services together with shared configuration (network, binary version, service user).

  • Data model: Group.t type with JSON serialization, Group_registry for CRUD with path traversal protection, group field on Service.t (backward-compatible, defaults to None)
  • CLI: om group create/list/show/delete/add/remove/start/stop/restart/upgrade subcommand with network validation on add and --cascade/--ungroup mutual exclusion on delete
  • TUI group view: Instances page supports group-based layout (toggle with g key) with collapsible group headers showing name, network, and binary version
  • Inline group management: Instance action modal includes "Add to Group" (network-filtered, with inline group creation) and "Remove from Group" options; empty groups are auto-removed
  • Group lifecycle: start_group/stop_group/restart_group with dependency ordering (node first on start, last on stop)
  • Install forms: All 5 install forms (node, baker, accuser, DAL, signatory) include a Group field for assigning services to groups at creation time. Shared set_service_group helper eliminates duplication.
  • Shell completions: Updated for the new group subcommand

Code quality (from self-review)

  • Path traversal protection in Group_registry via is_safe_name validation
  • Replaced all polymorphic equality with typed comparators (String.equal, Option.equal, pattern matching)
  • Changed include Helpers to open Helpers in lifecycle.ml
  • delete --cascade sorts services by reverse role order (dependents first)
  • Deduplicated sections_for_view (delegates to Instances_layout.sections_of_state)
  • Removed dead group_folded field from state type
  • display_ordered_services properly sorts by role within groups

Also fixes pre-existing Yojson Tuple/Variant exhaustiveness warnings in foldable_json.ml and json_highlighter.ml.

Closes #335

Test plan

  • 15 unit tests for Group type, registry, and Service.group field (dune exec test/test_group.exe)
  • 260 existing unit tests still pass (dune runtest)
  • Golden path TUI test updated with +1 field count for group field on all forms
  • 6 integration tests:
    • 54-group-create-list-show-delete: CRUD operations
    • 55-group-add-remove-service: add/remove service to/from group, verify registry
    • 56-group-multiple-groups: two groups on same network coexist independently
    • 57-group-add-network-mismatch: rejects adding service on wrong network
    • 58-group-name-validation: rejects path traversal and invalid characters
    • 59-group-delete-cascade-ungroup: --cascade/--ungroup mutual exclusion and behavior
  • Manual TUI testing: group view toggle, group header actions, install form group selection
  • CI golden path test passes with updated field counts

@mathiasbourgoin mathiasbourgoin force-pushed the feat/instance-groups branch 9 times, most recently from 5bbb94c to abf124b Compare February 20, 2026 10:28
Nomadic Labs and others added 10 commits February 23, 2026 08:27
Introduce the concept of instance groups — logical deployments that tie
related services (node, baker, accuser, DAL) together with shared config
(network, binary version, service user).

- Add Group type with JSON serialization (src/group.ml)
- Add Group_registry for CRUD operations (src/group_registry.ml)
- Add `group` field to Service.t (backward-compatible, defaults to None)
- Add `octez-manager group` CLI subcommand with create/list/show/delete/
  add/remove/start/stop/restart/upgrade operations
- Add group lifecycle functions to Lifecycle module (start_group,
  stop_group, restart_group with dependency ordering)
- Add 15 unit tests for Group type, registry, and Service.group field

Implements #335 (phases 1 and 3).

Co-Authored-By: Claude <noreply@anthropic.com>
Add a group-based layout mode to the instances page that organizes
services by their instance group. Users can toggle between group view
and the existing role-based flat view with 'g'/'G' keys.

- Add view_mode (Group/Role) to instances state with group folding
- Add group_by_group layout that distributes groups across columns
- Add group header rendering with name, network, and binary version
- Add group actions modal (start/stop/restart all, add/remove service)
- Add "Create Group" option (index 0) to the create menu
- Handle 'g'/'G' key toggle between group and role views
- Update navigation and render tests for new group-aware layout

Implements #335 (phase 2).

Co-Authored-By: Claude <noreply@anthropic.com>
Add an optional Group field to all install forms (node, baker, accuser,
DAL node, signatory) allowing users to assign services to instance
groups at creation time.

- Add `group` to core_service_config in form_builder_common
- Add group_field bundle with modal selection of existing groups
- Add group field to all 5 install forms (read-only in edit mode)
- Set group on service post-install via registry update
- Update golden path test field counts (+1 down for each form)
  and menu indices (+1 for "Create Group" at position 0)

Implements #335 (phase 4).

Co-Authored-By: Claude <noreply@anthropic.com>
Regenerate bash and zsh completions to include the new `group`
subcommand and its options.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Three integration tests covering group CRUD operations:
- 54: create, list, show (text + JSON), delete
- 55: add/remove service to/from group, verify registry
- 56: multiple groups on same network coexist independently

Add group category to run-tests.sh and shard manifest (shard-1).

Co-Authored-By: Claude <noreply@anthropic.com>
Add "Add to Group" and "Remove from Group" actions to the instance
actions modal. "Add to Group" shows existing groups + "Create New Group"
option that opens a validated text input prefixed with the network name.
Remove the "Create Group" stub from the create menu since groups are now
created contextually from instances.

Co-Authored-By: Claude <noreply@anthropic.com>
current_service was indexing into the flat service list regardless of
view mode. In group view, the display order differs (grouped first,
then ungrouped), so the cursor mapped to the wrong service. Add
display_ordered_services that computes the correct flat order based
on view_mode, and use it in current_service.

Co-Authored-By: Claude <noreply@anthropic.com>
- 57: network mismatch rejection on group add
- 58: path traversal and invalid group name validation
- 59: delete --cascade/--ungroup mutual exclusion and --ungroup behavior

Co-Authored-By: Claude <noreply@anthropic.com>
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.

Feature request: group of instances

1 participant