feat: classify review comments by type and render informational comments as annotations#221
Merged
feat: classify review comments by type and render informational comments as annotations#221
Conversation
…ents as annotations Add a comment type system (information, suggestion, warning, issue) to distinguish between different kinds of AI review feedback. Information-type comments are rendered as hold-A-to-reveal annotation overlays using the existing AnnotationOverlay component, while other types remain as regular inline comments. Changes across the full stack: - Prompt: add 'type' field to the review-comments JSON schema so the AI classifies each comment - Backend: add CommentType enum and optional comment_type field to Comment struct, parse the type from AI output in extract_review_comments() - DB: add comment_type TEXT column to the comments table - Store: persist and read comment_type in add_comment/load_review_children - Frontend types: add CommentType and commentType to the Comment interface - DiffModal: split comments into annotations (information) vs regular comments, convert information comments to SmartDiffAnnotation objects, add keydown/keyup handler for A key to toggle annotation visibility, pass annotations and annotationsRevealed props to DiffViewer - Add serde(rename_all=camelCase) to Comment struct for consistency with all other model structs
…hilosophy Improve the AI review prompt to produce better-classified comments by adding detailed guidance inspired by the old codebase's review system: - Add 'Review philosophy' section: tell the story of the change, focus on 'why' and non-obvious implications, don't exhaustively document every line, quality over quantity - Add 'Comment types' section with detailed criteria and examples for each type (information, suggestion, warning, issue), including when to use each and how they're rendered in the UI - Add guidance that most comments should be information/suggestion, with warning/issue reserved for genuine concerns - Update JSON example to show multiple comment types (information + warning) instead of a single suggestion - Restructure prompt with clear markdown sections for readability This addresses the issue where the AI was not properly classifying comments by type because the prompt lacked sufficient guidance on type selection.
The comment_type column was added to the comments table in a previous commit but the schema version was not incremented. Bump from 12 to 13 so that existing databases trigger a compatibility reset and pick up the new column.
The keydown/keyup handlers for the hold-A-to-reveal annotation overlay did not check whether the event target was an input or textarea. This caused the overlay to flash on and off when users typed the letter 'a' in comment fields. Add an early return guard in both handleKeydown and handleKeyup to skip the annotation toggle when event.target is an HTMLInputElement or HTMLTextAreaElement.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a comment type/severity system to AI review comments and renders informational comments as lightweight annotations instead of full review comments.
Changes
information,suggestion,warning, orissuevia a newcomment_typecolumn in the store (schema v13).informationare rendered as SmartDiff annotations (revealed by holding the A key) rather than appearing in the review comment list, reducing noise.CommentTypetype andcommentTypefield to theCommentinterface.