fix: narrow cross-item and cross-library blockers
This commit is contained in:
1 parent
53118bae19
commit
aea6192ef9
8 files changed
+178
-15
No files matched your search
@@ -13,8 +13,9 @@ import stat
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
def assert_native_idle():
|
||||
def assert_native_idle(target=None):
|
||||
from .owner_probe import query_owners
|
||||
from .failed_session import _command_args
|
||||
from .native_management import _retained_workers
|
||||
from .native_export_guard import assert_retained_exports_idle
|
||||
from .native_engineering_identity import _OWNER_NAMES
|
||||
@@ -33,10 +34,28 @@ def assert_native_idle():
|
||||
if not automation or not command or any(flag in command for flag in (
|
||||
'--verify-worker', '--repair-worker', '--management-worker')):
|
||||
owners.append(item)
|
||||
if target is not None:
|
||||
expected = os.path.normcase(os.path.abspath(str(target.project)))
|
||||
scoped = []
|
||||
for item in owners:
|
||||
command = str(item.get('command') or '')
|
||||
if not command:
|
||||
scoped.append(item)
|
||||
elif expected in [os.path.normcase(os.path.abspath(arg)) for arg in _command_args(command)[1:]]:
|
||||
scoped.append(item)
|
||||
owners = scoped
|
||||
if owners:
|
||||
raise ValueError(f'MAINTENANCE_OWNER_ACTIVE: 请正常关闭原生程序/操作助手:{owners}')
|
||||
|
||||
|
||||
def _assert_native_idle_for(target):
|
||||
"""Keep test/third-party zero-argument idle probes compatible."""
|
||||
import inspect
|
||||
if not inspect.signature(assert_native_idle).parameters:
|
||||
return assert_native_idle()
|
||||
return assert_native_idle(target)
|
||||
|
||||
|
||||
def address_snapshot(paths):
|
||||
from .scoped_manifest import hash_file
|
||||
return {str(path.resolve()): {'sha256': hash_file(path), 'size': path.stat().st_size,
|
||||
@@ -173,7 +192,7 @@ def maintenance_target_guard(request, expected=None, *, stop=None):
|
||||
for p in (pcb, *maintenance_project_files(project, pcb))}}
|
||||
if expected is not None and context != expected:
|
||||
raise ValueError('MAINTENANCE_SOURCE_CHANGED: 目标或地址记录在检查后变化')
|
||||
assert_native_idle()
|
||||
_assert_native_idle_for(target)
|
||||
check()
|
||||
def native_files(snapshot):
|
||||
return {path for path, info in snapshot.items() if stat.S_ISREG(info.st_mode) and (
|
||||
@@ -185,7 +204,7 @@ def maintenance_target_guard(request, expected=None, *, stop=None):
|
||||
handle = win32file.CreateFile(str(path), win32con.GENERIC_READ, 0, None,
|
||||
win32con.OPEN_EXISTING, win32con.FILE_ATTRIBUTE_NORMAL, None)
|
||||
stack.callback(handle.Close)
|
||||
assert_native_idle()
|
||||
_assert_native_idle_for(target)
|
||||
current = maintenance_entries(request, check=check)
|
||||
if native_files(current) != files:
|
||||
raise ValueError('MAINTENANCE_SOURCE_CHANGED: 检查期间库文件集合发生变化')
|
||||
@@ -411,7 +430,7 @@ def run_existing_address_maintenance(request, *, diagnosed_target, startup_resul
|
||||
recovery = run_native_repair(target, native_root, mentor_bin=request.mentor_bin,
|
||||
timeout_seconds=max(60, request.timeout_seconds), progress=native_event,
|
||||
maintenance_context=context, stop=stop)
|
||||
assert_native_idle()
|
||||
_assert_native_idle_for(target)
|
||||
recovery = {**recovery, 'native_status': recovery.get('status'), 'validation_passed': False}
|
||||
recovery['release'] = repair_release_state(request, target, recovery)
|
||||
safe = recovery['release'].get('safe_to_continue') is True
|
||||
|
||||
Reference in new issue
Block a user