fix: muse coord shard never resolved 'from X import Y' import edges (musehub#206)
_build_import_edges() computed: imported = rec[qualified_name].split(.)[-1].replace(import::, )
qualified_name for an import symbol is ::-separated (e.g. import::auth::login for 'from auth import login'), never dot-separated. Splitting a string with zero . characters on . is a no-op, so [-1] returns the whole string unchanged; the fixed-prefix .replace() then only strips import::, leaving auth::login -- which can never match a bare file stem key like auth in stem_to_file. Every 'from X import Y' statement -- the dominant Python import style -- failed to resolve to a cross-file edge. Only bare 'import x' happened to work, since in that one case the leftover after .replace() really was just the stem.
Confirmed live: a real 4-file codebase (app.py -> auth.py -> db.py, app.py -> billing.py -> db.py, all via from-X-import-Y) produced zero detected edges and cross_shard_edges: 0 regardless of partition -- muse coord shard believed the codebase had no coupling when it demonstrably does.
Fixed by splitting on :: and taking the module segment (index 1), then taking its final .-segment to resolve dotted submodule imports too (e.g. import::billing.utils::charge -> 'billing.utils' -> 'utils', matching billing/utils.py's stem) -- the ticket's suggested one-line fix alone would have missed this dotted-submodule case.
Semantic Changes
5 symbols
Files Changed
~2
1261 in snapshot
0 comments
muse hub commit comment sha256:61123637e12b64a25a38cffb05df8d7932325e379b4c17feb5c0096b69d16066 --body "your comment"
No comments yet. Be the first to start the discussion.