Normalize all MM 2026 publications with attributed program evidence
Metadata integrity checks / metadata (push) Successful in 5m4s

This commit is contained in:
2026-11-18 00:43:45 +08:00
parent 44f4146f3e
commit 13536d6268
7 changed files with 473 additions and 2 deletions
+23 -2
View File
@@ -19,8 +19,9 @@ jobs:
# Public repository archive: no owner credentials or runner SSH keys.
url = 'https://gitea.entroia.com/Zayden-Jung/paper-atlas/archive/' + sha + '.tar.gz'
with urllib.request.urlopen(url, timeout=60) as response:
archive = response.read(16*1024*1024+1)
if len(archive)>16*1024*1024:
# Full publication-source fixtures retain original bibliographic evidence.
archive = response.read(24*1024*1024+1)
if len(archive)>24*1024*1024:
raise SystemExit('Unexpectedly large source archive')
with tempfile.TemporaryDirectory(prefix='paper-atlas-ci-') as tmp:
root = pathlib.Path(tmp)
@@ -66,7 +67,27 @@ jobs:
assert hashlib.sha256(row['abstract'].encode()).hexdigest() == gold['abstract_sha256']
assert [c['source_pointer'] for c in row['contexts']] == gold['locations']
assert not row['approved_for_import'] and not row['final_decision_verified'] and 'emails' not in row
mm_pub_fixture = json.loads(gzip.decompress((src/'tests/fixtures/mm2026-publications.json.gz').read_bytes()))
mm_pub_registry = root/'mm2026-publication-registry'
for name,body in mm_pub_fixture['files'].items():
path=mm_pub_registry/name
path.parent.mkdir(parents=True,exist_ok=True)
path.write_bytes(body.encode('utf-8'))
subprocess.run([python,'-I','-B','-m','paper_atlas','collect','mm2026-publications','--registry-snapshots',str(mm_pub_registry),'--program-snapshots',str(mm_snapshots),'--parent-snapshot',str(mm_pub_registry/'parent.json'),'--out',str(root/'installed-mm2026-publications')],cwd=outside,check=True)
mm_pub_report=json.loads((root/'installed-mm2026-publications/collection-report.json').read_text())
assert (mm_pub_report['records'],mm_pub_report['unique_registered_dois'],mm_pub_report['abstracts_from_exact_program_correspondence'],mm_pub_report['output_missing_abstract_count'])==(1918,1918,1717,201)
assert mm_pub_report['unmatched_program_count']==417 and not mm_pub_report['database_written'] and mm_pub_report['approved_for_import']==0
mm_pub_rows={r['external_id']:r for f in mm_pub_report['files'] for r in map(json.loads,pathlib.Path(f['file']).read_text().splitlines())}
assert len(mm_pub_rows)==1918
for gold in mm_pub_fixture['independent_gold']:
row=mm_pub_rows[gold['doi']]
assert (row['title'],row['authors'],row['track'])==(gold['title'],gold['authors'],gold['track'])
assert (hashlib.sha256(row['abstract'].encode()).hexdigest() if row['abstract'] is not None else None)==gold['abstract_sha256']
assert row['metadata']['program_match_kind']==gold['kind'] and not row['metadata']['scientific_work_identity_approved'] and not row['metadata']['research_type_classified']
if service_file.is_file():
subprocess.run([python,'-I','-B','-m','paper_atlas','audit','source-identities','--files',*[f['file'] for f in mm_pub_report['files']],'--pg-service','foundry-research','--pg-schema','research','--out',str(root/'installed-mm2026-publication-preflight')],cwd=outside,env=testenv,check=True)
mm_pub_preflight=json.loads((root/'installed-mm2026-publication-preflight/postgresql-preflight.json').read_text())
assert mm_pub_preflight['records']==1918 and mm_pub_preflight['transaction_read_only'] and not mm_pub_preflight['database_written'] and mm_pub_preflight['approved_for_import']==0
subprocess.run([python,'-I','-B','-m','paper_atlas','audit','source-identities','--mm-program-report',str(root/'installed-mm2026/collection-report.json'),'--pg-service','foundry-research','--pg-schema','research','--out',str(root/'installed-mm2026-preflight')],cwd=outside,env=testenv,check=True)
mm_preflight = json.loads((root/'installed-mm2026-preflight/postgresql-preflight.json').read_text())
assert mm_preflight['records'] == 2143 and len(mm_preflight['inputs']) == 28