Add checked harmonic snapshot continuation and matched linear trial diagnostics

This commit is contained in:
2026-09-19 13:43:49 -04:00
parent 77130fa603
commit 53faac1cd2
8 changed files with 582 additions and 7 deletions

View File

@@ -132,9 +132,29 @@ def main():
path = source / path
path = path.resolve()
state_files[str(path)] = digest(path)
elif word == '--density-snapshot':
elif word in ('--density-snapshot', '--restart-snapshot'):
path = Path(case['arguments'][i + 1])
path = (path if path.is_absolute() else source / path).resolve()
if word == '--restart-snapshot':
snapshot_file = path / 'accepted_state.txt' if path.is_dir() else path
folder = snapshot_file.parent
if not (folder / 'metadata.txt').is_file():
folder = folder.parent
prior_manifest = folder.parent / 'provenance.json'
prior_run = folder.parent / (folder.name + '_run.json')
prior = json.loads(prior_manifest.read_text())
saved_run = json.loads(prior_run.read_text())
if prior['mesh_sha256'] != provenance['mesh_sha256']:
raise RuntimeError('Restart mesh differs from the snapshot campaign.')
for saved_file in (snapshot_file, folder / 'metadata.txt', folder / 'layout.csv'):
value = digest(saved_file)
key = str(saved_file.relative_to(folder))
if value != saved_run['output_hashes'][key]:
raise RuntimeError('Restart input no longer matches its original run: ' + key)
state_files[str(saved_file)] = value
state_files[str(prior_manifest)] = digest(prior_manifest)
state_files[str(prior_run)] = digest(prior_run)
continue
# Modal coordinates also depend on the mesh and named block
# layout. Bind replay to its original recorded campaign rather
# than trusting a coincidentally matching vector length.