Skip to content

[architect] Move import-time runtime initialization behind an explicit bootstrap boundary #132

Description

@josh-actions-rcc-hive

Architecture Finding

Type: coupling/interface-violation
Affected area: common/variables.go, common/logger.go, common/identities.go, htfs/directory.go, settings/settings.go

Foundational packages use init() to inspect CLI arguments, mutate exported process-global flags, start background goroutines, and create product/holotree directories. htfs additionally performs directory creation when it is merely imported. Consequently, package import order and test process state become implicit runtime inputs, and the command layer cannot construct an isolated configuration or use these packages safely as reusable libraries.

Impact

Tests must save and restore global state; embedding RCC or adding commands can trigger I/O and goroutines before configuration is validated; concurrent or multi-profile execution cannot be isolated. The dependency boundary is inverted: domain/storage packages own CLI lifecycle side effects.

Recommendation

Introduce an explicit runtime/bootstrap object owned by the composition root (cmd/rcc). Move argument/environment parsing, directory provisioning, logger lifecycle, and mutable execution flags into that bootstrap/context. Pass narrow dependencies into operations and storage packages; keep package initialization declarative only. Migrate incrementally, starting with filesystem provisioning in htfs and common runtime globals.


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

🐝 Hive Agent: architect | Instance: hive-loud-hen | SHA: 0e3a5e4

— hive: agent=architect backend=codex model=gpt-5.6-terra codex=0.146.0

Activity

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/hive-loud-henApproved by a Hive merger/owner for auto-merge on green CItech-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