#!/usr/bin/env python3 """Adapt the training suite to explicit IDs from an isolated Studio import. This utility only reads/writes local JSON. It does not contact Cohuno or execute an application. Preserve the unmodified suite for native offline qualification. """ import argparse import json import re from pathlib import Path p = argparse.ArgumentParser(description=__doc__) p.add_argument('--main', required=True, help='Actual Process ID of Orders training · HTTP intake') p.add_argument('--normalize', required=True, help='Actual Process ID of Orders training · Normalize order') p.add_argument('--shape', required=True, help='Actual Process ID of Orders training · Shape response') p.add_argument('--source', type=Path, default=Path(__file__).with_name('orders-training.cases.json')) p.add_argument('--output', type=Path, required=True) a = p.parse_args() ids = {'main': a.main, 'normalize_order': a.normalize, 'shape_response': a.shape} if any(not re.fullmatch(r'[A-Za-z_][A-Za-z0-9_-]{0,63}', value) for value in ids.values()) or len(set(ids.values())) != 3: p.error('Provide three distinct valid Process IDs copied from the imported project.') data = json.loads(a.source.read_text()) for case in data['cases']: if case['process_id'] not in ids: p.error('Unexpected entry process in suite; review it manually.') case['process_id'] = ids[case['process_id']] for key in ('verify', 'mocks'): for item in case.get(key, []): if item.get('process_id') in ids: item['process_id'] = ids[item['process_id']] with a.output.open('x') as f: json.dump(data, f, indent=2) f.write('\n') print(f'Wrote {a.output}; {len(data["cases"])} simulation cases. Nothing was executed.')