diff --git a/graphify/cli.py b/graphify/cli.py index 5b733972..454c900d 100644 --- a/graphify/cli.py +++ b/graphify/cli.py @@ -2274,7 +2274,11 @@ def dispatch_command(cmd: str) -> None: # Try to recover the scan root saved by the last full build saved = Path(_GRAPHIFY_OUT) / ".graphify_root" if saved.exists(): - watch_path = Path(saved.read_text(encoding="utf-8").strip()) + # utf-8-sig: a marker written by Windows PowerShell 5.1 carries a + # UTF-8 BOM that plain utf-8 keeps as U+FEFF (not stripped by + # .strip()), which would make this recovered path fail exists() + # (#3028). Match the other .graphify_root readers. + watch_path = Path(saved.read_text(encoding="utf-8-sig").strip()) else: watch_path = Path(".") if not watch_path.exists(): diff --git a/tests/test_skillgen.py b/tests/test_skillgen.py index 5a960aac..63a6f7c1 100644 --- a/tests/test_skillgen.py +++ b/tests/test_skillgen.py @@ -1107,10 +1107,10 @@ def test_windows_skill_writes_marker_files_without_a_bom(): """ core, _ = _platform_artifacts("windows") for marker in (".graphify_python", ".graphify_root"): - assert f"Out-File -FilePath graphify-out\{marker} -Encoding utf8" not in core, ( + assert f"Out-File -FilePath graphify-out\\{marker} -Encoding utf8" not in core, ( f"the windows render still writes {marker} with a BOM-emitting Out-File" ) - assert f"WriteAllText((Join-Path $PWD 'graphify-out\{marker}')" in core, ( + assert f"WriteAllText((Join-Path $PWD 'graphify-out\\{marker}')" in core, ( f"{marker} must be written through WriteAllText with a BOM-less encoding" ) assert "New-Object System.Text.UTF8Encoding $false" in core, \