fix(config-remote): PM asks whether it is its own runtime only in a remote deployment; the TUI raw-config read keeps main's patchable backend lookups

CI on 86021e500e: pm.runtime.is_runtime() raises InstallError in an
application process with a packaged-runtime layout, so asking it on every
read_home_selection broke tests/pm/test_environment_build.py and
test_source_update_launch.py. A file deployment now never asks (main's
path, unchanged); a remote one treats InstallError as not-the-runtime.

tui_gateway.server._load_cfg_raw used the module-level config_version /
config_exists names from the rebase's import block, so
test_raw_config_cache_stat_errors could not inject the stat error main's
seam test injects through hermes_cli.config_backend. It now looks them up
on the module, as main does.
This commit is contained in:
Ben Barclay authored and Teknium committed 2026-10-27 17:33:48 -07:00
1 parent e4374020bd
commit afb8c9a1a7
1 file changed
+14 -4
+14 -4
View File
@@ -26,11 +26,21 @@ def _selection_readers(config_path: Path):
"""``(version(path), read(path))`` for a home's selection. PM's dependency runtime reads the
LOCAL file it publishes to and compare-and-swaps (``pm.publication``): it has neither the
remote config backend's client nor the plane credential, so a remote deployment never fails
PM closed there. Every other process reads through the selected config backend."""
from hermes_cli import config_backend
from pm.runtime import is_runtime
PM closed there. Every other process reads through the selected config backend; a file
deployment never asks whether this is PM's runtime (the selector is all it needs)."""
import os
if not is_runtime():
from hermes_cli import config_backend
if os.environ.get(config_backend.BACKEND_ENV, "").strip().lower() in ("", "file"):
return config_backend.config_version, config_backend.read_config_doc
from pm.package import InstallError
from pm.runtime import is_runtime
try:
in_runtime = is_runtime()
except InstallError: # an application process whose packaged PM runtime is damaged: not PM's runtime
in_runtime = False
if not in_runtime:
return config_backend.config_version, config_backend.read_config_doc
backend, home = config_backend.local_file_layer(config_path)
return (lambda _path: backend.version(home)), (lambda _path: backend.read_user_doc(home))