@@ -20,6 +20,10 @@ import (
2020func TestThriftFieldIdsAreWithinAllowedRange (t * testing.T ) {
2121 const maxAllowedFieldID = 3329
2222
23+ allowedExceptions := map [int ]bool {
24+ 3353 : true ,
25+ }
26+
2327 // Get the directory of this test file
2428 _ , filename , _ , ok := runtime .Caller (0 )
2529 if ! ok {
@@ -30,7 +34,7 @@ func TestThriftFieldIdsAreWithinAllowedRange(t *testing.T) {
3034 testDir := filepath .Dir (filename )
3135 cliServicePath := filepath .Join (testDir , "cli_service.go" )
3236
33- violations , err := validateThriftFieldIDs (cliServicePath , maxAllowedFieldID )
37+ violations , err := validateThriftFieldIDs (cliServicePath , maxAllowedFieldID , allowedExceptions )
3438 if err != nil {
3539 t .Fatalf ("Failed to validate thrift field IDs: %v" , err )
3640 }
@@ -51,8 +55,9 @@ func TestThriftFieldIdsAreWithinAllowedRange(t *testing.T) {
5155}
5256
5357// validateThriftFieldIDs parses the cli_service.go file and extracts all thrift field IDs
54- // to validate they are within the allowed range.
55- func validateThriftFieldIDs (filePath string , maxAllowedFieldID int ) ([]string , error ) {
58+ // to validate they are within the allowed range. Field IDs listed in allowedExceptions
59+ // are permitted even if they exceed the maximum.
60+ func validateThriftFieldIDs (filePath string , maxAllowedFieldID int , allowedExceptions map [int ]bool ) ([]string , error ) {
5661 file , err := os .Open (filePath ) //nolint:gosec // G304: path is a test fixture, not user-controlled
5762 if err != nil {
5863 return nil , fmt .Errorf ("failed to open file %s: %w" , filePath , err )
@@ -84,7 +89,7 @@ func validateThriftFieldIDs(filePath string, maxAllowedFieldID int) ([]string, e
8489 continue
8590 }
8691
87- if fieldID >= maxAllowedFieldID {
92+ if fieldID >= maxAllowedFieldID && ! allowedExceptions [ fieldID ] {
8893 // Extract struct/field context from the line
8994 context := extractFieldContext (line )
9095 violation := fmt .Sprintf (
0 commit comments