@@ -507,6 +507,84 @@ describe("qa cli runtime", () => {
507507 ) ;
508508 } ) ;
509509
510+ it ( "rejects a direct suite summary with unaccounted outcomes" , async ( ) => {
511+ await fs . writeFile (
512+ suiteSummaryPath ,
513+ JSON . stringify ( {
514+ counts : { total : 2 , passed : 1 , failed : 0 , skipped : 0 } ,
515+ scenarios : [ { status : "pass" } ] ,
516+ } ) ,
517+ "utf8" ,
518+ ) ;
519+ runQaSuite . mockResolvedValueOnce (
520+ unifiedSuiteRuntimeResult ( {
521+ outputDir : suiteArtifactsDir ,
522+ reportPath : suiteReportPath ,
523+ summaryPath : suiteSummaryPath ,
524+ evidencePath : suiteEvidencePath ,
525+ } ) ,
526+ ) ;
527+
528+ await expect ( runQaSuiteCommand ( { repoRoot : "/tmp/openclaw-repo" } ) ) . rejects . toMatchObject ( {
529+ code : "summary_counts_invalid" ,
530+ } ) ;
531+ } ) ;
532+
533+ it ( "rejects a direct suite summary whose canonical evidence contradicts its counts" , async ( ) => {
534+ await fs . writeFile (
535+ suiteSummaryPath ,
536+ JSON . stringify ( {
537+ counts : { total : 1 , passed : 1 , failed : 0 , skipped : 0 } ,
538+ scenarios : [ { status : "pass" } ] ,
539+ evidence : { entries : [ { result : { status : "fail" } } ] } ,
540+ } ) ,
541+ "utf8" ,
542+ ) ;
543+ runQaSuite . mockResolvedValueOnce (
544+ unifiedSuiteRuntimeResult ( {
545+ outputDir : suiteArtifactsDir ,
546+ reportPath : suiteReportPath ,
547+ summaryPath : suiteSummaryPath ,
548+ evidencePath : suiteEvidencePath ,
549+ } ) ,
550+ ) ;
551+
552+ await expect ( runQaSuiteCommand ( { repoRoot : "/tmp/openclaw-repo" } ) ) . rejects . toMatchObject ( {
553+ code : "summary_counts_invalid" ,
554+ } ) ;
555+ } ) ;
556+
557+ it ( "accepts a passing scenario with lower-level blocked and passing producer checks" , async ( ) => {
558+ const priorExitCode = process . exitCode ;
559+ process . exitCode = undefined ;
560+ await fs . writeFile (
561+ suiteSummaryPath ,
562+ JSON . stringify ( {
563+ counts : { total : 1 , passed : 1 , failed : 0 , skipped : 0 } ,
564+ scenarios : [ { status : "pass" } ] ,
565+ evidence : {
566+ entries : [ { result : { status : "blocked" } } , { result : { status : "pass" } } ] ,
567+ } ,
568+ } ) ,
569+ "utf8" ,
570+ ) ;
571+ runQaSuite . mockResolvedValueOnce (
572+ unifiedSuiteRuntimeResult ( {
573+ outputDir : suiteArtifactsDir ,
574+ reportPath : suiteReportPath ,
575+ summaryPath : suiteSummaryPath ,
576+ evidencePath : suiteEvidencePath ,
577+ } ) ,
578+ ) ;
579+
580+ try {
581+ await runQaSuiteCommand ( { repoRoot : "/tmp/openclaw-repo" } ) ;
582+ expect ( process . exitCode ) . toBeUndefined ( ) ;
583+ } finally {
584+ process . exitCode = priorExitCode ;
585+ }
586+ } ) ;
587+
510588 it ( "keeps a direct suite green for a real pass and a report-only optional tool skip" , async ( ) => {
511589 const priorExitCode = process . exitCode ;
512590 process . exitCode = undefined ;
@@ -624,12 +702,10 @@ describe("qa cli runtime", () => {
624702 await fs . writeFile (
625703 suiteSummaryPath ,
626704 JSON . stringify ( {
627- counts : {
628- total : 1 ,
629- passed : 0 ,
630- failed : 0 ,
631- skipped : summary === "required-skip" ? 1 : 0 ,
632- } ,
705+ counts :
706+ summary === "required-skip"
707+ ? { total : 1 , passed : 0 , failed : 0 , skipped : 1 }
708+ : { total : 1 } ,
633709 scenarios : [
634710 {
635711 name : "Required channel scenario" ,
0 commit comments