@@ -3801,6 +3801,74 @@ def test_s2i_build_short_circuits_on_program_stop():
38013801 print (" PASSED: BUILD short-circuits on program=='STOP'" )
38023802
38033803
3804+ # =============================================================================
3805+ # CATEGORY S2j — dotted strategy keys from other programs are dropped
3806+ # =============================================================================
3807+
3808+ def test_s2j_refinement_key_dropped_from_ligandfit_strategy ():
3809+ """S2j: refinement.main.number_of_macro_cycles in ligandfit strategy is dropped,
3810+ not passed through to the ligandfit command."""
3811+ print ("Test: s2j_refinement_key_dropped_from_ligandfit_strategy" )
3812+ sys .path .insert (0 , _PROJECT_ROOT )
3813+ try :
3814+ from agent .program_registry import ProgramRegistry
3815+ except ImportError :
3816+ print (" SKIP (ProgramRegistry unavailable)" )
3817+ return
3818+
3819+ registry = ProgramRegistry (use_yaml = True )
3820+ dropped = []
3821+ passed = []
3822+
3823+ def log (msg ):
3824+ if "DROPPED" in msg :
3825+ dropped .append (msg )
3826+ elif "PASSTHROUGH" in msg :
3827+ passed .append (msg )
3828+
3829+ strategy = {
3830+ "refinement.main.number_of_macro_cycles" : 2 , # belongs to phenix.refine — must be dropped
3831+ }
3832+ files = {"model" : "/fake/placed.pdb" , "data" : "/fake/data.mtz" }
3833+ cmd = registry .build_command ("phenix.ligandfit" , files , strategy , log = log )
3834+
3835+ assert_true (len (dropped ) > 0 ,
3836+ "refinement.main.number_of_macro_cycles must be DROPPED for ligandfit, "
3837+ "but got cmd: %r" % cmd )
3838+ assert_true ("number_of_macro_cycles" not in (cmd or "" ),
3839+ "refinement.main.number_of_macro_cycles must not appear in ligandfit command, "
3840+ "got: %r" % cmd )
3841+ assert_true (len (passed ) == 0 ,
3842+ "No dotted key should be passed through, got: %r" % passed )
3843+ print (" PASSED: refinement.main.number_of_macro_cycles correctly dropped from ligandfit" )
3844+
3845+
3846+ def test_s2j_known_short_names_still_pass_through ():
3847+ """S2j: KNOWN_PHIL_SHORT_NAMES (nproc, twin_law, etc.) still pass through normally."""
3848+ print ("Test: s2j_known_short_names_still_pass_through" )
3849+ sys .path .insert (0 , _PROJECT_ROOT )
3850+ try :
3851+ from agent .program_registry import ProgramRegistry
3852+ except ImportError :
3853+ print (" SKIP (ProgramRegistry unavailable)" )
3854+ return
3855+
3856+ registry = ProgramRegistry (use_yaml = True )
3857+ passed = []
3858+
3859+ def log (msg ):
3860+ if "PASSTHROUGH" in msg and "nproc" in msg :
3861+ passed .append (msg )
3862+
3863+ strategy = {"nproc" : 4 }
3864+ files = {"model" : "/fake/model.pdb" , "data" : "/fake/data.mtz" }
3865+ cmd = registry .build_command ("phenix.ligandfit" , files , strategy , log = log )
3866+
3867+ assert_true (len (passed ) > 0 or (cmd and "nproc=4" in cmd ),
3868+ "nproc should still pass through as a KNOWN_PHIL_SHORT_NAME" )
3869+ print (" PASSED: nproc still passes through correctly" )
3870+
3871+
38043872# RUN ALL TESTS
38053873# =============================================================================
38063874
0 commit comments