Fix jixia path doubling (absolute project root)#12
Merged
Conversation
The weekly index 'jixia' step failed for every module with ENOENT. jixia_py runs the analyzer with cwd=project_root while passing the module file path (which already includes the project_root prefix). With a relative root like ./physlib, jixia resolves the file against its own cwd and looks for physlib/physlib/... — which does not exist. Resolve project_root to an absolute path so the file path survives the cwd change. Also make load_module skip modules whose jixia output is missing, consistent with load_symbol and load_declaration, so one unprocessable module can't abort the whole load.
There was a problem hiding this comment.
Pull request overview
This PR fixes path resolution issues when running the jixia analyzer with a relative project root, which previously caused module paths to be resolved relative to cwd twice and resulted in widespread ENOENT failures during indexing. It also makes the module loader resilient to missing per-module jixia outputs so a single failed module won’t abort the whole load.
Changes:
- Resolve
project_rootto an absolute path before constructingLeanProject, preventing “project root doubling” when jixia changescwd. - Update
load_moduleto skip modules when required files (module content and/or jixia output) are missing, logging a warning instead of raising.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
database/__init__.py |
Converts project_root to an absolute path before running jixia to prevent incorrect path resolution under cwd changes. |
database/jixia_db.py |
Makes module loading tolerant to missing files by skipping problematic modules instead of failing the entire load. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+41
to
+49
| values = [] | ||
| for m in data: | ||
| try: | ||
| content = project.path_of_module(m, base_dir).read_bytes() | ||
| docstring = project.load_module_info(m).docstring | ||
| except FileNotFoundError: | ||
| logger.warning("skipping module %s: jixia output not found", m) | ||
| continue | ||
| values.append((Jsonb(m), content, docstring)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
After the schema fix (#11), the Weekly Index reached the Load jixia data into PostgreSQL step, where all 445 modules failed with:
then crashed in Python with
FileNotFoundError: '.../Physlib.Thermodynamics.Temperature.Basic.mod.json'.Root cause
jixia_py.run_jixialaunches the analyzer withsubprocess.run(args, cwd=root)and passes the module file frompath_of_module(m, base_dir), which already includes the project-root prefix. The workflow runspython3 -m database jixia ./physlibwith a relative root, so jixia (cwd=physlib) resolves the filephyslib/Physlib/.../Basic.leanagainst its own cwd →physlib/physlib/...→ ENOENT, for every module. No.mod.jsonis produced, so the loader then crashes.(Note:
LEAN_SYSROOTis a red herring — jixia_py never reads it, and the lean-core pass is filtered out byMODULE_NAMES=Physlib.)What
project_rootto an absolute path indatabase/__init__.pyso the file path survives jixia'scwdchange.load_moduleskip modules with missing jixia output (matchingload_symbol/load_declaration), so a single unprocessable module can't abort the whole load.