fix: harden PCB and iCDB verification lifecycle for beta release

This commit is contained in:
阿白叔 committed 2026-10-26 15:32:01 +08:00
1 parent 11a2b2e46e
commit a11eb3c766
33 files changed
+1226 -267

No files matched your search

+13 -9
View File
@@ -32,13 +32,13 @@ class FakeProjectIntegration:
return True
def test_database_restoration_dialog_selects_last_saved_database():
def test_database_restoration_dialog_requires_manual_recovery():
action = choose_dialog_action(
'Database Restoration',
['Restore Database', 'Load the last user saved database dated 2026/9/3 19:32.',
'Load the autosave database dated 2026/9/3 19:32.', 'OK', 'Cancel'],
)
assert action == 'restore_last_saved'
assert action is None
def test_library_manager_fresh_pid_filter_rejects_stale_sessions():
@@ -77,14 +77,16 @@ def test_interactive_verify_focuses_library_manager_before_real_right_click():
assert calls == ['focus', 'select', ('click', 'right')]
def test_cleanup_verify_processes_terminates_worker_parent_and_lm(monkeypatch):
def test_cleanup_verify_processes_confirms_absent_worker_parent_and_lm(monkeypatch):
from cbb_refresh_verify import mentor_adapter
terminated = []
monkeypatch.setattr(mentor_adapter, '_terminate_pid',
lambda pid, **_kwargs: terminated.append(int(pid)))
cleanup_verify_processes(101, 202, 303, emit=lambda **event: None)
assert terminated == [202, 303, 101]
monkeypatch.setattr(mentor_adapter, '_process_details', lambda _name: ())
result = cleanup_verify_processes(101, 202, 303, emit=lambda **event: None)
assert terminated == []
assert result['safe_to_continue']
def test_cleanup_verify_processes_discovers_unbound_target_pcb_processes(monkeypatch):
@@ -106,7 +108,7 @@ def test_cleanup_verify_processes_discovers_unbound_target_pcb_processes(monkeyp
monkeypatch.setattr(mentor_adapter, '_terminate_pid',
lambda pid, **_kwargs: terminated.append(int(pid)))
mentor_adapter.cleanup_verify_processes(
result = mentor_adapter.cleanup_verify_processes(
101,
None,
None,
@@ -115,7 +117,9 @@ def test_cleanup_verify_processes_discovers_unbound_target_pcb_processes(monkeyp
emit=lambda **event: None,
)
assert terminated == [202, 303, 204, 101]
assert terminated == []
assert result['remaining_pids'] == [202, 204, 303]
assert not result['safe_to_continue']
def test_verify_cleanup_is_present_on_all_exit_paths():
@@ -279,11 +283,11 @@ def test_refresh_integration_never_accepts_initial_green_when_refresh_fails(fail
assert 'SynchCES' not in pi.actions
def test_refresh_integration_attempts_disabled_green_action_once():
def test_refresh_integration_skips_native_disabled_green_action():
pi = GreenProjectIntegration()
pi.IsForwardAnnotationAllowed = False
refresh_integration(pi, settle_seconds=0)
assert pi.actions == ['ForwardAnnotate']
assert pi.actions == []
def test_refresh_integration_never_counts_rejected_green_action_as_completed():