From f77157d3037e2b8869beb6f11ee2cbc62fc59382 Mon Sep 17 00:00:00 2001 From: jjbrunton Date: Fri, 14 Aug 2026 12:45:16 +0100 Subject: [PATCH] Fix commenter-targeted outreach attribution --- .../src/features/outreach/outreach-page.tsx | 9 ++- .../src/features/outreach/outreach.css | 5 +- docs/data-flow.md | 4 +- docs/frontend.md | 2 +- docs/product-and-safety.md | 2 +- docs/services.md | 3 +- packages/api-contracts/src/outreach.ts | 4 ++ src/ai/openrouter.ts | 60 ++++++++++++++++--- src/database/candidate-queue-repository.ts | 25 ++++++++ src/main-loop.ts | 6 +- src/services/comment-targeted-opener.ts | 45 ++++++++++++++ src/services/processor.ts | 41 +++++++------ src/web/routes/outreach.ts | 7 +++ tests/candidate-queue.test.ts | 47 +++++++++++++++ tests/comment-targeted-opener.test.ts | 27 +++++++++ tests/dashboard/app.test.tsx | 13 +++- tests/openrouter-client.test.ts | 52 +++++++++++++--- tests/processor.test.ts | 15 +++-- tests/web/outreach-route.test.ts | 10 ++++ 19 files changed, 328 insertions(+), 49 deletions(-) create mode 100644 src/services/comment-targeted-opener.ts create mode 100644 tests/comment-targeted-opener.test.ts diff --git a/apps/dashboard/src/features/outreach/outreach-page.tsx b/apps/dashboard/src/features/outreach/outreach-page.tsx index 21d32a0..6fdda3d 100644 --- a/apps/dashboard/src/features/outreach/outreach-page.tsx +++ b/apps/dashboard/src/features/outreach/outreach-page.tsx @@ -81,6 +81,13 @@ function PreparedCandidateDetails({ candidate }: { candidate: OutreachCandidate Prepared message
{preparation.message}
+ {candidate.targetComment ? ( +
+ Comment that qualified this recipient +
{candidate.targetComment.body}
+ View comment on Reddit ↗ +
+ ) : null}
Show image analysis
{preparation.imageAnalysis}
@@ -110,7 +117,7 @@ function CandidateCard({
{statusLabel(candidate.status)} r/{candidate.subreddit} - {candidate.sourceType === 'image' ? 'Image post' : 'Chat post'} + {candidate.targetComment ? 'Commenter' : candidate.sourceType === 'image' ? 'Image post' : 'Chat post'}