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:
@@ -103,6 +103,21 @@ def main():
|
||||
seed()
|
||||
token = server.create_token("u1", "grant", "admin")
|
||||
|
||||
# Unit: the distinctive-token similarity edges (the all-generic fallback path the endpoint
|
||||
# seed can't naturally reach — no real investor is named purely with generic descriptors).
|
||||
print("\n[unit: _name_similarity distinctive-token edges]")
|
||||
sim = server._name_similarity
|
||||
check(sim("Fortitude Investment Group", "Aether Investment Group") < 0.62,
|
||||
f"generic-only overlap stays below threshold (got {sim('Fortitude Investment Group', 'Aether Investment Group'):.2f})")
|
||||
check(sim("Aether Capital", "Aether Capital Partners") == 1.0,
|
||||
f"distinctive 'aether' (generic descriptors stripped) scores 1.0 (got {sim('Aether Capital', 'Aether Capital Partners'):.2f})")
|
||||
# Both sides all-generic → fallback compares full tokens on BOTH sides; shared generic word
|
||||
# alone must not clear the bar.
|
||||
check(sim("Capital Group", "Global Capital") < 0.62,
|
||||
f"all-generic both sides stays below threshold (got {sim('Capital Group', 'Global Capital'):.2f})")
|
||||
check(sim("Family Office", "Family Office") == 1.0,
|
||||
"identical all-generic names still score 1.0 (early-out)")
|
||||
|
||||
httpd = ThreadingHTTPServer(("127.0.0.1", 0), _Quiet)
|
||||
port = httpd.server_address[1]
|
||||
threading.Thread(target=httpd.serve_forever, daemon=True).start()
|
||||
|
||||
Reference in New Issue
Block a user