Review fixes: narrow intake redact predicate to the bot's own nudge + edge tests
reviewer agent flagged the broadened redact_thread predicate (event_id OR in_reply==root) as over-matching any plain reply to a thread root. Gate the bare-in_reply clause to the bot's own sender (the nudge is always ours); thread children (cards/acks/human yes-no) still match by rel_type=m.thread. Add unit edges for _name_similarity's all-generic fallback and a contact_id NULL orphan case for the grid-blob email heal.
This commit is contained in:
@@ -61,6 +61,8 @@ GRID = {
|
||||
{"name": "Jose Briones", "email": "", "title": ""}]},
|
||||
{"id": "rowA", "investor_name": "Acme Capital", "notes": "",
|
||||
"contacts": [{"name": "Jane Doe", "email": "keep@acme.com", "title": ""}]},
|
||||
{"id": "rowO", "investor_name": "Orphan LP", "notes": "",
|
||||
"contacts": [{"name": "No Link", "email": "", "title": ""}]},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -79,11 +81,13 @@ def seed():
|
||||
"('c-jane','Jane','Doe','other@acme.com')") # differs from the blob's keep@acme.com
|
||||
# Relational mirror (what sync_fundraising_relational would build): blank fc.email, linked contact_id.
|
||||
c.execute("INSERT INTO fundraising_investors (id,investor_name,source_row_id,total_invested) VALUES "
|
||||
"('inv-w','Wyoming','rowW',0),('inv-a','Acme Capital','rowA',0)")
|
||||
"('inv-w','Wyoming','rowW',0),('inv-a','Acme Capital','rowA',0),('inv-o','Orphan LP','rowO',0)")
|
||||
# fc-orphan has contact_id NULL (pre-0004 orphan) and blank email — nothing to heal from.
|
||||
c.execute("INSERT INTO fundraising_contacts (id,investor_id,full_name,email,sort_order,contact_id) VALUES "
|
||||
"('fc-phil','inv-w','Philip Treick','',0,'c-phil'),"
|
||||
"('fc-jose','inv-w','Jose Briones','',1,'c-jose'),"
|
||||
"('fc-jane','inv-a','Jane Doe','',0,'c-jane')")
|
||||
"('fc-jane','inv-a','Jane Doe','',0,'c-jane'),"
|
||||
"('fc-orphan','inv-o','No Link','',0,NULL)")
|
||||
c.commit()
|
||||
c.close()
|
||||
|
||||
@@ -119,6 +123,12 @@ def main():
|
||||
jane = next((c for c in ac if c.get("name") == "Jane Doe"), {})
|
||||
check(jane.get("email") == "keep@acme.com",
|
||||
f"Jane pill keeps its blob email, not the contact's (got {jane.get('email')!r})")
|
||||
|
||||
print("\n[heal: a pill whose fundraising_contacts row has contact_id NULL stays blank (orphan)]")
|
||||
o = by_id.get("rowO", {})
|
||||
orphan = next((c for c in o.get("contacts", []) if c.get("name") == "No Link"), {})
|
||||
check(orphan.get("email", "") == "",
|
||||
f"orphan pill (no contact_id, no email source) stays blank (got {orphan.get('email')!r})")
|
||||
finally:
|
||||
httpd.shutdown()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user