Summary
Add a discussion_summary field to the existing /api/v1/miners/:githubId/pulls and /issues responses, backed by new SQL views over comments and review_comments. Additive, no breaking changes.
Motivation
The mirror already ingests every conversation comment (packages/db/05_comments.sql) and every inline review comment (packages/db/06_review_comments.sql), but none of it reaches consumers. miners.service.ts:56-61 builds review_summary (approvals / changes_requested counts) and stops there. The issue response shape has no comment fields at all.
Consequence: scoring consumers can't tell a PR merged after substantive review apart from one merged with zero discussion, or an issue with active maintainer engagement from one nobody touched.
Proposed Solution
New view — packages/db/26_view_pr_discussion_summary.sql
CREATE OR REPLACE VIEW pr_discussion_summary AS
SELECT
repo_full_name,
target_number AS pr_number,
COUNT(*) AS conversation_comment_count,
COUNT(DISTINCT author_github_id) AS conversation_unique_authors,
COUNT(*) FILTER (WHERE author_association IN ('OWNER','MEMBER','COLLABORATOR'))
AS maintainer_conversation_comments,
MAX(created_at) AS last_conversation_comment_at
FROM comments
WHERE comment_context = 'pr'
GROUP BY repo_full_name, target_number;
Plus a parallel pr_review_comment_summary over review_comments, and an issue_discussion_summary over comments where comment_context = 'issue'.
Wire into the miner response
Add a discussion_summary field built with the same LEFT JOIN + json_build_object pattern already used for review_summary:
Summary
Add a
discussion_summaryfield to the existing/api/v1/miners/:githubId/pullsand/issuesresponses, backed by new SQL views overcommentsandreview_comments. Additive, no breaking changes.Motivation
The mirror already ingests every conversation comment (packages/db/05_comments.sql) and every inline review comment (packages/db/06_review_comments.sql), but none of it reaches consumers. miners.service.ts:56-61 builds
review_summary(approvals / changes_requested counts) and stops there. The issue response shape has no comment fields at all.Consequence: scoring consumers can't tell a PR merged after substantive review apart from one merged with zero discussion, or an issue with active maintainer engagement from one nobody touched.
Proposed Solution
New view —
packages/db/26_view_pr_discussion_summary.sqlPlus a parallel
pr_review_comment_summaryoverreview_comments, and anissue_discussion_summaryovercommentswherecomment_context = 'issue'.Wire into the miner response
Add a
discussion_summaryfield built with the sameLEFT JOIN+json_build_objectpattern already used forreview_summary: