diff --git a/docs/joint-editions.md b/docs/joint-editions.md index a35775f..7c630fb 100644 --- a/docs/joint-editions.md +++ b/docs/joint-editions.md @@ -14,7 +14,9 @@ source links and coverage records stay intact. It does not merge or create paper or submissions, resolve per-paper tracks, or turn reviews into negative decisions. The DBLP collector applies the joint mapping only to these two exact main volume keys; original booktitle/title remain in source metadata with the membership evidence. -Other years, workshop volumes and additional tracks retain their existing rules. +The shared ingestion entry point also resolves these exact pinned source volumes before +creating an edition, so refreshing an older normalized file cannot recreate a separate +IJCAI edition. Other sources, years, workshop volumes and additional tracks retain their existing rules. ## Review a read-only plan diff --git a/paper_atlas/db/store.py b/paper_atlas/db/store.py index 7d57533..272ace4 100644 --- a/paper_atlas/db/store.py +++ b/paper_atlas/db/store.py @@ -144,6 +144,20 @@ class Store: def decision(self,paper,record,venue,year,track,external_id,url,status,raw_value,aliases=None,identities=None,observed_at=None,decision_date=None,source_decision_id='',submitted_at=None,guard_status=False): c = self.conn + # An already collected file may still call these exact pinned volumes + # IJCAI. Resolve membership before finding/creating an edition so a + # later refresh cannot split the repaired joint event again. + if venue == 'IJCAI' and year in (2018,2022) and track == 'main': + from paper_atlas.collectors.dblp import XML_SHA + evidence=c.execute('SELECT src.name,r.metadata_json FROM source_records r JOIN sources src ON src.id=r.source_id WHERE r.id=?',(record,)).fetchone() + if evidence and evidence[0] == 'dblp': + metadata=json.loads(evidence[1]) + if (metadata.get('snapshot_sha256') == XML_SHA + and metadata.get('proceedings_key') == 'conf/ijcai/'+str(year) + and metadata.get('bibliographic_year') == year + and (metadata.get('bibliography') or {}).get('booktitle') in (['IJCAI'],['IJCAI/ECAI'])): + venue='ECAI+IJCAI' + aliases=sorted(set(aliases or []) | {'ECAI','IJCAI'}) existing=c.execute('SELECT id FROM venues WHERE lower(acronym)=lower(?)',(venue,)).fetchone() if existing:venue_id=existing[0] else:venue_id=inserted_id(c,"INSERT INTO venues(acronym,name,field,venue_type) VALUES(?,?,?,'conference')",(venue,venue,'unclassified')) diff --git a/tests/test_joint_editions.py b/tests/test_joint_editions.py index 1732589..47246d0 100644 --- a/tests/test_joint_editions.py +++ b/tests/test_joint_editions.py @@ -32,9 +32,11 @@ def seed(store): 'bibliographic_year':year,'bibliography':{'booktitle':['IJCAI']}} p,r=store.record('dblp','conf/ijcai/fixture'+str(year),'https://dblp.org/rec/fixture', 'Original publication '+str(year),'Abstract\x00with\x01data',[], - {'doi':'10.24963/ijcai.'+str(year)+'/1'},metadata) + {'doi':'10.24963/ijcai.'+str(year)+'/1'}, {}) store.record_tags(p,r,'dblp',[{'namespace':'dblp:booktitle','value':'IJCAI'}]) store.decision(p,r,'IJCAI',year,'main','fixture'+str(year),'https://example.org/decision','accepted','listed') + stored=json.loads(c.execute('SELECT metadata_json FROM source_records WHERE id=?',(r,)).fetchone()[0]);stored.update(metadata) + c.execute('UPDATE source_records SET metadata_json=? WHERE id=?',(json.dumps(stored),r)) c.commit() @@ -64,6 +66,17 @@ class JointEditionTests(unittest.TestCase): self.assertEqual(len(json.loads(out.getvalue())),2) self.assertEqual(apply_plan(self.c,before)['updated_editions'],0) + def test_refresh_of_old_normalized_source_does_not_recreate_ordinary_edition(self): + before=plan(self.c);apply_plan(self.c,before) + for year in [2018,2022]: + row=self.c.execute('''SELECT r.paper_id,r.id,d.observed_at FROM source_records r + JOIN submissions s ON s.source_record_id=r.id JOIN decisions d ON d.submission_id=s.id + WHERE r.external_id=?''',('conf/ijcai/fixture'+str(year),)).fetchone() + self.store.decision(row[0],row[1],'IJCAI',year,'main','fixture'+str(year), + 'https://example.org/decision','accepted','listed',observed_at=row[2]) + self.assertEqual(inspect(self.c)['content_fingerprints'],before['content_fingerprints']) + self.assertEqual(self.c.execute('SELECT count(*) FROM editions').fetchone()[0],3) + def test_any_changed_source_text_rejects_stale_plan_before_membership_updates(self): before=plan(self.c) self.c.execute("UPDATE source_records SET title='New evidence' WHERE external_id='conf/ijcai/fixture2018'")