@@ -31,6 +31,10 @@ fn todo_completion_report_is_full_nonblocking_and_independent_of_poke() {
3131 crate :: todo:: save_todos ( & session_id, & todos) . unwrap ( ) ;
3232 assert ! ( !app. refresh_completed_todo_report( true ) ) ;
3333 todos = completion_report_todos ( "completed" ) ;
34+ todos[ 11 ] . details = Some ( format ! (
35+ "Evidence for task 11 {} FINAL_EVIDENCE_MARKER" ,
36+ "long evidence with Unicode 測試 and punctuation * _ < > &. " . repeat( 80 )
37+ ) ) ;
3438 crate :: todo:: save_todos ( & session_id, & todos) . unwrap ( ) ;
3539 crate :: todo:: save_plan (
3640 & session_id,
@@ -51,6 +55,10 @@ fn todo_completion_report_is_full_nonblocking_and_independent_of_poke() {
5155 feedback_loop_relevance : Some (
5256 crate :: todo:: FeedbackLoopRelevance :: AcceptanceBlocked ,
5357 ) ,
58+ feedback_loop_relevance_history : vec ! [
59+ crate :: todo:: FeedbackLoopRelevance :: Indirect ,
60+ crate :: todo:: FeedbackLoopRelevance :: AcceptanceBlocked ,
61+ ] ,
5462 iteration_maturity : Some ( crate :: todo:: IterationMaturity :: ConstraintsExhausted ) ,
5563 stopping_evidence : Some ( "External service unavailable" . into ( ) ) ,
5664 ..Default :: default ( )
@@ -63,12 +71,13 @@ fn todo_completion_report_is_full_nonblocking_and_independent_of_poke() {
6371 assert_eq ! ( reports. len( ) , 1 ) ;
6472 let report = ( * reports[ 0 ] ) . clone ( ) ;
6573 let content = & report. content ;
74+ let snapshot: serde_json:: Value = serde_json:: from_str ( content) . unwrap ( ) ;
75+ assert_eq ! ( snapshot[ "todo_completion_version" ] , 1 ) ;
6676 for expected in [
6777 "Report task 0" ,
6878 "Report task 11" ,
6979 "Evidence for task 11" ,
70- "acceptance_blocked" ,
71- "acceptance path blocked" ,
80+ "acceptance_blocked" ,
7281 "uncertain" ,
7382 "External service unavailable" ,
7483 "Show all evidence without another agent turn" ,
@@ -94,8 +103,22 @@ fn todo_completion_report_is_full_nonblocking_and_independent_of_poke() {
94103 . join ( "\n " ) ;
95104 let normalized = plain. split_whitespace ( ) . collect :: < Vec < _ > > ( ) . join ( " " ) ;
96105 assert ! ( normalized. contains( "Report task 11" ) , "{plain}" ) ;
97- if width >= 40 {
98- assert ! ( plain. contains( "acceptance_blocked" ) , "{plain}" ) ;
106+ // Removing wrap whitespace lets us assert every detail even when
107+ // an individual word has to be split at a narrow terminal width.
108+ let unwrapped: String = plain. chars ( ) . filter ( |ch| !ch. is_whitespace ( ) ) . collect ( ) ;
109+ for expected in [
110+ "Evidence for task 11" ,
111+ "FINAL_EVIDENCE_MARKER" ,
112+ "acceptance_blocked" ,
113+ "acceptance path blocked" ,
114+ "Earlier weak states" ,
115+ "feedback_loop_relevance was indirect" ,
116+ "intent understanding was uncertain" ,
117+ "External service unavailable" ,
118+ "Current weaknesses, limitations, or missing assessments" ,
119+ ] {
120+ let expected: String = expected. chars ( ) . filter ( |ch| !ch. is_whitespace ( ) ) . collect ( ) ;
121+ assert ! ( unwrapped. contains( & expected) , "missing {expected}: {plain}" ) ;
99122 }
100123 for line in & lines {
101124 assert ! ( line. width( ) <= width as usize , "width {width}: {line}" ) ;
@@ -121,6 +144,12 @@ fn todo_completion_report_refreshes_evidence_and_preserves_previous_cycles() {
121144 . content
122145 . contains( "Additional acceptance evidence" )
123146 ) ;
147+ let first_report = completion_report_messages ( & app) [ 0 ] . clone ( ) ;
148+ let first_render = crate :: tui:: ui:: render_system_message (
149+ & first_report,
150+ 40 ,
151+ crate :: config:: DiffDisplayMode :: Off ,
152+ ) ;
124153
125154 todos[ 0 ] . status = "in_progress" . into ( ) ;
126155 crate :: todo:: save_todos ( & session_id, & todos) . unwrap ( ) ;
@@ -133,6 +162,15 @@ fn todo_completion_report_refreshes_evidence_and_preserves_previous_cycles() {
133162 assert_eq ! ( reports. len( ) , 2 ) ;
134163 assert ! ( !reports[ 0 ] . content. contains( "Second cycle task" ) ) ;
135164 assert ! ( reports[ 1 ] . content. contains( "Second cycle task" ) ) ;
165+ assert_eq ! (
166+ crate :: tui:: ui:: render_system_message(
167+ reports[ 0 ] ,
168+ 40 ,
169+ crate :: config:: DiffDisplayMode :: Off ,
170+ ) ,
171+ first_render,
172+ "historic report must not read the current todo file"
173+ ) ;
136174 assert ! ( app. queued_messages. is_empty( ) ) ;
137175 } ) ;
138176}
0 commit comments