Fix DreamMaker parent-relative #include paths (lstrip charset misuse)

`extract_dm` normalized include paths with `raw.lstrip("./")`. `str.lstrip`
treats its argument as a *set of characters*, not a prefix, so it strips
every leading `.` and `/` — destroying parent-relative includes:

    "../shared/base.dm"  -> "shared/base.dm"
    "../../a.dm"         -> "a.dm"
    ".hidden/x.dm"       -> "hidden/x.dm"

`(path.parent / norm).resolve()` then points at the wrong directory,
`.exists()` returns False, and a correct internal `imports_from` edge to the
real included file becomes a bogus external `imports` edge to a phantom node,
silently losing the cross-file link.

The sibling local-include resolver in `extractors/bash.py` resolves
`(path.parent / raw)` from the raw path without stripping `..`, confirming
the intent. Strip only a literal leading `./` (re is already imported) so
`../` includes resolve correctly; the `./`-prefix and no-prefix cases are
unchanged.
This commit is contained in:
Osamaali313
2026-07-18 12:03:47 +01:00
committed by safishamsi
parent 995508c328
commit a0386848be
+1 -1
View File
@@ -86,7 +86,7 @@ def extract_dm(path: Path) -> dict:
file_node = node.child_by_field_name("file")
raw = _read_include_path(file_node)
if raw:
norm = raw.replace("\\", "/").lstrip("./")
norm = re.sub(r"^\./", "", raw.replace("\\", "/"))
resolved = (path.parent / norm).resolve()
edge: dict = {
"source": file_nid,