@@ -431,7 +431,7 @@ async function addIntentToTestCase(
431
431
...testCase ,
432
432
metadata : {
433
433
...testCase . metadata ,
434
- goal : extractedIntent ,
434
+ intent : extractedIntent ,
435
435
} ,
436
436
} ;
437
437
}
@@ -790,38 +790,8 @@ export async function synthesize({
790
790
}
791
791
} ) ;
792
792
793
- // TODO: This is a hack to extract intent for test cases. We should find a better way to do this.
794
- logger . debug ( `Extracting intent for ${ testCases . length } test cases in batches of 20...` ) ;
795
- const batchSize = 20 ;
796
- const testCasesWithIntent : TestCaseWithPlugin [ ] = [ ] ;
797
-
798
- for ( let i = 0 ; i < testCases . length ; i += batchSize ) {
799
- const batch = testCases . slice ( i , i + batchSize ) ;
800
- const batchResults = await Promise . allSettled (
801
- batch . map ( async ( testCase , batchIndex ) => {
802
- try {
803
- return await addIntentToTestCase ( testCase , purpose ) ;
804
- } catch ( error ) {
805
- logger . warn (
806
- `Intent extraction failed for test case ${ i + batchIndex } : ${ error } . Using original test case.` ,
807
- ) ;
808
- return testCase ;
809
- }
810
- } ) ,
811
- ) ;
812
-
813
- batchResults . forEach ( ( result ) => {
814
- if ( result . status === 'fulfilled' ) {
815
- testCasesWithIntent . push ( result . value ) ;
816
- } else {
817
- logger . warn ( `Intent extraction rejected: ${ result . reason } . Using original test case.` ) ;
818
- testCasesWithIntent . push ( batch [ batchResults . indexOf ( result ) ] ) ;
819
- }
820
- } ) ;
821
- }
822
-
823
793
// After generating plugin test cases but before applying strategies:
824
- const pluginTestCases = testCasesWithIntent ;
794
+ const pluginTestCases = testCases ;
825
795
826
796
// Initialize strategy results
827
797
const strategyResults : Record < string , { requested : number ; generated : number } > = { } ;
@@ -876,5 +846,21 @@ export async function synthesize({
876
846
877
847
logger . info ( generateReport ( pluginResults , strategyResults ) ) ;
878
848
879
- return { purpose, entities, testCases : finalTestCases , injectVar } ;
849
+ const testCasesWithIntent = await Promise . all (
850
+ finalTestCases . map ( ( testCase ) => addIntentToTestCase ( testCase , purpose ) ) ,
851
+ ) ;
852
+
853
+ return { purpose, entities, testCases : testCasesWithIntent , injectVar } ;
880
854
}
855
+
856
+ export {
857
+ getPluginSeverity ,
858
+ getStatus ,
859
+ generateReport ,
860
+ categories ,
861
+ formatTestCount ,
862
+ pluginMatchesStrategyTargets ,
863
+ applyStrategies ,
864
+ isStrategyCollection ,
865
+ addIntentToTestCase ,
866
+ } ;
0 commit comments