From ab0767a4fd36d5aeea28f9ee8a0c36324a46a42e Mon Sep 17 00:00:00 2001 From: Gabriele Battimelli Date: Thu, 27 Aug 2026 08:50:44 -0400 Subject: [PATCH] Only require JIXIA_PATH for the subcommand that uses it database/__main__.py read os.environ["JIXIA_PATH"] at import time, so schema, informal and vector-db all failed with KeyError even though none of them shell out to the jixia binary. Guard the assignment, and have the jixia subcommand validate the variable itself with a message that says what to set it to, instead of surfacing a bare KeyError. --- database/__init__.py | 5 +++++ database/__main__.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/database/__init__.py b/database/__init__.py index 1e76bcf..d7cf558 100644 --- a/database/__init__.py +++ b/database/__init__.py @@ -57,6 +57,11 @@ def main(): with _connect() as conn: create_schema(conn) elif args.command == "jixia": + if not os.environ.get("JIXIA_PATH"): + raise SystemExit( + "JIXIA_PATH is not set. It must point at the jixia binary, e.g. " + "jixia/.lake/build/bin/jixia" + ) # jixia runs each module with cwd=project_root, so the module file # path must be absolute — a relative root would be resolved twice. project = LeanProject(os.path.abspath(args.project_root)) diff --git a/database/__main__.py b/database/__main__.py index 5102d9d..ae88da7 100644 --- a/database/__main__.py +++ b/database/__main__.py @@ -12,6 +12,10 @@ filemode=os.environ.get("LOG_FILEMODE", "a"), level=os.environ.get("LOG_LEVEL", "INFO"), ) -jixia.run.executable = os.environ["JIXIA_PATH"] +# Only the `jixia` subcommand shells out to the analyzer binary. Requiring this +# at import time breaks `schema`, `informal`, and `vector-db`, which never touch +# it; that subcommand validates the variable itself. +if os.environ.get("JIXIA_PATH"): + jixia.run.executable = os.environ["JIXIA_PATH"] main()