Add comments with visibility to submitted leads #4607
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4607"
general
weight: 0.35
Joker666
Summary
Adds comments to submitted leads, with a visibility setting per comment. This follows the Figma design.
Screenshots
<img width="800" alt="workspace-comments" src="https://github.com/user-attachments/assets/246df85d-5870-4603-bf9c-c0a49f90be69" />
<img width="800" alt="workspace-visibility" src="https://github.com/user-attachments/assets/dbb006e8-587e-4bdd-acce-5b01ff3d305d" />
<img width="800" alt="partner-comments" src="https://github.com/user-attachments/assets/5eb8662b-b0d4-4d43-ad31-e4c276385a98" />
<img width="400" alt="email-partner" src="https://github.com/user-attachments/assets/aa0dc258-b538-41b8-96d1-39e1b5e2368b" />
<img width="400" alt="email-workspace" src="https://github.com/user-attachments/assets/70415477-dbe6-4aa2-b63f-e1707530a1c9" />
Schema
New
SubmittedLeadCommentmodel.partnerVisibleholds the visibility.partnerIdis set only when the partner wrote the comment, likeMessage.senderPartnerId.notifiedAtrecords which comments the notification jobs have handled, so a job sends every comment that is not sent yet. This needs aprisma db push.Decisions to review
newMessageFromProgramandnewMessageFromPartnernotification settings. There are no new settings. Like message emails, the workspace email goes to every role with the setting on, including viewers and billing users.How to test
1. In
apps/web, start the local services withdocker compose up -d. Then runpnpm prisma:pushto add the new table.2. From the repo root, run
pnpm dev. This also rebuilds@dub/ui, which has a change for the input placeholder.3. Create a lead. Sign in to http://partners.localhost:8888 as a partner of the Acme program. Go to Submitted Leads and click Submit lead.
4. Test the workspace side. Sign in to http://localhost:8888 as a member of the
acmeworkspace. Open Submitted Leads, open the lead, and click the Comments tab.- Post one comment with Workspace only and one with Workspace and partner. The second one is orange.
- Edit and delete your own comment from the ⋯ menu.
5. Test the partner side. In the partner portal, open the same lead and click Comments.
- You see only the Workspace and partner comment.
- Post a reply. In the workspace, it shows with a Partner badge.
6. Test the emails. Without ngrok, QStash cannot reach your local app, so call the cron route yourself. In local dev, the route does not check the QStash signature.
- In the browser Network tab, open the request to
/submitted-leads/<lead id>/comments. Copy theidandcreatedAtof the newest comment.- Run the command below. Use
notify-partnerfor a Workspace and partner comment, andnotify-programfor a partner comment.- Open MailHog at http://localhost:8025 to see the email.
7. To see the email templates with sample data, run
pnpm devinpackages/emailand open http://localhost:3333.<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
New Features
Added a Comments tab to submitted-lead details in workspace and partner views, with a comment-count badge and comment history.
Workspace users can post comments, choose whether partners can see them, and edit or delete their own comments. Partners can post comments visible to the workspace.
Added email notifications for new comments, with comment details and links back to the submitted lead, sent to eligible recipients.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->