]> dreyeck.freedombox.rocks Git - topic-maps.git/blob - scripts/validate-slice-21m.py
Integrate qualified XML anyType values into the XTM reader
[topic-maps.git] / scripts / validate-slice-21m.py
1 #!/usr/bin/env python3
2 """Validate XTM Topic Name Reification originals through the existing ASDF/Case Record harness.
3
4 The driver checks and retains execution evidence; Lisp performs all parsing,
5 model construction and conformance classification. Historical reports are inputs.
6 """
7 import argparse
8 import datetime
9 import hashlib
10 import importlib.util
11 import json
12 import os
13 from pathlib import Path
14 import re
15 import shutil
16 import subprocess
17 import sys
18 import tempfile
19
20 sys.dont_write_bytecode = True
21 ROOT = Path(__file__).resolve().parents[1]
22 EVIDENCE = ROOT / 'reports/slice-21m'
23 PRIOR = ROOT / 'reports/slice-21l'
24 BASE = '6e7c8fc9f247a3e4419299caa7836366573c8c63'
25 POLICY = '(version 1)(allow default)(deny network*)(deny file-write* (subpath "' + str(ROOT) + '"))'
26 ALLOWED = {'src/xtm/reader.lisp', 'tests/xtm-identity.lisp', 'tests/ctm-xtm-mergemap.lisp', 'topic-maps.asd',
27 'tests/xtm-names.lisp', 'tests/xtm-name-scopes.lisp', 'tests/xtm-name-item-identities.lisp', 'tests/xtm-map-reification.lisp'}
28 CTM = {'pass': 262, 'fail': 4, 'unsupported': 0, 'not-run': 7}
29 TARGETS = ['xtm2/in/name-reifier.xtm', 'xtm2/in/name-duplicate-reified.xtm']
30 EXPLORATORY = ['xtm2/in/name-duplicate-reified' + n + '.xtm' for n in ['2', '3', '4']]
31
32
33 def read(p):
34 return json.loads(p.read_text())
35
36
37 def save(p, v):
38 p.write_text(json.dumps(v, indent=2, ensure_ascii=False) + '\n')
39
40
41 def sha(p):
42 return hashlib.sha256(p.read_bytes()).hexdigest()
43
44
45 def command(args):
46 return subprocess.check_output(args, cwd=ROOT, text=True).strip()
47
48
49 def prepare_pinned(target):
50 spec = importlib.util.spec_from_file_location('slice21g', ROOT / 'scripts/validate-slice-21l.py')
51 module = importlib.util.module_from_spec(spec)
52 spec.loader.exec_module(module)
53 return module.prepare_pinned(target)
54
55
56 def main():
57 parser = argparse.ArgumentParser(description=__doc__)
58 parser.add_argument('--sbcl', default=os.environ.get('SBCL', 'sbcl'))
59 parser.add_argument('--output', type=Path)
60 parser.add_argument('--prepare', type=Path)
61 args = parser.parse_args()
62 if args.prepare:
63 print(json.dumps(prepare_pinned(args.prepare)))
64 return
65 runtime = shutil.which(args.sbcl)
66 assert runtime and command([runtime, '--version']) == 'SBCL 2.5.4'
67 subprocess.run(['git', 'merge-base', '--is-ancestor', BASE, 'HEAD'], cwd=ROOT, check=True)
68 output = args.output.resolve() if args.output else Path(tempfile.mkdtemp(prefix='topic-maps-21m-'))
69 assert not output.is_relative_to(ROOT)
70 output.mkdir(parents=True, exist_ok=True)
71 assert not (output / 'execution.json').exists(), 'Choose an unused output directory.'
72 tracked = command(['git', 'ls-tree', '-r', '--name-only', BASE]).splitlines()
73 assert set(command(['git', 'diff', '--name-only', BASE]).splitlines()) & set(tracked) <= ALLOWED
74 protected = {p: sha(ROOT / p) for p in tracked if p not in ALLOWED}
75 historical = {p: h for p, h in protected.items() if p.startswith('reports/')}
76 sources = {p: sha(ROOT / p) for p in [*sorted(ALLOWED), 'tests/xtm-name-reification.lisp', 'scripts/validate-slice-21m.py',
77 *['reports/slice-21m/' + p for p in ['candidate-inventory.json', 'api-preflight.lisp', 'failure-controls.lisp', 'diagnostics.lisp',
78 'before-diagnostics.json', 'baseline-xtm.json', 'retargeted-controls.json']]]}
79 previous = read(PRIOR / 'xtm.json')
80 assert read(EVIDENCE / 'baseline-xtm.json') == previous
81 assert previous['statuses'] == {'pass': 63, 'fail': 0, 'unsupported': 0, 'not-run': 0}
82 assert previous['otherCorpusInputs'] == {'positiveUnexecuted': 58, 'negativeUnregisteredUnexecuted': 3}
83 assert read(PRIOR / 'ctm.validation.json')['statuses'] == CTM
84 candidate = read(EVIDENCE / 'candidate-inventory.json')
85 assert [c['id'] for c in candidate['candidates']] == TARGETS
86 assert [c['sourceBytes'] for c in candidate['candidates']] == [180, 251]
87 assert [c['baselineBytes'] for c in candidate['candidates']] == [434, 435]
88 assert not set(TARGETS) & {c['id'] for c in previous['cases']}
89 assert read(EVIDENCE / 'before-diagnostics.json') == read(PRIOR / 'after-diagnostics.json')
90 started = datetime.datetime.now(datetime.timezone.utc).isoformat()
91 runs = []
92
93 def run(label, invocation, env, expected_exit=0):
94 invocation = ['/usr/bin/sandbox-exec', '-p', POLICY] + invocation
95 entry = {'label': label, 'command': invocation, 'network': 'denied', 'repositoryWrites': 'denied',
96 'freshProcess': True, 'startedAtUTC': datetime.datetime.now(datetime.timezone.utc).isoformat()}
97 result = subprocess.run(invocation, cwd=ROOT, env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, timeout=300)
98 (output / (label + '.log')).write_bytes(result.stdout)
99 entry.update(exitCode=result.returncode, expectedExitCode=expected_exit,
100 finishedAtUTC=datetime.datetime.now(datetime.timezone.utc).isoformat())
101 runs.append(entry)
102 assert result.returncode == expected_exit, f'{label}: see {output / (label + ".log")}'
103 return result.stdout.decode()
104
105 retained = output / 'retained'
106 retained.mkdir()
107 env = {k: v for k, v in os.environ.items() if not k.startswith('TOPIC_MAPS_')}
108 env.update(PYTHONDONTWRITEBYTECODE='1', GIT_OPTIONAL_LOCKS='0', SBCL=runtime)
109 with tempfile.TemporaryDirectory(prefix='topic-maps-21m-sources-') as temp_name:
110 provenance = json.loads(run('source-preparation', ['python3', str(Path(__file__)), '--prepare', temp_name + '/sources'], env))
111 save(output / 'source-preparation.json', provenance)
112 env.update(CL_SOURCE_REGISTRY=provenance['sourceRegistry'], TOPIC_MAPS_REPORT=str(retained / 'core.json'),
113 TOPIC_MAPS_XTM_REPORT=str(output / 'xtm.json'), TOPIC_MAPS_XTM_MERGEMAP_REPORT=str(retained / 'xtm-mergemap'),
114 TOPIC_MAPS_REGISTERED_ORIGINALS_REPORT=str(retained / 'slice20a'), TOPIC_MAPS_REGISTERED_NEGATIVES_REPORT=str(retained / 'slice20b'),
115 TOPIC_MAPS_PROLOG_REPORT=str(retained / 'slice20c'), TOPIC_MAPS_EMPTY2_REPORT=str(retained / 'slice20e'),
116 TOPIC_MAPS_CTM_INTEGER_REPORT=str(retained / 'slice20f'), TOPIC_MAPS_TRIPLE_REPORT=str(retained / 'slice20g'),
117 TOPIC_MAPS_ENCODING_REPORT=str(output / 'ctm'))
118 prefix = [runtime, '--noinform', '--no-sysinit', '--no-userinit', '--script']
119 xml = run('xml', prefix + ['tests/cxml-probe.lisp'], env)
120 xml_labels = re.findall(r'^CXML-CHECK-PASS (.+)$', xml, re.M)
121 assert len(xml_labels) == len(set(xml_labels)) == 146 and 'CXML-SUMMARY 146 PASS 0 FAIL' in xml
122 api_probe = run('name-reifier-api-preflight', prefix + [str(EVIDENCE / 'api-preflight.lisp')], env)
123 assert 'NAME-REIFIER-API-PREFLIGHT-PASS:' in api_probe
124 xtm_log = run('xtm', prefix + ['scripts/fresh-xtm.lisp'], env)
125 xtm = read(output / 'xtm.json')
126 labels = re.findall(r'^XTM-CHECK-PASS (.+)$', xtm_log, re.M)
127 assert labels == xtm['checks'] and len(labels) == len(set(labels))
128 substitutions = {'name-syntax:unsupported-reifier:': 'name-syntax:unsupported-variant-reifier:',
129 'name-syntax:scope:name-reifier-stays-unsupported:': 'name-syntax:scope:variant-reifier-stays-unsupported:',
130 'name-syntax:iid:reifier-stays-unsupported:': 'name-syntax:iid:variant-reifier-stays-unsupported:',
131 'map-reifier-error:name-reification:': 'map-reifier-error:name-with-variant-reification:'}
132 rename = {label: label.replace(old, new) for label in previous['checks'] for old, new in substitutions.items() if label.startswith(old)}
133 assert len(rename) == 8
134 retained_labels = [rename.get(label, label) for label in previous['checks']]
135 assert set(retained_labels) <= set(labels)
136 assert [label for label in labels if label in set(retained_labels)] == retained_labels
137 assert f'XTM-SUMMARY {len(labels)} PASS 0 FAIL; 57 original CXTM PASS; 8 negative originals PASS' in xtm_log
138 assert xtm['statuses'] == {'pass': 65, 'fail': 0, 'unsupported': 0, 'not-run': 0}
139 assert xtm['otherCorpusInputs'] == {'positiveUnexecuted': 56, 'negativeUnregisteredUnexecuted': 3}
140 assert xtm['cases'][:63] == previous['cases']
141 control_retargets = read(EVIDENCE / 'retargeted-controls.json')['controls']
142 expected_fields = {'nameControls', 'scopeControls', 'nameItemIdentityControls', 'mapReifierControls'}
143 assert {row['field'] for row in control_retargets} == expected_fields and len(control_retargets) == 4
144 for field, value in previous.items():
145 if field in expected_fields:
146 assert len(xtm[field]) == len(value)
147 changed = [(a, b) for a, b in zip(value, xtm[field]) if a != b]
148 approved = [(row['before'], row['after']) for row in control_retargets if row['field'] == field]
149 assert changed == approved
150 a, b = changed[0]
151 assert a['condition']['class'] == b['condition']['class'] == 'XTM-UNSUPPORTED'
152 assert a['condition']['code'] == b['condition']['code'] == 'reification'
153 assert '<name reifier=' in a['sourceText'] and '<variant reifier=' in b['sourceText']
154 elif field not in ['scope', 'statuses', 'otherCorpusInputs', 'checks', 'cases']:
155 assert xtm[field] == value, field
156 assert len(xtm['cases']) == len({c['id'] for c in xtm['cases']}) == 65
157 assert [c['id'] for c in xtm['cases'][63:]] == TARGETS
158 assert all(c['status'] == 'pass' and c['actualOutcome'] == 'cxtm-match' for c in xtm['cases'][63:])
159 assert len(xtm['nameReifierOriginals']) == 2
160 regression = run('regression', [str(ROOT / 'scripts/test.sh')], env)
161 run('diagnostics', prefix + [str(EVIDENCE / 'diagnostics.lisp')],
162 dict(env, TOPIC_MAPS_21M_ROOT=str(ROOT), TOPIC_MAPS_21M_DIAGNOSTICS=str(output / 'after-diagnostics.json')))
163 fault_controls = []
164 positive_modes = [('mismatch', 'cxtm-mismatch'), ('xml', 'execution-error'), ('unsupported', 'unsupported'), ('tmdm', 'execution-error')]
165 negative_modes = [('accepted', 'ctm-acceptance'), ('xml', 'execution-error'), ('unsupported', 'unsupported'), ('wrong-cause', 'execution-error')]
166 families = {'positive': positive_modes + [('xtm', 'execution-error')], 'negative': negative_modes,
167 'name': positive_modes, 'scope': positive_modes, 'iid': positive_modes, 'variant': positive_modes,
168 'variant-negative': negative_modes + [('tmdm', 'execution-error')],
169 'merge-variant': positive_modes + [('xtm', 'execution-error')],
170 'resource-ref': positive_modes + [('xtm', 'execution-error')],
171 'resource-ref-relative': positive_modes + [('xtm', 'execution-error')],
172 'uri-data': positive_modes + [('xtm', 'execution-error')],
173 'variant-iid': positive_modes + [('xtm', 'execution-error')],
174 'variant-iid-duplicate': positive_modes + [('xtm', 'execution-error')],
175 'map-reifier': positive_modes + [('xtm', 'execution-error')],
176 'map-reifier-condition': [('wrong-cause', 'foreign-reifier-rejected-as-wrong-condition')],
177 'name-reifier': positive_modes + [('xtm', 'execution-error')],
178 'name-reifier-duplicate': positive_modes + [('xtm', 'execution-error')],
179 'name-reifier-condition': [('wrong-cause', 'foreign-reifier-rejected-as-wrong-condition')]}
180 for family, modes in families.items():
181 for mode, outcome in modes:
182 label = family + '-control-' + mode
183 run(label, prefix + [str(EVIDENCE / 'failure-controls.lisp')],
184 dict(env, TOPIC_MAPS_XTM_REPORT=str(output / (label + '.json')), TOPIC_MAPS_21M_FAMILY=family, TOPIC_MAPS_21M_FAULT=mode), expected_exit=1)
185 result = read(output / (label + '.json'))
186 retained_count = {'positive': 0, 'negative': 26, 'name': 33, 'scope': 43, 'iid': 48, 'variant': 50, 'variant-negative': 55, 'merge-variant': 56, 'resource-ref': 57, 'resource-ref-relative': 58, 'uri-data': 59, 'variant-iid': 60, 'variant-iid-duplicate': 61, 'map-reifier': 62, 'map-reifier-condition': 63, 'name-reifier': 63, 'name-reifier-duplicate': 64, 'name-reifier-condition': 65}[family]
187 assert result['statuses']['pass'] == retained_count
188 if family in ['map-reifier-condition', 'name-reifier-condition']:
189 assert len(result['cases']) == retained_count
190 is_name = family == 'name-reifier-condition'
191 wrong_label = 'name:native-reuse-reifier' if is_name else 'reuse-reifier'
192 wrong = next(row for row in result['nameReifierControls' if is_name else 'mapReifierControls'] if row['label'] == wrong_label)
193 assert wrong['expectedCode'] == 'reifier-conflict'
194 assert wrong['condition']['class'] == 'REIFICATION-ERROR' and wrong['condition']['code'] == 'foreign-reifier'
195 assert wrong['atomicNativeOperation']
196 assert result['checks'][-1] == 'map-reifier-error:' + wrong_label + ':specific-class-code'
197 else:
198 assert len(result['cases']) == retained_count + 1 and result['cases'][-1]['actualOutcome'] == outcome
199 assert result['cases'][:retained_count] == xtm['cases'][:retained_count]
200 if family in ['map-reifier', 'name-reifier', 'name-reifier-duplicate'] and mode == 'tmdm':
201 outputs = result['mapReifierOriginals'] if family == 'map-reifier' else result['nameReifierOriginals']
202 actual_condition = next(row for row in outputs if row['id'] == result['cases'][-1]['id'])['condition']
203 assert actual_condition['class'] == 'REIFICATION-ERROR' and actual_condition['code'] == 'reifier-conflict'
204 fault_controls.append({'family': family, 'mode': mode, 'actualOutcome': outcome,
205 'expectedASDFFailureObserved': True, 'retainedOriginalPasses': retained_count, 'faultCountedAsPass': False})
206
207 verified = []
208 for old in sorted((PRIOR / 'retained').glob('*.json')):
209 assert read(old) == read(retained / old.name), str(old)
210 verified.append(str(old.relative_to(ROOT)))
211 for suffix in ['validation', 'cxtm', 'encoding']:
212 old = PRIOR / f'ctm.{suffix}.json'
213 assert read(old) == read(output / f'ctm.{suffix}.json'), str(old)
214 verified.append(str(old.relative_to(ROOT)))
215 totals = read(ROOT / 'reports/slice-19d1/regression-execution.json')['regressionChecks']
216 stages = read(PRIOR / 'execution.json')['stageChecks']
217 assert sum(totals.values()) == 12100
218 for marker, count in dict(totals, **stages).items():
219 assert int(re.search(r'(?m)^' + marker + r'-PASS: (\d+)', regression).group(1)) == count
220 assert 'Ran 2 tests' in regression and 'NFC-ORACLE-PASS: 16294' in regression
221 assert read(output / 'ctm.validation.json')['statuses'] == CTM
222 comparisons = []
223 (output / 'actual').mkdir()
224 for candidate_case, result in zip(candidate['candidates'], xtm['nameReifierOriginals']):
225 assert result['id'] == candidate_case['id'] and result['condition'] is None and result['status'] == 'pass'
226 source = ROOT / 'vendor/cxtm' / result['id']
227 baseline = ROOT / 'vendor/cxtm/xtm2/baseline' / (source.name + '.cxtm')
228 raw, actual = source.read_bytes(), result['actualCXTM'].encode('utf-8')
229 assert raw == bytes.fromhex(result['sourceHex']) == result['sourceText'].encode('utf-8')
230 assert sha(source) == candidate_case['sourceSHA256'] and len(raw) == result['sourceBytes'] == candidate_case['sourceBytes']
231 assert actual == result['expectedCXTM'].encode('utf-8') == baseline.read_bytes()
232 assert len(actual) == result['actualBytes'] == result['expectedBytes'] == candidate_case['baselineBytes']
233 assert sha(baseline) == candidate_case['baselineSHA256'] and result['firstDifferentByte'] is None
234 assert result['documentIRI'] == candidate_case['documentIRI'] and result['sourceKey'] == result['id']
235 model = result['model']
236 identity = model['identity']['nameModel']['identity']
237 assert model['canonicalNameReifierInverseEQ'] and model['mapReifierTopic'] is None
238 assert model['nameReifierTopics'] == [3] and model['topicReifiedNames'] == [None, None, 1]
239 assert identity['topicCount'] == 3 and identity['associationCount'] == 0
240 assert identity['topics'] == [
241 {'ordinal': 1, 'itemIdentifiers': [result['documentIRI'] + '#topic'], 'subjectIdentifiers': [], 'subjectLocators': []},
242 {'ordinal': 2, 'itemIdentifiers': [], 'subjectIdentifiers': ['http://psi.topicmaps.org/iso13250/model/topic-name'], 'subjectLocators': []},
243 {'ordinal': 3, 'itemIdentifiers': [result['reifierLocator']], 'subjectIdentifiers': [], 'subjectLocators': []}]
244 assert model['identity']['nameModel']['mapItemIdentifiers'] == []
245 assert model['identity']['nameModel']['names'] == [{'value': 'Topic', 'parent': 1, 'type': 2, 'scope': [], 'itemIdentifiers': [], 'variantCount': 0}]
246 assert model['identity']['variants'] == []
247 expected_r = '#reifier' if result['id'] == TARGETS[0] else '#reifier1'
248 assert result['reifierLocator'] == result['documentIRI'] + expected_r
249 assert result['sourceNameCount'] == (1 if result['id'] == TARGETS[0] else 2)
250 (output / 'actual' / baseline.name).write_bytes(actual)
251 comparisons.append(dict(result, sourceSHA256=sha(source), baselineSHA256=sha(baseline),
252 actualSHA256=hashlib.sha256(actual).hexdigest(), executedInASDFTestOp=True))
253 before, after = read(EVIDENCE / 'before-diagnostics.json'), read(output / 'after-diagnostics.json')
254 assert len(before) == len(after) == 124
255 assert [c['id'] for c in before] == [c['id'] for c in after]
256 changes = [{'id': a['id'], 'before': b, 'after': a,
257 'reason': ('Name Reification is assigned to the canonical add-name result using the shared II lookup; original registered after complete byte comparison.'
258 if a['id'] in TARGETS else 'Read-only diagnostic: existing Variant/Name-identifier support also permits this source after Name Reification. Deliberately unregistered.')}
259 for b, a in zip(before, after) if b != a]
260 assert {c['id'] for c in changes} == set(TARGETS + EXPLORATORY)
261 for change in changes:
262 assert change['before']['condition']['class'] == 'XTM-UNSUPPORTED'
263 assert change['before']['condition']['code'] == 'reification'
264 assert change['after']['condition'] is None and change['after']['byteExact']
265 if change['id'] in TARGETS:
266 assert next(c for c in comparisons if c['id'] == change['id'])['actualCXTM'] == change['after']['actualCXTM']
267 assert not set(EXPLORATORY) & {case['id'] for case in xtm['cases']}
268 further = []
269 for id in EXPLORATORY:
270 source = ROOT / 'vendor/cxtm' / id
271 baseline = ROOT / 'vendor/cxtm/xtm2/baseline' / (source.name + '.cxtm')
272 observed = next(row for row in after if row['id'] == id)
273 assert observed['actualCXTM'].encode('utf-8') == baseline.read_bytes()
274 further.append({'id': id, 'registered': False, 'registeredStatus': 'not-run', 'sourceBytes': source.stat().st_size,
275 'sourceHex': source.read_bytes().hex(), 'sourceText': source.read_text(), 'sourceSHA256': sha(source),
276 'baselineBytes': baseline.stat().st_size, 'baselineSHA256': sha(baseline), 'observation': observed})
277 save(output / 'further-name-reification-observations.json', {'kind': 'read-only-original-observations-no-registration', 'cases': further})
278 pending_negative = ['xtm2/invalid/' + stem + '.xtm' for stem in
279 ['reifier-collision', 'role-duplicate-reified', 'topicref-no-fragment-id']]
280 assert not set(pending_negative) & {case['id'] for case in xtm['cases']}
281 save(output / 'diagnostic-changes.json', changes)
282 lock = read(ROOT / 'references/corpus-lock.json')
283 for entry in lock['files']:
284 p = ROOT / 'vendor/cxtm' / entry['path']
285 assert p.stat().st_size == entry['size'] and sha(p) == entry['sha256']
286 for snapshot in [protected, historical, sources]:
287 assert snapshot == {p: sha(ROOT / p) for p in snapshot}
288 assert set(command(['git', 'diff', '--name-only', BASE]).splitlines()) & set(tracked) <= ALLOWED
289 save(output / 'name-reifier-originals.json', {'kind': 'executed-original-name-reifier-registration', 'cases': comparisons})
290 save(output / 'diagnostics.json', {'kind': 'read-only-observations-no-extra-registration',
291 'originalObservations': 124, 'unchangedOriginalObservations': 124 - len(changes),
292 'diagnosticChanges': changes, 'registeredCases': TARGETS, 'negativeOriginalsRemainingNotRun': pending_negative,
293 'other119ObservationsUnchanged': True, 'additionalSuccessfulOriginalsRemainingNotRun': EXPLORATORY})
294 save(output / 'failure-controls.json', {'kind': 'executor-fault-controls-not-corpus-results', 'controls': fault_controls})
295 save(output / 'integrity.json', {'protectedBaseFilesSHA256': protected, 'historicalReportsSHA256': historical, 'executionSourcesSHA256': sources})
296 statuses = dict(xtm['statuses'], **{'not-run': sum(xtm['otherCorpusInputs'].values())})
297 save(output / 'execution.json', {'kind': 'xtm-name-reifier-original-registration-validation', 'baseCommit': BASE,
298 'branch': command(['git', 'branch', '--show-current']), 'runtime': 'SBCL 2.5.4', 'startedAtUTC': started,
299 'finishedAtUTC': datetime.datetime.now(datetime.timezone.utc).isoformat(), 'runs': runs,
300 'sourcePreparation': 'source-preparation.json', 'retainedLispChecks': 12100, 'retainedChecks': totals,
301 'stageChecks': stages, 'xmlQualificationChecks': 146, 'nativeNameReifierAPIPreflightPassed': True, 'standaloneXTMChecks': len(labels),
302 'retainedXTMChecks': len(previous['checks']), 'retargetedUnsupportedCheckNames': rename,
303 'newXTMChecks': len(labels) - len(previous['checks']), 'retargetedUnsupportedControlRows': control_retargets,
304 'retainedOriginals': 63, 'retainedOriginalResultsUnchanged': True, 'newPositiveOriginals': 2,
305 'originalByteComparisons': [{'id': c['id'], 'actual': c['actualBytes'], 'baseline': c['expectedBytes'], 'firstDifferentByte': None} for c in comparisons], 'faultControls': len(fault_controls),
306 'diagnosticOriginalObservations': 124, 'diagnosticChangedOriginals': [c['id'] for c in changes],
307 'xtmStatusesBefore': {'pass': 63, 'fail': 0, 'unsupported': 0, 'not-run': 61}, 'xtmStatusesAfter': statuses,
308 'xtmStatusChanges': [{'id': id, 'before': 'not-run', 'after': 'pass', 'actualOutcome': 'cxtm-match'} for id in TARGETS],
309 'ctmStatusesBefore': CTM, 'ctmStatusesAfter': CTM, 'ctmStatusChanges': [],
310 'knownFailuresUnchanged': [c['id'] for c in read(output / 'ctm.validation.json')['cases'] if c['status'] == 'fail'],
311 'pythonUnitTests': 2, 'nfcOracleComparisons': 16294, 'allRetainedNonXTMReportsIdenticalToSlice21L': verified,
312 'historicalReportFilesVerified': len(historical), 'protectedBaseFilesVerified': len(protected), 'pinnedCorpusFilesVerified': len(lock['files']),
313 'historicalReportsUnchanged': True, 'originalSourcesAndBaselinesUnchanged': True, 'productionChangeLimitedToXTMReader': True, 'protectedSubsystemsUnchanged': ['TMDM', 'CTM', 'CXTM', 'XML'],
314 'newDependencyDownloads': 0, 'persistentLispImagesTouched': False,
315 'executionAuthorization': 'Regular require_escalated approval; tests additionally deny network and repository writes; no symlink/configuration changes.',
316 'fullOfflineNixRebuild': 'NOT-RUN; fresh SBCL loads with verified pinned local sources and existing XML patches.', 'acceptancePassed': True})
317 print(json.dumps({'acceptancePassed': True, 'xtm': statuses, 'ctm': CTM, 'checks': len(labels), 'output': str(output)}))
318
319
320 if __name__ == '__main__':
321 main()