fix: scope release proofs and bind PCB opening consent
This commit is contained in:
1 parent
42d0cebc54
commit
466f400514
33 files changed
+1358
-61
No files matched your search
@@ -70,6 +70,28 @@ def test_verification_refuses_uploader_exclusive_lock_before_native_work(tmp_pat
|
||||
handle.Close()
|
||||
|
||||
|
||||
@pytest.mark.parametrize('checkpoint_matches',[True,False])
|
||||
def test_auto_verify_reuses_only_exact_active_parent_transaction(tmp_path,monkeypatch,checkpoint_matches):
|
||||
import json
|
||||
from cbb_refresh_verify import library_lock as locks,verify_runner as runner
|
||||
library=tmp_path/'library/lib.lmc';library.parent.mkdir();library.touch()
|
||||
calls=[]
|
||||
monkeypatch.setattr(runner,'_run_verify_serialized',lambda *a,**k:
|
||||
calls.append('verified') or runner.VerifyResult('PASS',library_flag='GREEN'))
|
||||
with locks.LibraryLock(library,block_name='A'):
|
||||
if not checkpoint_matches:
|
||||
marker=locks.blocker_path(library)
|
||||
value=json.loads(marker.read_text('utf-8'));value['lease_id']='b'*32
|
||||
marker.write_text(json.dumps(value),'utf-8')
|
||||
result=runner.run_verify(runner.VerifyRequest(library,'A',tmp_path/'evidence'))
|
||||
assert (result.status=='PASS') is checkpoint_matches,result.stderr
|
||||
assert calls==(['verified'] if checkpoint_matches else [])
|
||||
if not checkpoint_matches:
|
||||
# Restore only the fixture checkpoint so the enclosing test lease can exit.
|
||||
owner=locks._owners[locks.LibraryLock(library).key]
|
||||
value['lease_id']=owner['lease_id'];marker.write_text(json.dumps(value),'utf-8')
|
||||
|
||||
|
||||
def test_unsafe_verify_records_failure_without_persistent_library_blocker(tmp_path, monkeypatch):
|
||||
import json
|
||||
import cbb_refresh_verify.verify_runner as runner
|
||||
@@ -203,7 +225,8 @@ def test_release_rechecks_owners_after_database_handles_are_acquired(tmp_path, m
|
||||
calls = []
|
||||
def query(names):
|
||||
calls.append(1)
|
||||
return [] if len(calls) == 1 else [{'pid': 123456, 'name': 'cscript.exe', 'command': 'helper'}]
|
||||
return [] if len(calls) == 1 else [{'pid': 123456, 'name': 'cscript.exe',
|
||||
'command': 'cscript.exe close_failed_block.vbs'}]
|
||||
monkeypatch.setattr(probe, 'query_owners', query)
|
||||
with pytest.raises(locks.LibraryBusy, match='123456'):
|
||||
with locks._prove_library_released(library): pass
|
||||
|
||||
Reference in new issue
Block a user