Skip to content

[KISS/SPoA] Split RuntimeCoordinator into focused runtime use cases #54

Description

@github-actions

Audit finding

RuntimeCoordinator currently owns or coordinates all of the following:

  • local overlay toggle;
  • persistent assignment toggle;
  • automatic-mode mutation;
  • foreground-window handling;
  • settings-change handling;
  • automatic activation evaluation;
  • manual refresh;
  • emergency shutdown;
  • overlay fault translation;
  • notification text;
  • commit reentrancy suppression.

The class has many collaborators, including several raw delegates, and changes to unrelated runtime behavior converge on one file. This weakens KISS, clean-code cohesion and Single Point of Authority boundaries.

Target state

Keep ApplicationStateController as the runtime-state authority, but split runtime behavior into focused use cases/ports. A small façade may remain for the composition root.

Suggested responsibilities:

  • session commands: local toggle, emergency, exit;
  • assignment commands: add/enable/disable and automatic-mode changes;
  • automatic activation evaluator;
  • settings/foreground event coordinator;
  • fault and notification mapping.

Avoid introducing an event bus or dependency-injection container.

Acceptance criteria

  • Automatic eligibility/evaluation is testable independently from settings mutation.
  • Emergency and local-session commands are isolated from assignment management.
  • Notification wording is separated from state-transition logic.
  • Raw delegate groups are replaced by named, focused ports where useful.
  • ApplicationStateController remains the sole runtime state-transition authority.
  • Existing manual, automatic, suppression, fault and emergency tests remain green.
  • New tests cover each extracted use case without constructing the complete application context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions