@@ -38,11 +38,14 @@ const SAMPLE_VALIDATION_CONFIG = {
3838 } ,
3939 update_issue : {
4040 defaultMax : 1 ,
41- customValidation : "requiresOneOf:status,title,body" ,
41+ customValidation : "requiresOneOf:status,title,body,labels,assignees,milestone " ,
4242 fields : {
4343 status : { type : "string" , enum : [ "open" , "closed" ] } ,
4444 title : { type : "string" , sanitize : true , maxLength : 128 } ,
4545 body : { type : "string" , sanitize : true , maxLength : 65000 } ,
46+ labels : { type : "array" } ,
47+ assignees : { type : "array" , itemType : "string" , itemSanitize : true , itemMaxLength : 39 } ,
48+ milestone : { optionalPositiveInteger : true } ,
4649 issue_number : { issueOrPRNumber : true } ,
4750 } ,
4851 } ,
@@ -94,6 +97,29 @@ const SAMPLE_VALIDATION_CONFIG = {
9497 repo : { type : "string" , maxLength : 256 } ,
9598 } ,
9699 } ,
100+ set_issue_type : {
101+ defaultMax : 5 ,
102+ fields : {
103+ issue_number : { issueOrPRNumber : true } ,
104+ issue_type : { required : true , type : "string" , sanitize : true , maxLength : 128 } ,
105+ rationale : { type : "string" , sanitize : true , maxLength : 1024 } ,
106+ confidence : { type : "string" , enum : [ "LOW" , "MEDIUM" , "HIGH" ] } ,
107+ suggest : { type : "boolean" } ,
108+ } ,
109+ } ,
110+ set_issue_field : {
111+ defaultMax : 5 ,
112+ customValidation : "requiresOneOf:field_name,field_node_id" ,
113+ fields : {
114+ issue_number : { issueOrPRNumber : true } ,
115+ field_name : { type : "string" , sanitize : true , maxLength : 128 } ,
116+ field_node_id : { type : "string" , maxLength : 256 } ,
117+ value : { required : true , type : "string" , sanitize : true , maxLength : 256 } ,
118+ rationale : { type : "string" , sanitize : true , maxLength : 1024 } ,
119+ confidence : { type : "string" , enum : [ "LOW" , "MEDIUM" , "HIGH" ] } ,
120+ suggest : { type : "boolean" } ,
121+ } ,
122+ } ,
97123 link_sub_issue : {
98124 defaultMax : 5 ,
99125 customValidation : "parentAndSubDifferent" ,
@@ -691,6 +717,14 @@ describe("safe_output_type_validator", () => {
691717 expect ( result . isValid ) . toBe ( true ) ;
692718 } ) ;
693719
720+ it ( "should pass when update_issue only includes labels" , async ( ) => {
721+ const { validateItem } = await import ( "./safe_output_type_validator.cjs" ) ;
722+
723+ const result = validateItem ( { type : "update_issue" , labels : [ { name : "bug" , confidence : "HIGH" } ] } , "update_issue" , 1 ) ;
724+
725+ expect ( result . isValid ) . toBe ( true ) ;
726+ } ) ;
727+
694728 it ( "should fail when none of the required fields are present" , async ( ) => {
695729 const { validateItem } = await import ( "./safe_output_type_validator.cjs" ) ;
696730
@@ -822,6 +856,18 @@ describe("safe_output_type_validator", () => {
822856 expect ( result . isValid ) . toBe ( false ) ;
823857 expect ( result . error ) . toContain ( "must be 'open' or 'closed'" ) ;
824858 } ) ;
859+
860+ it ( "should validate issue intent confidence enums" , async ( ) => {
861+ const { validateItem } = await import ( "./safe_output_type_validator.cjs" ) ;
862+
863+ const typeResult = validateItem ( { type : "set_issue_type" , issue_type : "Bug" , confidence : "high" , suggest : true } , "set_issue_type" , 1 ) ;
864+ expect ( typeResult . isValid ) . toBe ( true ) ;
865+ expect ( typeResult . normalizedItem . confidence ) . toBe ( "HIGH" ) ;
866+
867+ const fieldResult = validateItem ( { type : "set_issue_field" , field_name : "Priority" , value : "P1" , confidence : "medium" , rationale : "Customer escalation" } , "set_issue_field" , 1 ) ;
868+ expect ( fieldResult . isValid ) . toBe ( true ) ;
869+ expect ( fieldResult . normalizedItem . confidence ) . toBe ( "MEDIUM" ) ;
870+ } ) ;
825871 } ) ;
826872
827873 describe ( "pattern validation" , ( ) => {
0 commit comments