@@ -17,7 +17,7 @@ import {
1717 writeBundle ,
1818 type WriteBundleResult ,
1919} from '../lib/bundle.js' ;
20- import { findSample } from '../lib/dry-run/samples.js' ;
20+ import { findSample , sampleFailureTriageResult } from '../lib/dry-run/samples.js' ;
2121import {
2222 ApiError ,
2323 CLIError ,
@@ -4065,78 +4065,7 @@ export async function runFailureTriage(
40654065 const stderrFn = deps . stderr ?? ( ( line : string ) => process . stderr . write ( `${ line } \n` ) ) ;
40664066
40674067 if ( opts . dryRun ) {
4068- const dryRunResult : FailureTriageResult = {
4069- projectId : opts . projectId ,
4070- clusters : [
4071- {
4072- clusterId : 'cluster_kind_network_timeout' ,
4073- label : 'Environment issue (network_timeout)' ,
4074- groupKey : 'kind:network_timeout' ,
4075- groupReason : 'failure_kind' ,
4076- failureKind : 'network_timeout' ,
4077- representativeTestId : 'test_dryrun_a' ,
4078- memberTestIds : [ 'test_dryrun_a' , 'test_dryrun_b' ] ,
4079- members : [
4080- {
4081- testId : 'test_dryrun_a' ,
4082- testName : 'Dry-run checkout flow' ,
4083- testType : 'frontend' ,
4084- updatedAt : '2026-06-26T12:00:00.000Z' ,
4085- status : 'failed' ,
4086- failureKind : 'network_timeout' ,
4087- snapshotId : 'snap_dryrun_a' ,
4088- rootCauseHypothesis : null ,
4089- recommendedFixTarget : null ,
4090- } ,
4091- {
4092- testId : 'test_dryrun_b' ,
4093- testName : 'Dry-run profile update' ,
4094- testType : 'frontend' ,
4095- updatedAt : '2026-06-26T12:01:00.000Z' ,
4096- status : 'failed' ,
4097- failureKind : 'network_timeout' ,
4098- snapshotId : 'snap_dryrun_b' ,
4099- rootCauseHypothesis : null ,
4100- recommendedFixTarget : null ,
4101- } ,
4102- ] ,
4103- canonicalRootCause : null ,
4104- confidence : 0.88 ,
4105- fixPriority : 1 ,
4106- } ,
4107- {
4108- clusterId : 'cluster_ref_src_components_checkoutform_tsx_412' ,
4109- label : 'Shared fix target: src/components/CheckoutForm.tsx:412' ,
4110- groupKey : 'ref:src/components/CheckoutForm.tsx:412' ,
4111- groupReason : 'fix_target' ,
4112- failureKind : 'assertion' ,
4113- representativeTestId : 'test_dryrun_c' ,
4114- memberTestIds : [ 'test_dryrun_c' ] ,
4115- members : [
4116- {
4117- testId : 'test_dryrun_c' ,
4118- testName : 'Dry-run submit checkout' ,
4119- testType : 'frontend' ,
4120- updatedAt : '2026-06-26T12:02:00.000Z' ,
4121- status : 'failed' ,
4122- failureKind : 'assertion' ,
4123- snapshotId : 'snap_dryrun_c' ,
4124- rootCauseHypothesis :
4125- 'Submit button is disabled because the credit-card field is empty.' ,
4126- recommendedFixTarget : {
4127- kind : 'code' ,
4128- reference : 'src/components/CheckoutForm.tsx:412' ,
4129- rationale : 'Disabled state originates from `isFormValid()`.' ,
4130- } ,
4131- } ,
4132- ] ,
4133- canonicalRootCause : 'Submit button is disabled because the credit-card field is empty.' ,
4134- confidence : 0.7 ,
4135- fixPriority : 3 ,
4136- } ,
4137- ] ,
4138- summary : { totalFailed : 3 , clusterCount : 2 , skipped : 0 } ,
4139- } ;
4068+ const dryRunResult = sampleFailureTriageResult ( opts . projectId ) ;
41404069 out . print ( dryRunResult , data => renderFailureTriageText ( data as FailureTriageResult ) ) ;
41414070 return dryRunResult ;
41424071 }
@@ -8922,7 +8851,7 @@ function createTestFailureCommand(deps: TestDeps): Command {
89228851 . description (
89238852 'Group all failed tests in a project into root-cause clusters (lightweight summary fan-out — no bundle downloads)' ,
89248853 )
8925- . requiredOption ( '--project <id>' , 'project id (returned by `testsprite project list`)' )
8854+ . option ( '--project <id>' , 'project id (returned by `testsprite project list`)' )
89268855 . option ( '--type <type>' , 'filter by test type (frontend|backend)' )
89278856 . option (
89288857 '--filter <substr>' ,
@@ -8950,13 +8879,13 @@ function createTestFailureCommand(deps: TestDeps): Command {
89508879 )
89518880 . action (
89528881 async (
8953- cmdOpts : { project : string ; type ?: string ; filter ?: string ; maxConcurrency ?: string } ,
8882+ cmdOpts : { project ? : string ; type ?: string ; filter ?: string ; maxConcurrency ?: string } ,
89548883 command : Command ,
89558884 ) => {
89568885 await runFailureTriage (
89578886 {
89588887 ...resolveCommonOptions ( command ) ,
8959- projectId : cmdOpts . project ,
8888+ projectId : cmdOpts . project ?? '' ,
89608889 type : parseEnumFlag ( cmdOpts . type , 'type' , TEST_TYPES ) ,
89618890 nameFilter : cmdOpts . filter ,
89628891 maxConcurrency :
0 commit comments