feat: integrate native diagnostics and coordinated CBB transactions
This commit is contained in:
1 parent
9e230e1a46
commit
da67de026f
91 files changed
+14370
-435
No files matched your search
@@ -1,22 +1,41 @@
|
||||
"""Reports for the explicit full-library maintenance action."""
|
||||
"""Reports for the explicit visible non-READY maintenance action."""
|
||||
from dataclasses import asdict
|
||||
import json
|
||||
|
||||
|
||||
def maintenance_counts(results):
|
||||
attempts = [attempt for result in results for attempt in result.recovery_attempts]
|
||||
repaired = sum(attempt.get('status') == 'REPAIRED' for attempt in attempts)
|
||||
repaired = sum(attempt.get('status') == 'REPAIRED'
|
||||
and attempt.get('native_status') == 'REPAIRED'
|
||||
and attempt.get('validation_passed') is True
|
||||
and result.status == 'PASS' and result.library_flag == 'GREEN'
|
||||
and result.safe_to_continue
|
||||
for result in results for attempt in result.recovery_attempts)
|
||||
review = sum(attempt.get('status') == 'RESTORED_REVIEW_REQUIRED' for attempt in attempts)
|
||||
version_choice = sum(attempt.get('status') == 'PCB_VERSION_CHOICE_REQUIRED'
|
||||
and attempt.get('native_status') == 'REPAIRED'
|
||||
and attempt.get('validation_passed') is False for attempt in attempts)
|
||||
pending = sum(attempt.get('status') == 'REPAIRED_UNVERIFIED'
|
||||
and attempt.get('native_status') == 'REPAIRED' for attempt in attempts)
|
||||
return {'total': len(results), 'passed': sum(r.status == 'PASS' for r in results),
|
||||
'checked_without_repair': sum(r.status == 'CHECKED' for r in results),
|
||||
'issues_found': sum(r.error_category == 'ICDB_REPAIR_REQUIRED' for r in results),
|
||||
'in_use': sum(r.error_category == 'ICDB_DATABASE_IN_USE' for r in results),
|
||||
'unconfirmed': sum(r.status not in ('CHECKED', 'SKIPPED', 'CANCELLED')
|
||||
and r.error_category not in ('ICDB_REPAIR_REQUIRED', 'ICDB_DATABASE_IN_USE') for r in results),
|
||||
'cancelled': sum(r.status == 'CANCELLED' for r in results),
|
||||
'skipped': sum(r.status == 'SKIPPED' for r in results),
|
||||
'repaired': repaired, 'review_required': review,
|
||||
'repair_unconfirmed': len(attempts)-repaired-review}
|
||||
'version_choice_required': version_choice,
|
||||
'repaired_unverified': pending,
|
||||
'repair_unconfirmed': len(attempts)-repaired-review-version_choice-pending}
|
||||
|
||||
|
||||
def write_maintenance_report(requests, results, batch_report, skipped_names):
|
||||
path = batch_report.with_name(batch_report.name.replace('batch-', 'icdb-', 1)).with_suffix('.json')
|
||||
record = {'operation': 'full_library_icdb_check_and_repair',
|
||||
'library': str(requests[0].lmc_file), 'includes_ready': True,
|
||||
record = {'operation': 'visible_non_ready_icdb_batch_check', 'automatic_repair': False,
|
||||
'library': str(requests[0].lmc_file), 'includes_ready': False,
|
||||
'target_names': [request.block_name for request in requests],
|
||||
'shared_database_repair_supported': False,
|
||||
'preflight_skipped': sorted(skipped_names), 'counts': maintenance_counts(results),
|
||||
'results': [{'block': req.block_name, **asdict(result)}
|
||||
|
||||
Reference in new issue
Block a user