Compare commits

...

1 Commits

Author SHA1 Message Date
codex-bot 207265345d Skip unchanged canonical abstracts when attaching evidence
Metadata integrity checks / metadata (push) Waiting to run
2026-11-25 18:51:50 +08:00
2 changed files with 27 additions and 1 deletions
+5 -1
View File
@@ -126,7 +126,11 @@ class Store:
if old:
old_abstract=old[2] or json.loads(old[4]).get('last_known_abstract',{}).get('abstract')
c.execute("UPDATE papers SET title=?,abstract=COALESCE(NULLIF(?,''),abstract),title_key=?,authors_json=CASE WHEN ?='[]' THEN authors_json ELSE ? END WHERE id=? AND title=? AND COALESCE(abstract,'')=COALESCE(?,'')",(title,abstract,key,json.dumps(authors,ensure_ascii=False),json.dumps(authors,ensure_ascii=False),paper,old[1],old_abstract))
c.execute("UPDATE papers SET abstract=CASE WHEN abstract IS NULL OR abstract='' THEN ? ELSE abstract END WHERE id=?",(abstract,paper))
c.execute("""UPDATE papers SET abstract=?
WHERE id=? AND (abstract IS NULL OR abstract='')
AND NOT (COALESCE(abstract = ?, FALSE)
OR (abstract IS NULL AND CAST(? AS TEXT) IS NULL))""",
(abstract, paper, abstract, abstract))
else:
paper = inserted_id(c,'INSERT INTO papers(title,abstract,title_key,authors_json,first_published) VALUES(?,?,?,?,?)',(title,abstract,key,json.dumps(authors,ensure_ascii=False),published))
for scheme,value in ids:
+22
View File
@@ -56,6 +56,28 @@ class SubmissionTests(unittest.TestCase):
self.decision(paper,two,'forum2',[('openreview','forum2'),('iclr_number','2')])
self.assertEqual(self.store.conn.execute('SELECT count(*) FROM submissions').fetchone()[0],2)
def test_new_source_only_updates_canonical_abstract_when_it_changes(self):
conn = self.store.conn
conn.execute("""CREATE TRIGGER reject_noop_abstract_update BEFORE UPDATE OF abstract ON papers
WHEN OLD.abstract IS NEW.abstract
BEGIN SELECT RAISE(ABORT, 'unchanged abstract written'); END""")
title = 'An indexed work with several independent records'
ids = {'arxiv': '2601.00002'}
paper, _ = self.store.record('index', 'initial', 'https://example.org/initial', title, None, [], ids)
for name, incoming, expected in (
('missing', None, None),
('empty', '', ''),
('another-empty', '', ''),
('missing-again', None, None),
('publication', 'Canonical abstract', 'Canonical abstract'),
('conference', 'Conference abstract', 'Canonical abstract'),
):
with self.subTest(source=name):
linked, record = self.store.record(name, name, 'https://example.org/'+name, title, incoming, [], ids)
self.assertEqual(linked, paper)
self.assertEqual(conn.execute('SELECT abstract FROM papers WHERE id=?', (paper,)).fetchone(), (expected,))
self.assertEqual(conn.execute('SELECT abstract FROM source_records WHERE id=?', (record,)).fetchone(), (incoming,))
def test_conflicting_forums_cannot_be_bridged_by_one_submission_number(self):
paper,one=self.record('snapshot','realForum',['Jane Doe'])
other,two=self.record('snapshot','differentForum',['Other Author'])