fix: supervise management calls across cancellation and parent loss

This commit is contained in:
阿白叔 committed 2026-11-06 15:42:36 +08:00
1 parent 8d3eab1164
commit 6278091f21
8 files changed
+297 -24

No files matched your search

+4 -2
View File
@@ -384,7 +384,8 @@ def test_native_catalog_only_uses_com_records_and_checks_exact_process(tmp_path,
monkeypatch.setattr(mentor, '_process_details', lambda _: [(123, str(tmp_path/'lm/win32/bin/LibraryManager.exe'), '', 0)] if state['running'] else [])
monkeypatch.setattr(native, '_wait_native_exit', lambda _: not state['running'])
result = native._catalog_native({'operation': 'catalog', 'library': str(library_path),
'desktop': 'CbbManagement_test', 'mentor_home': str(tmp_path)}, tmp_path)
'desktop': 'CbbManagement_test', 'mentor_home': str(tmp_path),
'supervisor_pid': __import__('os').getpid()}, tmp_path)
assert result['success'] and result['safe_to_continue']
assert [(entry['name'], entry['partition']) for entry in result['entries']] == records
assert result['flow'] == flow
@@ -461,7 +462,8 @@ def test_shared_add_reopens_exact_catalog_and_reports_identity_mismatch(tmp_path
monkeypatch.setattr(native, 'validate_owned_fixture_add', lambda *a: None)
result = native._catalog_com({'operation': 'add', 'library': str(library_path),
'desktop': 'CbbManagement_test', 'mentor_home': str(tmp_path),
'name': 'Block', 'partition': 'Logical-Physical', 'source_identity': {'expected': 'bytes'}}, tmp_path)
'name': 'Block', 'partition': 'Logical-Physical', 'source_identity': {'expected': 'bytes'},
'supervisor_pid': __import__('os').getpid()}, tmp_path)
assert events == ['open', 'add', 'close', 'open', 'catalog', 'close']
assert result['success'] is registered
assert result['identity_matches'] is False