fix: bind manual recovery entries and current native diagnostics

This commit is contained in:
阿白叔 committed 2026-11-16 20:38:17 +08:00
1 parent 8374cabe5c
commit 601dd7b6b2
14 files changed
+694 -69

No files matched your search

+9 -3
View File
@@ -559,20 +559,26 @@ def test_queue_close_has_one_deadline_and_reports_pending_scope(tmp_path):
thread.join(2)
def test_real_management_transaction_does_not_handoff_between_remove_and_add(management_setup):
def test_real_management_transaction_does_not_handoff_between_remove_and_add(management_setup, monkeypatch):
from dataclasses import replace
from types import SimpleNamespace
from test_management import execute
from cbb_refresh_verify import operation_queue
from cbb_refresh_verify.operation_queue import BatchTaskContext, NativeQueue
request, adapter, source = management_setup
offset = [0.0]
real_clock = time.monotonic
monkeypatch.setattr(operation_queue, 'time', SimpleNamespace(monotonic=lambda: real_clock()+offset[0]))
original = adapter.remove
def slow_remove(*args):
result = original(*args)
time.sleep(.4)
offset[0] += 100 # Native time exceeds admission budget without timing filesystem preparation.
time.sleep(.08) # Let the real admission monitor observe the active native phase.
return result
adapter.remove = slow_remove # Native external boundary; transaction stays real.
context = BatchTaskContext(library=str(request.library), targets=('Block',))
result = NativeQueue().run(lambda: execute(replace(request, operation='update',
source=source, auto_verify=False), adapter), context=context, timeout_seconds=.2)
source=source, auto_verify=False), adapter), context=context, timeout_seconds=10)
assert result.status == 'UPLOADED'
assert adapter.calls[0] == 'remove' and adapter.calls[1][0] == 'add'