Skip to content

Comments

feat: classify review comments by type and render informational comments as annotations#221

Merged
matt2e merged 4 commits intomainfrom
review-comment-types
Feb 19, 2026
Merged

feat: classify review comments by type and render informational comments as annotations#221
matt2e merged 4 commits intomainfrom
review-comment-types

Conversation

@matt2e
Copy link
Contributor

@matt2e matt2e commented Feb 19, 2026

Adds a comment type/severity system to AI review comments and renders informational comments as lightweight annotations instead of full review comments.

Changes

  • Comment type classification: AI review comments are now classified as information, suggestion, warning, or issue via a new comment_type column in the store (schema v13).
  • Annotation rendering: Comments classified as information are rendered as SmartDiff annotations (revealed by holding the A key) rather than appearing in the review comment list, reducing noise.
  • Review preprompt enrichment: The review system prompt now includes guidance on comment types and review philosophy to improve classification quality.
  • Frontend types: Added CommentType type and commentType field to the Comment interface.

…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.
@matt2e matt2e merged commit 8b0b753 into main Feb 19, 2026
3 checks passed
@matt2e matt2e deleted the review-comment-types branch February 19, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant