fix: decouple CBB imports from optional export diagnostics

This commit is contained in:
阿白叔 committed 2026-11-13 15:29:00 +08:00
1 parent cbc5723849
commit 1572e2d8ca
12 files changed
+601 -65

No files matched your search

+12 -4
View File
@@ -389,16 +389,24 @@ def run_management(request, *, adapter=None, verifier=None, idle_check=None, pro
owner_safe = after.safe_to_continue
matches = [entry for entry in after.entries if entry.name == request.name
and entry.partition == request.partition]
proof_matches = (native.identity_matches is True and native.identity_proof == identity
expected_proof, registered_proof = identity, native.identity_proof
if isinstance(identity, dict) and identity.get('policy') == 'mentor795-import-assets-v1':
expected_proof = {key: value for key, value in identity.items() if key != 'assets'}
registered_proof = ({key: value for key, value in registered_proof.items() if key != 'assets'}
if isinstance(registered_proof, dict) else None)
# Library Manager may name the imported top block after the CBB.
if registered_proof is not None and registered_proof.get('top_level_block') == request.name:
expected_proof['top_level_block'] = request.name
proof_matches = (native.identity_matches is True and registered_proof == expected_proof
if hasattr(adapter, 'prepare_add_transaction') else
len(matches) == 1 and matches[0].engineering_identity == identity)
if (not owner_safe or Path(after.library).resolve() != canonical_library or after.flow != 1
or len(matches) != 1 or not proof_matches):
return finish('RECOVERY_REQUIRED', '原生新增后名称、分区或来源工程内容未确认一致。', owner_safe)
return finish('RECOVERY_REQUIRED', '原生新增后名称、分区或工程关联未确认一致。\n'+native.detail, owner_safe)
uploaded = True
checkpoint('uploaded')
if not request.auto_verify:
return finish('UPLOADED', '上传已确认;本批次未启用自动校验。')
return finish('UPLOADED', '上传已确认;本批次未启用自动校验。\n'+native.detail)
# Adapter catalog cannot return until its exact native owner exits.
checkpoint('verify')
owner_safe = False
@@ -410,7 +418,7 @@ def run_management(request, *, adapter=None, verifier=None, idle_check=None, pro
checkpoint('verified', verification=asdict(verified))
good = verified.status == 'PASS' and verified.library_flag == 'GREEN' and owner_safe
return finish('UPLOADED_VERIFIED' if good else 'UPLOADED_VERIFY_FAILED',
verified.stderr or verified.library_flag_detail, owner_safe)
'\n'.join(filter(None, (native.detail, verified.stderr or verified.library_flag_detail))), owner_safe)
except Exception as error:
if uploaded:
return finish('UPLOADED_VERIFY_FAILED', str(error), owner_safe)