Files
WildAi 6c03985533 Round 21: the vendored trees load under the pack-private _keep_vendor namespace
The flat fallback of the old dual-mode import pattern bound the shared
top-level 'modules' name, so on a sys.path where another root ships a
modules/ package, first-importer-wins decided which vendored tree - and
with it which ARCH_REGISTRY object - the pack binds.

New src/keep_vendored.py (stdlib-only, pip-_vendor semantics): one
sys.modules root '_keep_vendor' anchored to this pack's modules/deps via
spec_from_file_location, single instantiation by construction, a loud
ImportError on a foreign occupant of the private name, sys.modules
cleanup on a failed exec, never touches sys.path. The four vendored
import sites in src/ repoint to vendor(); the lazy loader sites stay
lazy. tools/scan_compat.py models vendor("...") string-literal calls
(and static _keep_vendor.* imports) so the static import closure keeps
covering the vendored tree. Guard pins: the static rot scan (no absolute
self-imports, no dynamic-import machinery in the vendored tree), the
namespace ban over src/nodes/tools, the flat-decoy probe (a foreign
modules/ tree on sys.path binds nothing shared) and the registry-identity
probe (one instantiated tree per process across every import mode).
modules/deps/__init__.py carries the docstring-only contract update - the
only modules/deps file touched.
2026-11-08 03:29:40 +03:00
..