feat: add confirmed client release with durable consent and server protection

This commit is contained in:
阿白叔 committed 2026-11-05 23:31:36 +08:00
1 parent 282be7be7f
commit 173dee1980
54 files changed
+3909 -14

No files matched your search

+33
View File
@@ -78,6 +78,28 @@ def test_management_dialog_finish_waits_for_mapping_cleanup_without_freezing_fil
qtbot.waitUntil(lambda: window.pool.activeThreadCount() == 0)
def test_release_dialog_finish_cannot_clear_busy_before_mapping_cleanup(qtbot, tmp_path, monkeypatch):
window = load_window(qtbot, tmp_path, monkeypatch)
library = Path(window.mentor_lmc_path)
entered, release = Event(), Event()
main_thread = get_ident()
def restore(*args, **kwargs):
assert get_ident() != main_thread, 'mapping release blocked the Qt thread'
entered.set()
assert release.wait(3)
monkeypatch.setattr('cbb_refresh_verify.network_path.release_retained_path_leases', restore)
window.busy = True
try:
window._complete_library_release(library, {'status': 'RELEASE_CONFIRMED',
'library': str(library), 'evidence_path': 'proof.json'})
window._release_dialog_finished(0)
qtbot.waitUntil(entered.is_set)
assert window.busy and window.search_edit.isEnabled()
release.set()
qtbot.waitUntil(lambda: not window.busy)
finally:
release.set()
qtbot.waitUntil(lambda: window.pool.activeThreadCount() == 0)
def test_window_close_waits_asynchronously_for_retain_and_all_pool_work(qtbot, tmp_path, monkeypatch):
@@ -131,3 +153,14 @@ def test_duplicate_dialog_finish_schedules_only_one_catalog_reload(qtbot, tmp_pa
qtbot.waitUntil(lambda: window.pool.activeThreadCount() == 0)
def test_window_close_tolerates_fake_and_deleted_dialog_pools(qtbot, tmp_path, monkeypatch):
from PySide6.QtCore import QThreadPool
from shiboken6 import delete
window = load_window(qtbot, tmp_path, monkeypatch)
deleted_pool = QThreadPool()
delete(deleted_pool)
window.release_dialog = SimpleNamespace()
window.management_dialog = SimpleNamespace(pool=deleted_pool)
window.show()
window.close()
qtbot.waitUntil(lambda: not window.isVisible())