@@ -8,9 +8,12 @@ use super::{
88pub ( super ) fn generate_summary ( comments : & [ Comment ] ) -> ReviewSummary {
99 let mut by_severity = HashMap :: new ( ) ;
1010 let mut by_category = HashMap :: new ( ) ;
11+ let mut open_by_severity = HashMap :: new ( ) ;
1112 let mut files = HashSet :: new ( ) ;
1213 let mut critical_issues = 0 ;
1314 let mut open_comments = 0 ;
15+ let mut open_blocking_comments = 0 ;
16+ let mut open_informational_comments = 0 ;
1417 let mut resolved_comments = 0 ;
1518 let mut dismissed_comments = 0 ;
1619 let mut open_blockers = 0 ;
@@ -31,9 +34,16 @@ pub(super) fn generate_summary(comments: &[Comment]) -> ReviewSummary {
3134 match comment. status {
3235 CommentStatus :: Open => {
3336 open_comments += 1 ;
34- if matches ! ( comment. severity, Severity :: Error | Severity :: Warning ) {
37+ * open_by_severity
38+ . entry ( comment. severity . to_string ( ) )
39+ . or_insert ( 0 ) += 1 ;
40+ if comment. severity . is_blocking ( ) {
41+ open_blocking_comments += 1 ;
3542 open_blockers += 1 ;
3643 }
44+ if comment. severity . is_informational ( ) {
45+ open_informational_comments += 1 ;
46+ }
3747 }
3848 CommentStatus :: Resolved => resolved_comments += 1 ,
3949 CommentStatus :: Dismissed => dismissed_comments += 1 ,
@@ -49,6 +59,9 @@ pub(super) fn generate_summary(comments: &[Comment]) -> ReviewSummary {
4959 overall_score : calculate_overall_score ( comments) ,
5060 recommendations : generate_recommendations ( comments) ,
5161 open_comments,
62+ open_by_severity,
63+ open_blocking_comments,
64+ open_informational_comments,
5265 resolved_comments,
5366 dismissed_comments,
5467 open_blockers,
@@ -220,9 +233,12 @@ mod tests {
220233 let summary = generate_summary ( & comments) ;
221234 assert_eq ! ( summary. total_comments, 3 ) ;
222235 assert_eq ! ( summary. open_comments, 1 ) ;
236+ assert_eq ! ( summary. open_blocking_comments, 1 ) ;
237+ assert_eq ! ( summary. open_informational_comments, 0 ) ;
223238 assert_eq ! ( summary. resolved_comments, 1 ) ;
224239 assert_eq ! ( summary. dismissed_comments, 1 ) ;
225240 assert_eq ! ( summary. open_blockers, 1 ) ;
241+ assert_eq ! ( summary. open_by_severity. get( "Error" ) , Some ( & 1 ) ) ;
226242 assert_eq ! ( summary. merge_readiness, MergeReadiness :: NeedsAttention ) ;
227243 assert_eq ! (
228244 summary. recommendations,
@@ -249,10 +265,44 @@ mod tests {
249265
250266 let summary = generate_summary ( & comments) ;
251267 assert_eq ! ( summary. open_blockers, 0 ) ;
268+ assert_eq ! ( summary. open_blocking_comments, 0 ) ;
269+ assert_eq ! ( summary. open_informational_comments, 0 ) ;
252270 assert_eq ! ( summary. merge_readiness, MergeReadiness :: Ready ) ;
253271 assert ! ( summary. recommendations. is_empty( ) ) ;
254272 }
255273
274+ #[ test]
275+ fn summary_distinguishes_blocking_and_informational_open_findings ( ) {
276+ let comments = vec ! [
277+ make_comment(
278+ "open-warning" ,
279+ Severity :: Warning ,
280+ Category :: Bug ,
281+ CommentStatus :: Open ,
282+ ) ,
283+ make_comment(
284+ "open-info" ,
285+ Severity :: Info ,
286+ Category :: Documentation ,
287+ CommentStatus :: Open ,
288+ ) ,
289+ make_comment(
290+ "open-suggestion" ,
291+ Severity :: Suggestion ,
292+ Category :: Style ,
293+ CommentStatus :: Open ,
294+ ) ,
295+ ] ;
296+
297+ let summary = generate_summary ( & comments) ;
298+ assert_eq ! ( summary. open_comments, 3 ) ;
299+ assert_eq ! ( summary. open_blocking_comments, 1 ) ;
300+ assert_eq ! ( summary. open_informational_comments, 2 ) ;
301+ assert_eq ! ( summary. open_by_severity. get( "Warning" ) , Some ( & 1 ) ) ;
302+ assert_eq ! ( summary. open_by_severity. get( "Info" ) , Some ( & 1 ) ) ;
303+ assert_eq ! ( summary. open_by_severity. get( "Suggestion" ) , Some ( & 1 ) ) ;
304+ }
305+
256306 #[ test]
257307 fn summary_needs_rereview_when_verification_is_inconclusive ( ) {
258308 let comments = vec ! [ make_comment(
0 commit comments