@@ -4106,6 +4106,7 @@ fn verify_daemon_push_plan_matches_cli_preview(
41064106fn push_preview_plan_matches ( cli_preview : & PushReport , daemon_preview : & PushReport ) -> bool {
41074107 cli_preview. validation == daemon_preview. validation
41084108 && cli_preview. plan == daemon_preview. plan
4109+ && cli_preview. readable_diff == daemon_preview. readable_diff
41094110 && cli_preview. guardrail == daemon_preview. guardrail
41104111}
41114112
@@ -4235,7 +4236,7 @@ fn diff(args: &[String], json: bool) -> i32 {
42354236 exit_code
42364237 }
42374238 Ok ( report) => {
4238- let exit_code = diff_plain_report_exit_code ( & report) ;
4239+ let exit_code = diff_report_exit_code ( & report) ;
42394240 print_diff_report ( & report) ;
42404241 exit_code
42414242 }
@@ -6637,13 +6638,6 @@ fn diff_report_exit_code(report: &crate::diff::DiffReport) -> i32 {
66376638 }
66386639}
66396640
6640- fn diff_plain_report_exit_code ( report : & crate :: diff:: DiffReport ) -> i32 {
6641- match report. action . as_str ( ) {
6642- "confirm_plan" | "confirm_dangerous_plan" => 4 ,
6643- _ => diff_report_exit_code ( report) ,
6644- }
6645- }
6646-
66476641fn pull_report_exit_code ( report : & PullReport ) -> i32 {
66486642 if report. ok {
66496643 EXIT_SUCCESS
@@ -7192,9 +7186,9 @@ mod tests {
71927186 print_push_confirmation_preview, projection_mode_for_target,
71937187 projection_usage_options_for_target, prompt_for_push_confirmation,
71947188 pull_direct_fallback_error, push_confirmation_preview_matches_displayed,
7195- should_prompt_for_push_confirmation , should_refresh_notion_url_search ,
7196- spinner_config_for_command , spinner_enabled , status as run_status_command ,
7197- validate_virtual_projection_registration, write_log_report,
7189+ push_preview_plan_matches , should_prompt_for_push_confirmation ,
7190+ should_refresh_notion_url_search , spinner_config_for_command , spinner_enabled ,
7191+ status as run_status_command , validate_virtual_projection_registration, write_log_report,
71987192 } ;
71997193
72007194 #[ test]
@@ -7798,6 +7792,18 @@ mod tests {
77987792 assert_eq ! ( diff_report_exit_code( & report( false ) ) , EXIT_VALIDATION ) ;
77997793 }
78007794
7795+ #[ test]
7796+ fn confirm_plan_diff_report_exits_successfully_when_clean ( ) {
7797+ let mut report = report ( true ) ;
7798+ report. action = "confirm_plan" . to_string ( ) ;
7799+ report. readable_diff = Some ( locality_core:: readable_diff:: ReadableDiffOutput {
7800+ files : Vec :: new ( ) ,
7801+ text : "diff --locality a/Roadmap.md b/Roadmap.md\n " . to_string ( ) ,
7802+ } ) ;
7803+
7804+ assert_eq ! ( diff_report_exit_code( & report) , EXIT_SUCCESS ) ;
7805+ }
7806+
78017807 #[ test]
78027808 fn push_report_exit_codes_track_gate_states ( ) {
78037809 assert_eq ! (
@@ -7929,6 +7935,25 @@ mod tests {
79297935 ) ) ;
79307936 }
79317937
7938+ #[ test]
7939+ fn daemon_push_preview_match_includes_readable_diff ( ) {
7940+ let mut cli_preview = push_report ( "confirm_plan" ) ;
7941+ cli_preview. readable_diff = Some ( locality_core:: readable_diff:: ReadableDiffOutput {
7942+ files : Vec :: new ( ) ,
7943+ text : "diff --locality a/Roadmap.md b/Roadmap.md\n -Old\n +New\n " . to_string ( ) ,
7944+ } ) ;
7945+ let mut daemon_preview = cli_preview. clone ( ) ;
7946+
7947+ assert ! ( push_preview_plan_matches( & cli_preview, & daemon_preview) ) ;
7948+
7949+ daemon_preview. readable_diff = Some ( locality_core:: readable_diff:: ReadableDiffOutput {
7950+ files : Vec :: new ( ) ,
7951+ text : "diff --locality a/Roadmap.md b/Roadmap.md\n -Old\n +Different\n " . to_string ( ) ,
7952+ } ) ;
7953+
7954+ assert ! ( !push_preview_plan_matches( & cli_preview, & daemon_preview) ) ;
7955+ }
7956+
79327957 #[ test]
79337958 fn spinner_is_only_enabled_for_human_terminal_output ( ) {
79347959 assert ! ( spinner_enabled( false , true ) ) ;
0 commit comments