fix: decouple CBB imports from optional export diagnostics
This commit is contained in:
1 parent
cbc5723849
commit
1572e2d8ca
12 files changed
+601
-65
No files matched your search
@@ -1,7 +1,7 @@
|
||||
"""Version-pinned native adapter, private desktop transport and strict catalog.
|
||||
"""Version-pinned native import/removal, private desktop transport and catalog.
|
||||
|
||||
The installed Tcl CleanWGLib/F4 contract has isolated removal proof. Discovery
|
||||
of an Add dialog is deliberately insufficient to enable production Add/Update.
|
||||
Normal import checks native registration and engineering files without invoking
|
||||
the independent schematic exporters. Optional Verify determines READY.
|
||||
"""
|
||||
from dataclasses import asdict, replace
|
||||
import ctypes
|
||||
@@ -131,17 +131,12 @@ class NativeManagementAdapter:
|
||||
|
||||
def capabilities(self):
|
||||
reason = self._binary_capability()
|
||||
add_reason = reason
|
||||
if not add_reason:
|
||||
from .native_engineering_identity import check_exporters
|
||||
try: check_exporters(self.home)
|
||||
except (ValueError, OSError, TypeError) as error: add_reason = str(error)
|
||||
return {
|
||||
'remove': Capability(not reason, reason or '已验证 CleanWGLib/F4;仅 ASCII 名称、Logical-Physical 和 DxDesigner 库。'),
|
||||
'add': Capability(not add_reason and _PRODUCTION_ADD_VALIDATED, add_reason or
|
||||
'已验证 EE7.9.5 原生导入及完整工程复读;仅 ASCII 名称、Logical-Physical 和 DxDesigner 库。'),
|
||||
'update': Capability(not add_reason and _PRODUCTION_ADD_VALIDATED and _PRODUCTION_UPDATE_VALIDATED,
|
||||
add_reason or '已验证同名原生替换:移除并重新导入;操作前请手动备份。'),
|
||||
'add': Capability(not reason and _PRODUCTION_ADD_VALIDATED, reason or
|
||||
'EE7.9.5 原生导入及工程关联复读;仅 ASCII 名称、Logical-Physical 和 DxDesigner 库。'),
|
||||
'update': Capability(not reason and _PRODUCTION_ADD_VALIDATED and _PRODUCTION_UPDATE_VALIDATED,
|
||||
reason or '同名原生替换:移除并重新导入;操作前请手动备份。'),
|
||||
}
|
||||
|
||||
def _worker(self, job, evidence):
|
||||
@@ -310,7 +305,7 @@ class NativeManagementAdapter:
|
||||
return self._add_transaction(request, Path(evidence))
|
||||
|
||||
def prepare_add_transaction(self, request, root, *, original_source):
|
||||
from .native_engineering_identity import project_library, asset_identity, capture_identity, IdentityOutcome
|
||||
from .native_engineering_identity import asset_identity, capture_registration_identity, IdentityOutcome
|
||||
from .native_add_failures import validate_native_copy_paths
|
||||
from .management_transaction import current_lease, prepare_transaction
|
||||
from .management import source_project
|
||||
@@ -320,7 +315,8 @@ class NativeManagementAdapter:
|
||||
raise ValueError(self.capabilities()['add'].reason)
|
||||
validate_native_copy_paths(request.source, request.library, request.name)
|
||||
current_lease(request.library)
|
||||
original_assets = asset_identity(original_source, project_library(original_source))
|
||||
# The selected destination replaces old library paths in the staged copy.
|
||||
original_assets = asset_identity(original_source, None)
|
||||
staged, pcb, _ = source_project(request.source, request.top_level_block)
|
||||
if staged.parent != Path(root).resolve()/'source':
|
||||
raise ValueError('Only the engine staged source can be aligned for native Add.')
|
||||
@@ -329,8 +325,7 @@ class NativeManagementAdapter:
|
||||
raise ValueError('Staged engineering assets differ from the original source.')
|
||||
except Exception as error:
|
||||
return request, IdentityOutcome(None, True, str(error), Path(root))
|
||||
proof = capture_identity(staged, Path(root)/'source-identity', expected_library=request.library,
|
||||
owner_library=request.library, mentor_home=self.home, timeout_seconds=request.timeout_seconds)
|
||||
proof = capture_registration_identity(staged, Path(root)/'source-identity', expected_library=request.library)
|
||||
if proof.identity is None or not proof.safe_to_continue:
|
||||
return request, proof
|
||||
try:
|
||||
@@ -344,7 +339,7 @@ class NativeManagementAdapter:
|
||||
from contextlib import contextmanager
|
||||
from .management_transaction import validate_transaction
|
||||
from .library_lock import LibraryLock
|
||||
from .native_engineering_identity import capture_identity, project_library
|
||||
from .native_engineering_identity import capture_registration_identity, project_library
|
||||
from .management import source_project
|
||||
from .backup_recovery import _align_library, _idle_check
|
||||
try:
|
||||
@@ -383,7 +378,7 @@ class NativeManagementAdapter:
|
||||
if len(projects) != 1:
|
||||
return NativeOutcome(True, owner_safe, 'Registered engineering project is not unique.',
|
||||
identity_matches=False, evidence_path=evidence)
|
||||
target, pcb, _ = source_project(projects[0], request.top_level_block)
|
||||
target, pcb, _ = source_project(projects[0])
|
||||
_idle_check(request.library, target, pcb)
|
||||
from .maintenance_entry import maintenance_project_files
|
||||
project_files = maintenance_project_files(target, pcb)
|
||||
@@ -401,18 +396,31 @@ class NativeManagementAdapter:
|
||||
or catalog.flow != 1 or len(entries) != 1):
|
||||
return NativeOutcome(True, owner_safe, 'Aligned target did not reopen with the exact catalog identity.',
|
||||
identity_matches=False, evidence_path=evidence)
|
||||
owner_safe = False
|
||||
proof = capture_identity(target, evidence/'registered-identity', expected_library=request.library,
|
||||
owner_library=request.library, mentor_home=self.home, timeout_seconds=request.timeout_seconds)
|
||||
proof = capture_registration_identity(target, evidence/'registered-identity', expected_library=request.library)
|
||||
owner_safe = proof.safe_to_continue
|
||||
matched = proof.identity is not None and proof.identity == prepared['expected_identity']
|
||||
expected, registered = prepared['expected_identity'], proof.identity
|
||||
# Native Add rewrites PRJ metadata and runtime history. Registration
|
||||
# identity uses the top block and Layout; other file diffs are evidence.
|
||||
allowed_tops = (expected['top_level_block'], request.name)
|
||||
matched = (registered is not None and registered['top_level_block'] in allowed_tops
|
||||
and registered['layout_sha256'] == expected['layout_sha256'])
|
||||
before_assets, after_assets = expected['assets'], (registered or {}).get('assets', {})
|
||||
differences = {'added': sorted(after_assets.keys()-before_assets.keys()),
|
||||
'deleted': sorted(before_assets.keys()-after_assets.keys()),
|
||||
'modified': sorted(key for key in before_assets.keys() & after_assets.keys()
|
||||
if before_assets[key] != after_assets[key])}
|
||||
assets_match = registered is not None and not any(differences.values())
|
||||
_write_json(evidence/'identity-comparison.json', {'identity_matches': matched,
|
||||
'expected': prepared['expected_identity'], 'registered': proof.identity,
|
||||
'assets_match': assets_match, 'asset_differences': differences,
|
||||
'top_level_block_mapping': {'source': expected['top_level_block'],
|
||||
'registered': (registered or {}).get('top_level_block'), 'allowed': list(allowed_tops)},
|
||||
'expected': expected, 'registered': registered,
|
||||
'safe_to_continue': owner_safe, 'detail': proof.detail})
|
||||
return NativeOutcome(True, owner_safe,
|
||||
'Native ASCII/CSV/EDIF, physical assets and library references match.' if matched else
|
||||
'Native registration succeeded but complete engineering identity proof did not match: '+proof.detail,
|
||||
identity_matches=matched, evidence_path=evidence, identity_proof=proof.identity)
|
||||
('原生注册、工程关联、顶层块和 Layout 已确认;未核验原理图语义。'
|
||||
+ ('其他工程文件有差异,已记录供核对。' if not assets_match else '')) if matched else
|
||||
'原生注册成功,但工程关联、顶层块或 Layout 未确认一致:'+proof.detail,
|
||||
identity_matches=matched, evidence_path=evidence, identity_proof=registered)
|
||||
|
||||
def add_owned_fixture(self, request, evidence, *, probe_token):
|
||||
"""Research only: stage and back up a token-bound, actively leased fixture."""
|
||||
@@ -463,13 +471,10 @@ class _OwnedFixtureManagementAdapter(NativeManagementAdapter):
|
||||
|
||||
def capabilities(self):
|
||||
from .management_transaction import fixture_authority
|
||||
from .native_engineering_identity import check_exporters
|
||||
fixture = self._fixture_authority
|
||||
fixture_authority(fixture['root'], Path(fixture['root'])/'native-add/fixture/mentor_lib.lmc', fixture['token'])
|
||||
caps = super().capabilities()
|
||||
reason = self._binary_capability()
|
||||
try: check_exporters(self.home)
|
||||
except (ValueError, OSError) as error: reason = str(error)
|
||||
for operation in ('add', 'update'):
|
||||
caps[operation] = Capability(not reason, reason or 'Owned fixture engine validation only; production capability unchanged.')
|
||||
return caps
|
||||
|
||||
Reference in new issue
Block a user