29 lines
1.8 KiB
Python
29 lines
1.8 KiB
Python
"""승인 원본으로 두 번 재생성하고 public과 비교한다. 기존 공개 폴더는 수정하지 않는다."""
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
import sys
|
|
import tempfile
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
sys.path.insert(0, str(ROOT / 'scripts'))
|
|
import ambience_audio as audio
|
|
|
|
plan = json.loads((ROOT / '.agent/AMBIENCE-SOURCES-v0.2.3.json').read_text())
|
|
current = json.loads((ROOT / 'public/ambience/manifest.json').read_text())
|
|
with tempfile.TemporaryDirectory(prefix='findword-reproduce-') as directory:
|
|
output = Path(directory) / 'ambience'
|
|
first = audio.generate(plan, '/tmp/findword-ambience-sources', output)
|
|
second = audio.generate(plan, '/tmp/findword-ambience-sources', output)
|
|
# 생성 시각만 달라질 수 있다. pass 통계·필터·PCM·notice의 재현성을 별도로 검사한다.
|
|
assert first['files'] == second['files'] == current['files']
|
|
assert (output / 'AMBIENCE_NOTICES.md').read_bytes() == (ROOT / 'public/ambience/AMBIENCE_NOTICES.md').read_bytes()
|
|
report = {'twoGenerationsMatchPublished': True, 'ignoredField': 'generatedAtUtc',
|
|
'toolVersions': first['toolVersions'], 'normalization': first['normalization'],
|
|
'files': [{'environmentId': f['environmentId'], 'sourceSha256': f['sourceSha256'],
|
|
'sourceBytes': f['sourceBytes'], 'selectedSegmentStartSeconds': f['selectedSegmentStartSeconds'],
|
|
'sha256': f['sha256'], 'bytes': f['bytes'], 'final': f['conversion']['loudness']['final']}
|
|
for f in first['files']]}
|
|
(Path(__file__).parent / 'reproducibility.json').write_text(json.dumps(report, indent=2)+'\n')
|
|
print('PASS: all eight source hashes verified, two independent generations and published WAVs/pass metrics/notices match.')
|