fix: use extended filesystem paths for deep queue evidence

This commit is contained in:
阿白叔 committed 2026-10-23 16:09:29 +08:00
1 parent 3c4e6e7e37
commit c787ef325b
9 files changed
+208 -87

No files matched your search

@@ -1,4 +1,5 @@
from pathlib import Path
from dx_productivity.trial_task_center.path_access import strip_extended_prefix
import pytest
from dx_productivity.trial_task_center.models import ProjectRecord, ProjectStatus, RuleRecord
from dx_productivity.trial_task_center.quick_run import QuickRunPreparer
@@ -21,7 +22,7 @@ def test_snapshot_reads_each_file_once_and_uses_same_status(tmp_path, monkeypatc
opens = []
original = Path.open
def tracked(path, *args, **kwargs):
if path.parent == handoff.command_path.parent:
if Path(strip_extended_prefix(path)).parent == handoff.command_path.parent:
opens.append(path.name)
return original(path, *args, **kwargs)
monkeypatch.setattr(Path, 'open', tracked)
@@ -48,7 +49,7 @@ def test_snapshot_cancellation_stops_before_next_file_and_never_writes(tmp_path,
def tracked(path, *args, **kwargs):
opened.append(path.name)
result = original(path, *args, **kwargs)
if path == handoff.command_path:
if Path(strip_extended_prefix(path)) == handoff.command_path:
control.cancelled = True
return result
monkeypatch.setattr(Path, 'open', tracked)
@@ -91,7 +92,7 @@ def test_snapshot_retries_when_uncertain_flag_is_created_during_status_read(tmp_
injected = False
def racing_open(path, *args, **kwargs):
nonlocal injected
if path == handoff.status_path and args and args[0] == 'r' and not injected:
if Path(strip_extended_prefix(path)) == handoff.status_path and args and args[0] == 'r' and not injected:
injected = True
(path.parent / 'uncertain.flag').write_text('uncertain', encoding='utf-8')
return original(path, *args, **kwargs)
@@ -108,7 +109,7 @@ def test_snapshot_retries_command_and_status_as_one_generation(tmp_path, monkeyp
injected = False
def racing_open(path, *args, **kwargs):
nonlocal injected
if path == handoff.status_path and args and args[0] == 'r' and not injected:
if Path(strip_extended_prefix(path)) == handoff.status_path and args and args[0] == 'r' and not injected:
injected = True
handoff.command_path.write_text(command.replace(job, 'new-generation'), encoding='utf-8')
handoff.status_path.write_text('job_id\tstate\tcode\tmessage\nnew-generation\tno_match\t\tno match\n', encoding='utf-8')
@@ -126,7 +127,7 @@ def test_snapshot_continuous_changes_block_continuation_after_bounded_retries(tm
reads = 0
def racing_open(path, *args, **kwargs):
nonlocal reads
if path == handoff.status_path and args and args[0] == 'r':
if Path(strip_extended_prefix(path)) == handoff.status_path and args and args[0] == 'r':
reads += 1
(path.parent / 'changing.txt').write_text('x' * reads, encoding='utf-8')
return original(path, *args, **kwargs)