Route forwarded mail by its original sender; register Grok briefs via founder.
Adds forwarded_from (original sender from the forwarded header block, English/German) to delivery provenance and source match rules, so only founder forwards of noreply@x.ai mail route as Grok briefs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: opus Assistant-Process: 1170398@bnt-lap001 Assistant-Session: 622cd705-cb31-4322-ba08-dd42e44fa583
This commit is contained in:
parent
96e439495c
commit
65887ef637
5 changed files with 61 additions and 7 deletions
|
|
@ -135,6 +135,22 @@ class Library(unittest.TestCase):
|
|||
self.assertEqual(notify.health(self.root)['quarantined_items'], 0)
|
||||
self.assertEqual(len(notify.match(self.root)), 1)
|
||||
|
||||
def test_forwarded_mail_routes_only_with_matching_original_sender(self):
|
||||
write(self.root / 'registry' / 'sources' / 'grok-via-founder.json', {
|
||||
'id': 'grok-via-founder', 'owner_repo': 'intelligence-radar', 'channel': 'email',
|
||||
'match': {'from': 'founder@example.org', 'forwarded_from': 'noreply@x.ai'},
|
||||
'topics': ['intelligence.daily-brief'], 'cadence': 'daily', 'visibility': 'shared'})
|
||||
grok = ('Hi\n\n---------- Forwarded message ---------\nVon: Grok <noreply@x.ai>\n'
|
||||
'Subject: Brief\n\nbody')
|
||||
other = ('---------- Forwarded message ---------\nFrom: Someone <a@b.c>\n\nbody')
|
||||
self.drop('1.eml', mail('Founder <founder@example.org>', 'Fwd: Brief', grok))
|
||||
self.drop('2.eml', mail('Founder <founder@example.org>', 'Fwd: Other', other))
|
||||
first, second = intake.scan(self.root, self.mailbox())
|
||||
one = store.get_record(self.root, 'deliveries', first)
|
||||
two = store.get_record(self.root, 'deliveries', second)
|
||||
self.assertEqual((one['source'], one['forwarded_from']), ('grok-via-founder', 'noreply@x.ai'))
|
||||
self.assertEqual((two['status'], two['forwarded_from']), ('quarantined', 'a@b.c'))
|
||||
|
||||
def test_live_mailbox_needs_credentials_from_environment(self):
|
||||
self.assertIsNone(intake.mailbox_from_config({}, environ={}))
|
||||
box = intake.mailbox_from_config({}, environ={'INBOUND_LIBRARY_IMAP_USER': 'u',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue