@@ -144,11 +144,29 @@ fn evaluate_nags() -> DashResult<()> {
144
144
proposal. fcp_start = Some ( UTC :: now ( ) . naive_utc ( ) ) ;
145
145
diesel:: update ( fcp_proposal. find ( proposal. id ) ) . set ( & proposal) . execute ( conn) ?;
146
146
147
- // TODO attempt to add the final-comment-period label
147
+ // attempt to add the final-comment-period label
148
+ // TODO only add label if FCP > 1 day
149
+ let label_res = GH . add_label ( & issue. repository , issue. number , "final-comment-period" ) ;
150
+
151
+ let added_label = match label_res {
152
+ Ok ( ( ) ) => true ,
153
+ Err ( why) => {
154
+ error ! ( "Unable to add FCP label to {}#{}: {:?}" ,
155
+ & issue. repository,
156
+ issue. number,
157
+ why) ;
158
+ false
159
+ }
160
+ } ;
161
+
162
+ let comment_type = CommentType :: FcpAllReviewedNoConcerns {
163
+ added_label : added_label,
164
+ author : & initiator,
165
+ status_comment_id : proposal. fk_bot_tracking_comment ,
166
+ } ;
148
167
149
168
// leave a comment for FCP start
150
- let fcp_start_comment = RfcBotComment :: new ( & issue,
151
- CommentType :: FcpAllReviewedNoConcerns ) ;
169
+ let fcp_start_comment = RfcBotComment :: new ( & issue, comment_type) ;
152
170
fcp_start_comment. post ( None ) ?;
153
171
}
154
172
}
@@ -276,8 +294,7 @@ fn cancel_fcp(author: &GitHubUser, issue: &Issue, existing: &FcpProposal) -> Das
276
294
diesel:: delete ( fcp_proposal. filter ( id. eq ( existing. id ) ) ) . execute ( conn) ?;
277
295
278
296
// leave github comment stating that FCP proposal cancelled
279
- let comment = RfcBotComment :: new ( issue,
280
- CommentType :: FcpProposalCancelled ( author) ) ;
297
+ let comment = RfcBotComment :: new ( issue, CommentType :: FcpProposalCancelled ( author) ) ;
281
298
let _ = comment. post ( None ) ;
282
299
283
300
Ok ( ( ) )
@@ -314,7 +331,7 @@ impl FcpDisposition {
314
331
"merge" => Ok ( FcpDisposition :: Merge ) ,
315
332
"close" => Ok ( FcpDisposition :: Close ) ,
316
333
"postpone" => Ok ( FcpDisposition :: Postpone ) ,
317
- _ => Err ( DashError :: Misc ) ,
334
+ _ => Err ( DashError :: Misc ( None ) ) ,
318
335
}
319
336
}
320
337
}
@@ -536,18 +553,18 @@ impl<'a> RfcBotCommand<'a> {
536
553
let command = command. lines ( )
537
554
. filter ( |& l| l. starts_with ( RFC_BOT_MENTION ) )
538
555
. next ( )
539
- . ok_or ( DashError :: Misc ) ?
556
+ . ok_or ( DashError :: Misc ( None ) ) ?
540
557
. trim_left_matches ( RFC_BOT_MENTION )
541
558
. trim_left_matches ( ':' )
542
559
. trim ( ) ;
543
560
544
561
let mut tokens = command. split_whitespace ( ) ;
545
562
546
- let invocation = tokens. next ( ) . ok_or ( DashError :: Misc ) ?;
563
+ let invocation = tokens. next ( ) . ok_or ( DashError :: Misc ( None ) ) ?;
547
564
548
565
match invocation {
549
566
"fcp" | "pr" => {
550
- let subcommand = tokens. next ( ) . ok_or ( DashError :: Misc ) ?;
567
+ let subcommand = tokens. next ( ) . ok_or ( DashError :: Misc ( None ) ) ?;
551
568
552
569
debug ! ( "Parsed command as new FCP proposal" ) ;
553
570
@@ -558,7 +575,7 @@ impl<'a> RfcBotCommand<'a> {
558
575
"cancel" => Ok ( RfcBotCommand :: FcpCancel ) ,
559
576
_ => {
560
577
error ! ( "unrecognized subcommand for fcp: {}" , subcommand) ;
561
- Err ( DashError :: Misc )
578
+ Err ( DashError :: Misc ( Some ( format ! ( "found bad subcommand: {}" , subcommand ) ) ) )
562
579
}
563
580
}
564
581
}
@@ -582,15 +599,16 @@ impl<'a> RfcBotCommand<'a> {
582
599
"reviewed" => Ok ( RfcBotCommand :: Reviewed ) ,
583
600
"f?" => {
584
601
585
- let user = tokens. next ( ) . ok_or ( DashError :: Misc ) ?;
602
+ let user = tokens. next ( )
603
+ . ok_or ( DashError :: Misc ( Some ( "no user specified" . to_string ( ) ) ) ) ?;
586
604
587
605
if user. len ( ) == 0 {
588
- return Err ( DashError :: Misc ) ;
606
+ return Err ( DashError :: Misc ( Some ( "no user specified" . to_string ( ) ) ) ) ;
589
607
}
590
608
591
609
Ok ( RfcBotCommand :: FeedbackRequest ( & user[ 1 ..] ) )
592
610
}
593
- _ => Err ( DashError :: Misc ) ,
611
+ _ => Err ( DashError :: Misc ( None ) ) ,
594
612
}
595
613
}
596
614
}
@@ -607,7 +625,11 @@ enum CommentType<'a> {
607
625
& ' a [ ( GitHubUser , FcpReviewRequest ) ] ,
608
626
& ' a [ ( GitHubUser , FcpConcern ) ] ) ,
609
627
FcpProposalCancelled ( & ' a GitHubUser ) ,
610
- FcpAllReviewedNoConcerns ,
628
+ FcpAllReviewedNoConcerns {
629
+ author : & ' a GitHubUser ,
630
+ status_comment_id : i32 ,
631
+ added_label : bool ,
632
+ } ,
611
633
FcpWeekPassed ,
612
634
}
613
635
@@ -625,7 +647,7 @@ impl<'a> RfcBotComment<'a> {
625
647
626
648
match self . comment_type {
627
649
CommentType :: FcpProposed ( initiator, disposition, reviewers, concerns) => {
628
- let mut msg = String :: from ( "Team member " ) ;
650
+ let mut msg = String :: from ( "Team member @ " ) ;
629
651
msg. push_str ( & initiator. login ) ;
630
652
msg. push_str ( " has proposed to " ) ;
631
653
msg. push_str ( disposition. repr ( ) ) ;
@@ -645,7 +667,7 @@ impl<'a> RfcBotComment<'a> {
645
667
}
646
668
647
669
if concerns. is_empty ( ) {
648
- msg. push_str ( "\n No concerns currently listed." ) ;
670
+ msg. push_str ( "\n No concerns currently listed.\n " ) ;
649
671
} else {
650
672
msg. push_str ( "\n Concerns:\n \n " ) ;
651
673
}
@@ -678,15 +700,31 @@ impl<'a> RfcBotComment<'a> {
678
700
679
701
Ok ( msg)
680
702
}
703
+
681
704
CommentType :: FcpProposalCancelled ( initiator) => {
682
705
Ok ( format ! ( "@{} proposal cancelled." , initiator. login) )
683
706
}
684
- CommentType :: FcpAllReviewedNoConcerns => {
685
- Ok ( "All relevant subteam members have reviewed. No concerns remain." . to_string ( ) )
707
+
708
+ CommentType :: FcpAllReviewedNoConcerns { author, status_comment_id, added_label } => {
709
+ let mut msg = String :: new ( ) ;
710
+
711
+ msg. push_str ( ":bell: **This is now entering its final comment period**, " ) ;
712
+ msg. push_str ( "as per the [review above](" ) ;
713
+ self . add_comment_url ( & mut msg, status_comment_id) ;
714
+ msg. push_str ( "). :bell:" ) ;
715
+
716
+ if !added_label {
717
+ msg. push_str ( "\n \n *psst @" ) ;
718
+ msg. push_str ( & author. login ) ;
719
+ msg. push_str ( ", I wasn't able to add the `final-comment-period` label," ) ;
720
+ msg. push_str ( " please do so.*" ) ;
721
+ }
722
+
723
+ Ok ( msg)
686
724
}
725
+
687
726
CommentType :: FcpWeekPassed => {
688
- // TODO add ping to original proposal author
689
- Ok ( "It has been one week since all blocks to the FCP were resolved." . to_string ( ) )
727
+ Ok ( "The final comment period is now complete." . to_string ( ) )
690
728
}
691
729
}
692
730
}
@@ -703,6 +741,8 @@ impl<'a> RfcBotComment<'a> {
703
741
fn post ( & self , existing_comment : Option < i32 > ) -> DashResult < CommentFromJson > {
704
742
use config:: CONFIG ;
705
743
744
+ // TODO don't do this if the issue is closed
745
+
706
746
if CONFIG . post_comments {
707
747
708
748
let text = self . format ( ) ?;
@@ -716,7 +756,7 @@ impl<'a> RfcBotComment<'a> {
716
756
info ! ( "Skipping comment to {}#{}, comment posts are disabled." ,
717
757
self . repository,
718
758
self . issue_num) ;
719
- Err ( DashError :: Misc )
759
+ Err ( DashError :: Misc ( None ) )
720
760
}
721
761
}
722
762
}
0 commit comments