Preserve match candidate evidence when papers merge
Metadata integrity checks / metadata (push) Waiting to run

This commit is contained in:
2026-11-26 01:40:22 +08:00
parent b03a8bc5fc
commit 1e5237fe19
3 changed files with 104 additions and 2 deletions
+31
View File
@@ -66,6 +66,37 @@ class PostgreSQLIngestionTests(unittest.TestCase):
def store(self):
return open_store(pg_service=self.service, pg_schema=self.schema)
def test_merge_preserves_colliding_candidate_evidence(self):
store = self.store()
with closing(store.conn) as db, db:
ids = [
store.record('fixture', key, 'https://example.org/' + key, title, None, ['Author'])[0]
for key, title in (
('preprint', 'Preprint'),
('proceedings', 'Proceedings version'),
('related', 'Related work'),
)
]
first, second, related = ids
expected = [
(None, '{"title":"Preprint"}', 'pending'),
(0.75, '{"title":"Proceedings version"}', 'pending'),
]
for paper, observation in zip((first, second), expected):
db.execute(
'INSERT INTO match_candidates VALUES(?,?,?,?,?,?)',
(paper, related, 'exact_title_unconfirmed', *observation),
)
store.merge(first, second, 'confirmed publication version')
row = db.execute(
'SELECT left_paper_id,right_paper_id,evidence_json FROM match_candidates',
).fetchone()
self.assertEqual(row[:2], (first, related))
self.assertEqual(
json.loads(row[2])['reattached_observations'],
[list(observation) for observation in expected],
)
def row(self, source='openreview_snapshot', external='forumNew1', status='rejected', year=2025, venue='ICLR'):
return {'source': source, 'external_id': external, 'url': 'https://example.org/' + external,
'venue': venue, 'year': year, 'track': 'main', 'status': status,