refactor(hermes_cli): group D — merge fragmented string literals, hug call layouts (AST-neutral)

This commit is contained in:
Teknium
2026-09-02 20:51:45 -07:00
parent 7302a097b1
commit 7a643acfc9
6 changed files with 70 additions and 122 deletions

View File

@@ -62,10 +62,9 @@ class ReconcileAction:
def _slot_action(
profile: str, profile_dir: Path, prior_state: str | None, start: bool,
) -> ReconcileAction:
return ReconcileAction(
profile=profile, prior_state=prior_state, action="started" if start else "registered",
prior_exit=_read_prior_exit_label(profile_dir),
)
return ReconcileAction(profile=profile, prior_state=prior_state,
action="started" if start else "registered",
prior_exit=_read_prior_exit_label(profile_dir))
def reconcile_profile_gateways(
@@ -92,11 +91,8 @@ def reconcile_profile_gateways(
try:
multiplex_profiles = load_gateway_config().multiplex_profiles
except Exception:
log.warning(
"Unable to load gateway configuration during container boot; "
"using the GATEWAY_MULTIPLEX_PROFILES override if set.",
exc_info=True,
)
log.warning("Unable to load gateway configuration during container boot; using the "
"GATEWAY_MULTIPLEX_PROFILES override if set.", exc_info=True)
multiplex_profiles = is_truthy_value(os.environ.get("GATEWAY_MULTIPLEX_PROFILES"))
# Default profile — always register, even if nothing has ever populated the root profile
@@ -104,8 +100,7 @@ def reconcile_profile_gateways(
# legacy `gateway run` container with no state yet seeds that intent as `running` so the
# s6 reconciler preserves the pre-s6 behavior.
legacy_default_state = _maybe_migrate_legacy_gateway_run_state(
hermes_home, container_argv=container_argv, dry_run=dry_run,
)
hermes_home, container_argv=container_argv, dry_run=dry_run)
default_prior_state = legacy_default_state or _read_desired_state(hermes_home)
default_should_start = default_prior_state in _AUTOSTART_STATES
if not dry_run:
@@ -124,10 +119,8 @@ def reconcile_profile_gateways(
# "default" is reserved for the root profile (above); skip a stray
# ``profiles/default/`` rather than collide on the slot.
if entry.name == "default":
log.warning(
"profiles/default/ exists — skipping to avoid colliding "
"with the reserved root-profile s6 slot",
)
log.warning("profiles/default/ exists — skipping to avoid colliding with the "
"reserved root-profile s6 slot")
continue
prior_state = _read_desired_state(entry)