fix: reconcile native save release and resume affected CBB batches

This commit is contained in:
阿白叔 committed 2026-11-24 13:34:56 +08:00
1 parent 443668aa4b
commit c76b755f13
16 files changed
+655 -36

No files matched your search

+33
View File
@@ -1,5 +1,6 @@
"""Known native database owners touched by a CBB verification operation."""
from pathlib import Path
import time
def session_resource_scope(job):
@@ -33,6 +34,36 @@ def unreleased_addresses(lmc_file, project, pcb):
if (path/'cdbsvr/sAddress.adr').exists()]
def wait_for_saved_database_release(library, project, pcb, *, stop=None,
report_pending=lambda **event: None, timeout_seconds=75):
"""Check scoped files after PCB exits, outside the host native channel."""
from .file_probe import hold_release_files
from .operation_queue import note_metadata_progress
deadline = time.monotonic() + timeout_seconds
reported = None
while True:
try:
with hold_release_files(library, saved_project=(project, pcb), timeout_seconds=deadline-time.monotonic(),
stop=stop) as proof:
return {**proof, 'status': 'RELEASE_CONFIRMED', 'blocked_resources': []}
except (OSError, ValueError) as error:
winerror = getattr(error, 'winerror', None)
blocked = getattr(error, 'blocked_resources', [])
remaining = deadline - time.monotonic()
if winerror not in (32, 33) or remaining <= 0:
return {'status': 'IN_USE' if winerror in (32, 33) else 'UNCONFIRMED',
'detail': str(error), 'winerror': winerror, 'blocked_resources': blocked}
if stop is not None and stop.is_set():
return {'status': 'UNCONFIRMED', 'detail': '已取消释放检查',
'blocked_resources': blocked}
note_metadata_progress()
if blocked != reported:
report_pending(blocked_resources=blocked)
reported = blocked
time.sleep(min(1, remaining))
def inspect_release_addresses(snapshot, *, stop=None):
"""An address is a reason for native inspection, never an occupancy verdict."""
import tempfile
@@ -42,6 +73,8 @@ def inspect_release_addresses(snapshot, *, stop=None):
results = []
for item in snapshot['inspection_targets']:
if item.get('scope') == 'shared_symbols':
if item['address'] in snapshot.get('shared_shutdowns', {}):
continue
raise LibraryBusy('SHARED_ICDB_INSPECTION_UNAVAILABLE: 共享符号库地址需要原生核对:'
+ item['address'])
target = RepairTarget(Path(item['project']), Path(item['database']))