Skip to content

Commit caa67bc

Browse files
committed
git add src/omnipkg/_vendor/uv src/omnipkg/_vendor/uv_ffi/__init__.py
git commit -m "feat(ffi): Adapt to new uv-ffi error reporting and self-healing engine" -m "Context & Problem: Previously, omnipkg's interaction with the uv-ffi engine was a black box. A failure (rc=1) offered no insight into the cause, forcing a fallback to the slower daemon without knowing if the issue was a transient cache problem or a genuine resolution conflict. Solution & Changes: 1. **Submodule Update:** - Updates the \`uv\` submodule to the latest version, which incorporates the new **self-healing logic**. The Rust engine can now detect and recover from stale PyPI cache failures internally. 2. **Expose Detailed Errors:** - The \`uv_ffi.run()\` function now returns a 4-tuple: \`(rc, installed, removed, err_msg)\`. The fourth element contains the detailed error string from Rust, making failures transparent. 3. **Robust Python Wrapper:** - The Python wrapper in \`uv_ffi/__init__.py\` is updated to handle this new signature. - Crucially, a **backward-compatibility shim** has been added. It checks the length of the returned tuple and gracefully pads an empty error string if an older 3-tuple build of the native extension is detected. This prevents \`ValueError\` exceptions and ensures robust behavior across different build states. 4. **Expose Manual Cache Control:** - The \`clear_registry_cache\` function is now exposed from the FFI, allowing for manual cache invalidation if needed for debugging or advanced scripting. Impact: This makes omnipkg's installation process significantly more transparent and debuggable. The self-healing engine reduces unnecessary fallbacks to the slow daemon, while explicit error messages allow for better logging and user feedback."
1 parent af30f19 commit caa67bc

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

src/omnipkg/_vendor/uv_ffi/__init__.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
"""
22
uv_ffi — thin wrapper around the PyO3 native extension.
3-
run(cmd) -> (rc, installed, removed)
3+
run(cmd) -> (rc, installed, removed, err)
44
installed: list of (name, version) tuples
55
removed: list of (name, version) tuples
6+
err: error string (empty on success)
67
"""
78
import os as _os
89
import sys as _sys
910
_sys.path.insert(0, _os.path.join(_os.path.dirname(__file__), '_native'))
1011
from uv_ffi import run as _run_native
1112

1213
def run(cmd: str) -> tuple:
13-
"""Call uv FFI directly — returns structured (rc, installed, removed)."""
14-
return _run_native(cmd)
14+
"""Call uv FFI directly — returns (rc, installed, removed, err).
15+
Gracefully handles old 3-tuple .so builds by padding err='' ."""
16+
result = _run_native(cmd)
17+
if len(result) == 3:
18+
return (result[0], result[1], result[2], '')
19+
return result
1520

1621
run_capture = run
1722

@@ -41,4 +46,12 @@ def _try_import(name: str):
4146
patch_site_packages_cache = _patch
4247
_gspc = _try_import('get_site_packages_cache')
4348
if _gspc is not None:
44-
get_site_packages_cache = _gspc
49+
get_site_packages_cache = _gspc
50+
51+
_clear_reg = _try_import('clear_registry_cache')
52+
if _clear_reg is not None:
53+
clear_registry_cache = _clear_reg
54+
55+
_clear_reg = _try_import('clear_registry_cache')
56+
if _clear_reg is not None:
57+
clear_registry_cache = _clear_reg

0 commit comments

Comments
 (0)