@@ -1077,56 +1077,6 @@ func TestFeatureFlagBoth(t *testing.T) {
10771077 }
10781078}
10791079
1080- func TestFeatureFlagHoldBack (t * testing.T ) {
1081- // Tool with disable flag and hold-back flag (simulates legacy tool during consolidation)
1082- legacyTool := mockToolWithFlags ("legacy_tool" , "toolset1" , true , "" , "consolidation_flag" )
1083- legacyTool .FeatureFlagHoldBack = "holdback_flag"
1084-
1085- tools := []ServerTool {
1086- mockTool ("always_available" , "toolset1" , true ),
1087- legacyTool ,
1088- }
1089-
1090- // Consolidation OFF, hold-back OFF -> legacy tool available (normal operation)
1091- checkerAllOff := func (_ context.Context , _ string ) (bool , error ) { return false , nil }
1092- regAllOff := NewBuilder ().SetTools (tools ).WithToolsets ([]string {"all" }).WithFeatureChecker (checkerAllOff ).Build ()
1093- availableAllOff := regAllOff .AvailableTools (context .Background ())
1094- if len (availableAllOff ) != 2 {
1095- t .Fatalf ("Expected 2 tools when both flags off, got %d" , len (availableAllOff ))
1096- }
1097-
1098- // Consolidation ON, hold-back OFF -> legacy tool excluded (migrated to new tools)
1099- checkerConsolidationOnly := func (_ context.Context , flag string ) (bool , error ) {
1100- return flag == "consolidation_flag" , nil
1101- }
1102- regConsolidationOnly := NewBuilder ().SetTools (tools ).WithToolsets ([]string {"all" }).WithFeatureChecker (checkerConsolidationOnly ).Build ()
1103- availableConsolidationOnly := regConsolidationOnly .AvailableTools (context .Background ())
1104- if len (availableConsolidationOnly ) != 1 {
1105- t .Fatalf ("Expected 1 tool when consolidation on but holdback off, got %d" , len (availableConsolidationOnly ))
1106- }
1107- if availableConsolidationOnly [0 ].Tool .Name != "always_available" {
1108- t .Errorf ("Expected always_available, got %s" , availableConsolidationOnly [0 ].Tool .Name )
1109- }
1110-
1111- // Consolidation ON, hold-back ON -> legacy tool available (user opted to hold back)
1112- checkerBothOn := func (_ context.Context , _ string ) (bool , error ) { return true , nil }
1113- regBothOn := NewBuilder ().SetTools (tools ).WithToolsets ([]string {"all" }).WithFeatureChecker (checkerBothOn ).Build ()
1114- availableBothOn := regBothOn .AvailableTools (context .Background ())
1115- if len (availableBothOn ) != 2 {
1116- t .Fatalf ("Expected 2 tools when both consolidation and holdback on, got %d" , len (availableBothOn ))
1117- }
1118-
1119- // Consolidation OFF, hold-back ON -> legacy tool available (hold-back has no effect when consolidation off)
1120- checkerHoldbackOnly := func (_ context.Context , flag string ) (bool , error ) {
1121- return flag == "holdback_flag" , nil
1122- }
1123- regHoldbackOnly := NewBuilder ().SetTools (tools ).WithToolsets ([]string {"all" }).WithFeatureChecker (checkerHoldbackOnly ).Build ()
1124- availableHoldbackOnly := regHoldbackOnly .AvailableTools (context .Background ())
1125- if len (availableHoldbackOnly ) != 2 {
1126- t .Fatalf ("Expected 2 tools when only holdback on, got %d" , len (availableHoldbackOnly ))
1127- }
1128- }
1129-
11301080func TestFeatureFlagError (t * testing.T ) {
11311081 tools := []ServerTool {
11321082 mockToolWithFlags ("needs_flag" , "toolset1" , true , "my_feature" , "" ),
0 commit comments