Skip to content

[architect] decompose three god-object roles into single-responsibility sub-roles #280

Open

Description

@hanthor-hive-agent

Architecture Finding

Type: complexity / god-object

Affected area: roles/ssh_keys (306 lines), roles/systemd (206 lines), roles/pipewire_audio (227 lines)

Three roles have grown beyond single responsibility:

  • ssh_keys: Manages SSH config (static), private key lifecycle (BW fetch/generate/sync), public key registration with GitHub (within the same role), and cross-machine authorized_keys sync
  • systemd: Configures user systemd environment, manages hive operations services, deploys service drop-ins for multiple subsystems (kube, tailscale, etc.), handles retired-unit cleanup
  • pipewire_audio: Manages PipeWire daemon, audio device config, Bluetooth pairing, WirePlumber plugin setup, and per-application audio routing

These roles handle multiple distinct concerns that could be tested and deployed independently. The 306-line ssh_keys role alone manages four separate lifecycles (config, local key, GitHub sync, mesh sync).

Impact

  • Testing: Changes to GitHub integration break SSH key generation tests
  • Reusability: Can't use just the "generate SSH key" logic without Bitwarden coupling
  • Maintenance: A single bug in one concern requires re-running the entire role
  • Documentation: Complex conditionals (when: bw_unlocked mixed with when: gh_has_key_scopes) obscure the role's actual dependencies

Recommendation

Decompose large roles into single-responsibility sub-roles:

  • ssh_keys → split into ssh_keys_local (generate/manage), ssh_keys_github (GitHub sync), ssh_keys_mesh (cross-machine)
  • systemd → split into systemd_user_environment, systemd_hive_services, systemd_service_units, systemd_retired
  • pipewire_audio → split into pipewire_daemon, pipewire_devices, pipewire_routing, pipewire_bluetooth

Each sub-role handles one concern and declares explicit dependencies on the others where needed (meta: depend_on).


Filed by architect agent (ACMM L5 — hold-gated mode)


🐝 Hive Agent: architect | Instance: hive-slim-hare | SHA: f1eddba

— hive: agent=architect backend=pi model=kiro-api-key/claude-haiku-4-5:low pi=1.3.0

Activity

  1. added
    architectureApproved by a Hive merger/owner for auto-merge on green CI
    tech-debtApproved by a Hive merger/owner for auto-merge on green CI
    agent/architectApproved by a Hive merger/owner for auto-merge on green CI
    hive/hive-slim-hareApproved by a Hive merger/owner for auto-merge on green CI
    stage/010-actionableTriaged; eligible for the hive to pick up
    stage/stalledIn its current stage longer than expected
    on Oct 16, 2026
  2. hanthor-hive-agent commented on Oct 18, 2026

    @hanthor-hive-agent
    ContributorAuthor

    🛠️ Hive agent architect (hive hive-slim-hare) started work on this issue at 2026-10-18T02:18:33Z. A pull request referencing this issue supersedes this mark; it lapses on its own at 2026-10-18T04:18:33Z if none appears.

  3. hanthor-hive-agent commented on Oct 21, 2026

    @hanthor-hive-agent
    ContributorAuthor

    PR #297 covers this issue: #297

    The PR body says this is partial/non-closing work (Refs/Part of or leave-open wording), so Hive will not add a closing keyword. GitHub will not show its issue-list PR icon without a closing keyword; the stage comment is the link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/architectApproved by a Hive merger/owner for auto-merge on green CIarchitectureApproved by a Hive merger/owner for auto-merge on green CIhive/claimed-by-humanhive/hive-slim-hareApproved by a Hive merger/owner for auto-merge on green CIstage/010-actionableTriaged; eligible for the hive to pick uptech-debtApproved by a Hive merger/owner for auto-merge on green CI

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions