@@ -535,6 +535,36 @@ def test_vague_intent_question_content(self):
535535 self .assertIn ("CLARIFICATION REQUIRED" , result )
536536 self .assertIn ("concrete change" , result )
537537
538+ def test_budget_exhausted_skips_gate (self ):
539+ result = self .engine .build_instructions (
540+ "PLAN" , prompt = "PLAN improve it" , question_budget = 0
541+ )
542+ self .assertNotIn ("CLARIFICATION REQUIRED" , result )
543+ self .assertIn ("# Mode: PLAN" , result )
544+
545+ def test_budget_decrements_in_directive (self ):
546+ result = self .engine .build_instructions (
547+ "PLAN" , prompt = "PLAN improve it" , question_budget = 2
548+ )
549+ self .assertIn ("CLARIFICATION REQUIRED" , result )
550+ self .assertIn ("Remaining question budget: 1" , result )
551+
552+ def test_default_budget_is_three (self ):
553+ result = self .engine .build_instructions ("PLAN" , prompt = "PLAN improve it" )
554+ self .assertIn ("Remaining question budget: 2" , result )
555+
556+ def test_snake_case_regex_ignores_short_fragments (self ):
557+ """snake_case pattern requires >=2 chars on each side of underscore."""
558+ result = self .engine .build_instructions ("PLAN" , prompt = "PLAN a_b" )
559+ # 'a_b' is too short for the tightened regex; prompt is also short
560+ self .assertIn ("CLARIFICATION REQUIRED" , result )
561+
562+ def test_snake_case_regex_matches_real_identifiers (self ):
563+ result = self .engine .build_instructions (
564+ "PLAN" , prompt = "PLAN fix the parse_mode function"
565+ )
566+ self .assertNotIn ("CLARIFICATION REQUIRED" , result )
567+
538568
539569if __name__ == "__main__" :
540570 unittest .main ()
0 commit comments