fix: resume CBB batches after verified native release

This commit is contained in:
阿白叔 committed 2026-11-25 09:28:05 +08:00
1 parent c76b755f13
commit 5bab125122
18 files changed
+642 -60

No files matched your search

+36
View File
@@ -307,3 +307,39 @@ def test_arbitrary_guard_filename_is_preserved_and_primary(tmp_path, monkeypatch
with pytest.raises(locks.LibraryBusy):
locks.release_retained_library(library, tmp_path/'release')
assert marker.read_bytes() == b'{not a guard record'
def test_recovery_scope_uses_interrupted_block_instead_of_new_selection(tmp_path, monkeypatch):
from cbb_refresh_verify import library_lock as locks
library = tmp_path/'lib/lib.lmc'
library.parent.mkdir()
library.touch()
monkeypatch.setattr('cbb_refresh_verify.owner_probe.query_owners', lambda *_: [])
locks._persist_blocker(library, lease_id='a'*32, block_name='Interrupted')
proof = locks.release_retained_library(library, tmp_path/'evidence',
block_name='NewSelection', infer_scope=True)
assert proof['proof_scope'] == 'BLOCK'
assert proof['proof_block_names'] == ['Interrupted']
assert proof['reconciled_foreign_blockers'] == ['Interrupted']
def test_probe_timeout_reports_last_io_phase_and_path(tmp_path, monkeypatch):
from cbb_refresh_verify import file_probe
import sys
script = tmp_path/'slow_probe.py'
library = tmp_path/'lib.lmc'
script.write_text(
"import json, sys, time\n"
"from pathlib import Path\n"
"job = Path(sys.argv[-1])\n"
"job.with_name('progress.json').write_text(json.dumps("
"{'stage': 'open_exclusive', 'path': 'SymbolLibs/icdb.dat'}))\n"
"time.sleep(30)\n",
encoding='utf-8')
start = file_probe.subprocess.Popen
monkeypatch.setattr(file_probe.subprocess, 'Popen',
lambda command, **kwargs: start([sys.executable, str(script), command[-1]], **kwargs))
with pytest.raises(TimeoutError, match=r'FILE_PROBE_TIMEOUT.*open_exclusive.*SymbolLibs/icdb.dat'):
with file_probe.hold_release_files(library, timeout_seconds=.7):
pytest.fail('a timed-out probe cannot prove release')