@@ -206,6 +206,97 @@ runtime:
206206 }
207207}
208208
209+ func TestMigrateContextBudgetConfigContentRemovesLegacyRuntimeNoProgressField (t * testing.T ) {
210+ t .Parallel ()
211+
212+ input := []byte (strings .TrimSpace (`
213+ runtime:
214+ max_no_progress_streak: 5
215+ max_repeat_cycle_streak: 3
216+ ` ) + "\n " )
217+
218+ out , changed , notes , err := MigrateContextBudgetConfigContent (input )
219+ if err != nil {
220+ t .Fatalf ("MigrateContextBudgetConfigContent() error = %v" , err )
221+ }
222+ if ! changed {
223+ t .Fatal ("expected migration change" )
224+ }
225+ if len (notes ) != 0 {
226+ t .Fatalf ("expected no migration notes, got %v" , notes )
227+ }
228+
229+ text := string (out )
230+ if strings .Contains (text , "max_no_progress_streak" ) {
231+ t .Fatalf ("expected max_no_progress_streak removed, got:\n %s" , text )
232+ }
233+ if ! strings .Contains (text , "max_repeat_cycle_streak: 3" ) {
234+ t .Fatalf ("expected max_repeat_cycle_streak preserved, got:\n %s" , text )
235+ }
236+ }
237+
238+ func TestMigrateContextBudgetConfigContentRemovesLegacyVerificationNoProgressField (t * testing.T ) {
239+ t .Parallel ()
240+
241+ input := []byte (strings .TrimSpace (`
242+ runtime:
243+ verification:
244+ max_no_progress: 3
245+ verifiers:
246+ test:
247+ timeout_sec: 30
248+ ` ) + "\n " )
249+
250+ out , changed , notes , err := MigrateContextBudgetConfigContent (input )
251+ if err != nil {
252+ t .Fatalf ("MigrateContextBudgetConfigContent() error = %v" , err )
253+ }
254+ if ! changed {
255+ t .Fatal ("expected migration change" )
256+ }
257+ if len (notes ) != 0 {
258+ t .Fatalf ("expected no migration notes, got %v" , notes )
259+ }
260+
261+ text := string (out )
262+ if strings .Contains (text , "max_no_progress" ) {
263+ t .Fatalf ("expected max_no_progress removed, got:\n %s" , text )
264+ }
265+ if ! strings .Contains (text , "timeout_sec: 30" ) {
266+ t .Fatalf ("expected verifier config preserved, got:\n %s" , text )
267+ }
268+ }
269+
270+ func TestMigrateContextBudgetConfigContentRemovesLegacyMemoExtractRecentMessagesField (t * testing.T ) {
271+ t .Parallel ()
272+
273+ input := []byte (strings .TrimSpace (`
274+ memo:
275+ auto_extract: true
276+ extract_recent_messages: 4
277+ extract_timeout_sec: 9
278+ ` ) + "\n " )
279+
280+ out , changed , notes , err := MigrateContextBudgetConfigContent (input )
281+ if err != nil {
282+ t .Fatalf ("MigrateContextBudgetConfigContent() error = %v" , err )
283+ }
284+ if ! changed {
285+ t .Fatal ("expected migration change" )
286+ }
287+ if len (notes ) != 0 {
288+ t .Fatalf ("expected no migration notes, got %v" , notes )
289+ }
290+
291+ text := string (out )
292+ if strings .Contains (text , "extract_recent_messages" ) {
293+ t .Fatalf ("expected extract_recent_messages removed, got:\n %s" , text )
294+ }
295+ if ! strings .Contains (text , "auto_extract: true" ) || ! strings .Contains (text , "extract_timeout_sec: 9" ) {
296+ t .Fatalf ("expected supported memo fields preserved, got:\n %s" , text )
297+ }
298+ }
299+
209300func TestMigrateContextBudgetConfigFileCreatesBackup (t * testing.T ) {
210301 t .Parallel ()
211302
0 commit comments