fix: preserve deep project scans and orphan recovery protection

This commit is contained in:
阿白叔 committed 2026-10-23 16:57:49 +08:00
1 parent 2a90201bfa
commit 3367bb6454
5 files changed
+116 -32

No files matched your search

+4 -3
View File
@@ -7,6 +7,7 @@ import subprocess
import pytest
from dx_productivity.trial_task_center.errors import TaskCenterError
from dx_productivity.trial_task_center.path_access import strip_extended_prefix
from dx_productivity.trial_task_center.scanner import scan_projects
@@ -58,7 +59,7 @@ def test_scan_projects_stops_at_selected_project_directory_when_it_contains_prj_
real_scandir = os.scandir
def reject_nested(path: str | bytes | int) -> object:
if Path(path) != root:
if Path(strip_extended_prefix(path)) != root:
raise AssertionError(f"unexpected nested scan: {path}")
return real_scandir(path)
@@ -84,7 +85,7 @@ def test_scan_projects_reads_batch_root_once_before_recursive_fallback(
def count_root(path: str | bytes | int) -> object:
nonlocal root_reads
if Path(path) == root:
if Path(strip_extended_prefix(path)) == root:
root_reads += 1
return real_scandir(path)
@@ -138,7 +139,7 @@ def test_scan_projects_turns_inaccessible_subtree_errors_into_explicit_task_erro
real_scandir = __import__("os").scandir
def deny(path: str | bytes | int) -> object:
if Path(path) == denied:
if Path(strip_extended_prefix(path)) == denied:
raise PermissionError("denied subtree")
return real_scandir(path)