Skip to content

Simplify and harden Capacity operations and group model - #89

Merged
remdui merged 35 commits into
mainfrom
codex/simplify-capacity-interface
Aug 4, 2026
Merged

Simplify and harden Capacity operations and group model#89
remdui merged 35 commits into
mainfrom
codex/simplify-capacity-interface

Conversation

@remdui

@remdui remdui commented Aug 4, 2026

Copy link
Copy Markdown
Member

Summary

  • replace the broad /capacity config ... control plane with a small operational interface
  • keep only status/info, slot changes, per-server queueability, manual states and YAML reload
  • make groups.<name>.servers the single source of group membership
  • remove the duplicated per-server group setting from defaults, loading and persistence
  • keep topology, unknown-server policy, timings, failure behavior and integration tuning config-only
  • validate and apply the complete YAML policy as one immutable configuration generation
  • harden admission, persistence, reload, lifecycle and command behavior after a full feature audit

Command interface

/capacity status
/capacity status group <group>
/capacity info <server>
/capacity slots proxy <capacity> [reserved]
/capacity slots gameplay <capacity> [reserved]
/capacity slots group <group> <capacity> [reserved]
/capacity slots server <server> <capacity> [reserved]
/capacity queueable <server> <true|false>
/capacity state <server> <open|draining|closed|offline|clear> [duration] [reason]
/capacity reload

The command surface no longer creates/deletes groups, moves group members, changes gameplay classification or initial states, mutates unknown-server behavior, or exposes lease/reconciliation/failure/Restart internals. Command arity and permission-aware suggestions are strict.

Group model

A group owns its members:

groups:
  survival:
    capacity: 250
    reserved_slots: 10
    servers:
      - survival
      - survival1
      - survival2

Individual server entries no longer contain group. Effective membership is derived from group lists. Startup and reload reject duplicate or malformed membership instead of silently changing policy.

Correctness audit improvements

  • share one validated CapacityConfig instance across service and control plane
  • load configuration and manual states from one YAML revision
  • keep the previous live policy when validation fails
  • reject malformed maps, lists, scalar types, identifiers, limits and durations
  • reject negative limits and reserved capacity above total capacity
  • make Redis snapshot channel, publisher and interval part of the validated policy
  • reconfigure reconciliation, integrations and snapshot publication on reload
  • reschedule runtime tasks safely and close them during feature shutdown
  • serialize control-plane operations with shutdown and manual-state expiry
  • wake queues after permissive configuration changes
  • include configured, grouped and state-owned offline servers in snapshots and info output
  • correctly distinguish clearing an existing manual state from an unchanged clear
  • persist the complete validated policy before activating operational edits

Behavior

  • slot and queueability commands persist to config.yml before becoming active
  • omitted reserved capacity retains the existing value, clamped to the new total
  • lowering capacity never kicks connected players
  • group membership and advanced settings are changed in YAML and applied with /capacity reload
  • /capacity info shows exact-server usage, group usage, queueability, gameplay participation, initial/effective state and manual state details
  • Capacity remains YAML-only and creates no database tables or views

Validation

  • focused tests cover canonical membership, duplicate rejection, strict types, invalid limits and durations, inherited group behavior, operational mutations, messaging policy, command permissions/arity, unchanged state clearing and offline-server snapshots
  • Maven verification, coverage and checkstyle run in CI
  • bundled Velocity acceptance boots the actual proxy, executes Capacity commands and verifies YAML persistence and clean shutdown

@remdui
remdui marked this pull request as ready for review August 4, 2026 10:02
@remdui
remdui marked this pull request as draft August 4, 2026 10:19
@remdui remdui changed the title Simplify Capacity operations and group model Simplify and harden Capacity operations and group model Aug 4, 2026
@remdui
remdui marked this pull request as ready for review August 4, 2026 10:51
@remdui
remdui merged commit 8507497 into main Aug 4, 2026
6 checks passed
@remdui
remdui deleted the codex/simplify-capacity-interface branch August 4, 2026 11:01
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.

1 participant