release: prepare v0.2.4-beta.4 and guard late management signals
Ignore queued management completion after its Qt receiver is destroyed. Isolate unrelated WMI and file-proof latency in simulated lifecycle tests while retaining real occupancy and writer-barrier coverage. Validation: 2428 tests passed, compile and whitespace checks passed, scoped review clean. Field ICDB inconsistency and Windows 10/production SMB remain unaccepted.
This commit was merged in pull request #16.
This commit is contained in:
1 parent
fa1f662e1d
commit
14cacb1d1c
8 files changed
+84
-7
No files matched your search
@@ -9,6 +9,7 @@ from uuid import uuid4
|
||||
workspace = Path(sys.argv[1]).resolve()
|
||||
bundle_root = Path(sys.argv[2]).resolve()
|
||||
sys.path.insert(0, str(workspace/'src'))
|
||||
from cbb_refresh_verify import __version__
|
||||
exe = bundle_root/'dist/CbbRefreshVerify-Background/CbbRefreshVerify.exe'
|
||||
root = bundle_root/('smoke-' + uuid4().hex[:8])
|
||||
root.mkdir()
|
||||
@@ -64,7 +65,7 @@ finally:
|
||||
from PyInstaller.archive.readers import ZlibArchiveReader
|
||||
pyz = bundle_root/'build/CbbRefreshVerify/PYZ-00.pyz'
|
||||
code = ZlibArchiveReader(str(pyz)).extract('cbb_refresh_verify')
|
||||
assert '0.2.4b3' in code.co_consts
|
||||
assert __version__ in code.co_consts
|
||||
toc = ast.literal_eval((bundle_root/'build/CbbRefreshVerify/Analysis-00.toc').read_text('utf-8'))
|
||||
stack, rows = [toc], []
|
||||
while stack:
|
||||
@@ -77,6 +78,6 @@ while stack:
|
||||
stack.extend(value)
|
||||
assert rows and all(Path(row[1]).is_relative_to(workspace/'src') for row in rows)
|
||||
results['module_origins'] = {'status': 'passed', 'module_count': len(rows), 'source_root': str(workspace/'src')}
|
||||
results['version'] = '0.2.4b3'
|
||||
results['version'] = __version__
|
||||
(root/'result.json').write_text(json.dumps(results, ensure_ascii=False, indent=2), 'utf-8')
|
||||
print(json.dumps({'evidence': str(root/'result.json'), **results}, ensure_ascii=False), flush=True)
|
||||
@@ -91,6 +91,9 @@ def test_exited_verify_worker_outcome_read_is_bounded_and_releases_channel(tmp_p
|
||||
def poll(self): return 0
|
||||
def close(self): pass
|
||||
monkeypatch.setattr('cbb_refresh_verify.desktop_worker.DesktopWorker', ExitedWorker)
|
||||
# The fake worker has no native clients; cleanup probes are covered independently.
|
||||
monkeypatch.setattr('cbb_refresh_verify.verify_runner._cleanup_session_processes',
|
||||
lambda *args, **kwargs: {'safe_to_continue': True, 'remaining_pids': []})
|
||||
original = Path.read_text
|
||||
def read(path, *args, **kwargs):
|
||||
if path.name == 'outcome.json':
|
||||
@@ -221,6 +224,9 @@ def test_handed_off_worker_accepts_exact_controls_but_excludes_new_writers(tmp_p
|
||||
monkeypatch.setattr(sessions, '_request_native_cancel', answer)
|
||||
monkeypatch.setattr(sessions, 'query_process_snapshot', lambda: [row] if child[0].poll() is None else [])
|
||||
monkeypatch.setattr(sessions, '_process_windows', lambda _: {})
|
||||
# Keep this real writer-barrier/control test independent of file-probe startup latency.
|
||||
monkeypatch.setattr(sessions, '_finish_library_release',
|
||||
lambda *args, **kwargs: {'status': 'RELEASE_CONFIRMED', 'library': str(library)})
|
||||
command = lambda: sessions.release_residual_sessions(dict(library=str(library), sessions=[row]),
|
||||
tmp_path/'controls', cancel_native=True)
|
||||
def control_call():
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
"""Queued worker completion must not touch a destroyed management dialog."""
|
||||
import pytest
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
from shiboken6 import delete, isValid
|
||||
|
||||
|
||||
@pytest.mark.parametrize('failed', [False, True])
|
||||
def test_queued_management_completion_ignores_deleted_receiver(qtbot, tmp_path, monkeypatch, failed):
|
||||
from cbb_refresh_verify.management import ManagementRequest
|
||||
from cbb_refresh_verify.ui import timed_prompt
|
||||
from cbb_refresh_verify.ui.management_dialog import ManagementDialog
|
||||
|
||||
def run(*args, **kwargs):
|
||||
if failed:
|
||||
raise ValueError('simulated native-boundary failure')
|
||||
return []
|
||||
monkeypatch.setattr(timed_prompt, 'question', lambda *args, **kwargs: QMessageBox.Yes)
|
||||
dialog = ManagementDialog([ManagementRequest('remove', tmp_path/'library.lmc', 'Block',
|
||||
evidence_dir=tmp_path/'evidence')], runner=run)
|
||||
completed = []
|
||||
dialog.completed.connect(completed.append)
|
||||
try:
|
||||
dialog.execute_button.click()
|
||||
worker = dialog.worker # Retain the real sender while its queued signals are delivered.
|
||||
assert dialog.pool.waitForDone(3000)
|
||||
delete(dialog)
|
||||
assert not isValid(dialog)
|
||||
qtbot.wait(30)
|
||||
assert not completed
|
||||
finally:
|
||||
if isValid(dialog):
|
||||
delete(dialog)
|
||||
@@ -29,6 +29,8 @@ def test_soft_stop_finishes_current_transaction_and_skips_next(setup, qtbot, mon
|
||||
entered, release = Event(), Event()
|
||||
admitted, results = [], []
|
||||
monkeypatch.setattr(backup_recovery, '_idle_check', lambda *a, **kw: None)
|
||||
# Native work is simulated here; machine WMI latency is not the stop/readback boundary.
|
||||
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda names: [])
|
||||
monkeypatch.setattr(timed_prompt, 'question', lambda *a, **kw: QMessageBox.Yes)
|
||||
|
||||
class Worker:
|
||||
|
||||
Reference in new issue
Block a user