feat(social): answer the client's comments on the review link (#1301) #1325
All Vouch review confidence checks passed
Residual risk 0.28 = Change Risk (0.52) × (1 − Review Confidence (0.47)).
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.02 · 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.344
Real PR Conversation Timeline
1 comments
"Review active on #1325"
general
weight: 0.35
claude[bot]
What changed
The team can now answer a client's comment where the client reads it (#1301), and the plan review link follow-ups from #930 are folded in.
Reply (#1301)
social.review.reply(owners, admins and members; R1; audited with the answer, its post and link, and whether it cleared). One editable team reply per client answer: write, edit, or clear with an empty text /null. Plain text like the report note (NFC, LF, hidden characters stripped, trimmed), 1 to 2,000 characters like the client's own comment. A member limited to some channels (#1081) gets403 CHANNEL_NOT_ALLOWEDon a post with none of their channels; another org's answer is404 REVIEW_FEEDBACK_NOT_FOUND.social.review_link.listreturnsreply: { body, by, at } | nullper answer; RPCsocial.reviewLinks.reply.#930
bodyon the post, and a channel'sbodyis null when it shows the post's body (its own text otherwise). The page resolves it withplanChannel.crove_tenantloses INSERT oncrove_social.review_link_post.social.review_link.create_planfills its new link through the new definercrove_social.review_plan_posts_add(link, posts), which only fills a live plan link of the context's org that has no posts yet, for an owner or admin who made it, with 1 to 50 distinct live posts of the org (it computes the content keys itself).Migration
20261030010000_crove_social_review_replies.sql(renamed from the reserved 20261029250000 because #1292 landed20261030001000; above #1297's20261030002100):reply_body,replied_by,replied_atoncrove_social.review_feedback, with CHECKs on the length and all-or-none.GRANT UPDATE (reply_body, replied_by, replied_at)tocrove_tenant, plus aBEFORE UPDATEguard triggerreview_feedback_reply_guardthat refuses any change to the client's fields (whoever makes it, the database owner included) and a reply whosereplied_byis not the context's user.REVOKE INSERT ON crove_social.review_link_post FROM crove_tenant; new definerreview_plan_posts_add(granted tocrove_tenantonly).review_link_viewandreview_plan_pagere-created from their newest definitions (20261029160000_crove_social_channel_signature.sql), bodies copied verbatim with only the reply (and, for the plan page, the body-once change) added; same signatures,SECURITY DEFINERonreview_link_view,search_path = pg_catalog, pg_temp, REVOKE/GRANT restated.packages/dbtypes regenerated (review_link_postis nowNotGrantedfor insert). No check-union change needed.Protected path: this PR touches
supabase/migrations/and re-creates publicSECURITY DEFINERfunctions, plus adds a tenant-callable definer. It needs the independent security review (the coordinator runs it).How it was tested
apps/kernel/test/social-review-replies.db.test.ts(PostgreSQL 17): reply, edit, clear; viewer refused; the single-post and plan pages show the reply with no member name/id/email; answer rows, link answer counts and the client's verdict unchanged; audit rows; channel scope (#1081);crove_tenantcannot update client fields, insert or delete answers, write a reply in another member's name or break all-or-none; the guard refuses the database owner too; column privileges are exactly the three reply columns; no tenant INSERT onreview_link_post;review_plan_posts_addrefuses a frozen plan, a non-maker, a member, duplicates, empty lists, another org's or cancelled posts, and calls without a context; EXECUTE matrix; concurrent creates hold both caps.social-plan-review.db.test.ts(body once,review_link_postgrants nowSELECTonly) andsocial-signature.db.test.ts(compares the #1190 definitions against the previous ones inside one transaction, since this PR re-creates them again; plan channel bodies resolved from the post).apps/app/test/social-review-replies.test.tsx: both public pages (org vs branding name, escaping, no reply, older server without the field, plan body once) and the panel (member names, a member who left, controls for members, none for viewers, vi and en).check-unions, the whole invariant suite (pass, apart from the known Windows-onlyroute-coverage, andwrite-pathwhich timed out under load and passes alone;rls-matrix,personal-data,kernel-invariants,conformancere-run green after the latest merge),modules/socialandapps/appunit tests,pnpm typecheck,pnpm lint,pnpm docs:check,migration-order.mjs, andmigration-lint.mjs --since.Closes #1301
Closes #930
🤖 Generated with Claude Code
---
<!-- dos-pr-summary -->
📌 TL;DR
This PR introduces a "Team Reply" feature (#1301) allowing agency members to respond to client feedback on social review links, with the reply displayed to clients under the organization's name rather than the individual member's. It also refactors the plan review data structure (#930) to store post bodies once per post rather than duplicating them across channels.
🎯 Type of Change
🔍 Changes Walkthrough
| File | Summary of Changes |
| :--- | :--- |
|
apps/app/src/components/social-review-links.tsx| AddsClientAnswercomponent to handle reply UI (create, edit, delete) for team members. UpdatesReviewLinksto acceptcanReplyprop and pass member name resolution. ||
apps/app/src/i18n/messages/en.ts| Adds English translations for reply actions, hints, and error messages. ||
apps/app/src/i18n/messages/vi.ts| Adds Vietnamese translations for reply actions, hints, and error messages. ||
apps/app/src/lib/kernel-errors.ts| Registers newREVIEW_FEEDBACK_NOT_FOUNDerror code. ||
apps/app/src/routes/social-post.tsx| PassescanReplypermission to theReviewLinkscomponent based on user write access. ||
apps/app/src/routes/social-review.tsx| Updates client-facing review page to display team replies signed by the org name. RefactorsPlanPosttypes to support single-body posts (#930) and addsTeamReplycomponent. ||
apps/app/test/social-review-replies.test.tsx| New frontend tests verifying reply visibility, org-name signing, XSS escaping, and permission controls. ||
apps/kernel/src/review-link.ts| UpdatesReviewAnswerandReviewPlanPagetypes to include reply data and single-body post structure. ||
apps/kernel/src/rpc.ts| Registers the newsocial.review.replyRPC handler. ||
apps/kernel/test/social-plan-review.db.test.ts| Updates existing plan review tests to reflect the new single-body data structure. ||
apps/kernel/test/social-review-replies.db.test.ts| New backend integration tests covering reply permissions, data integrity, RLS guards, audit logging, and plan body deduplication. |📊 Architectural Flow
<!-- /dos-pr-summary -->