From a0386848bef83d20feaa7804eb95b3728a19d531 Mon Sep 17 00:00:00 2001 From: Osamaali313 Date: Fri, 17 Jul 2026 22:46:57 +0300 Subject: [PATCH] Fix DreamMaker parent-relative #include paths (lstrip charset misuse) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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. --- graphify/extractors/dm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphify/extractors/dm.py b/graphify/extractors/dm.py index 94d38627..7961022c 100644 --- a/graphify/extractors/dm.py +++ b/graphify/extractors/dm.py @@ -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,