@@ -112,7 +112,9 @@ interface NormalizedEvidence {
112112}
113113
114114interface RunFixture {
115+ error ?: string ;
115116 exitCode ?: number ;
117+ rawOutput ?: string ;
116118 record ?: NormalizedEvidence ;
117119 runId : string ;
118120}
@@ -402,12 +404,19 @@ import { join } from "node:path";
402404const runIndex = process.argv.indexOf("--validate-run");
403405const repoIndex = process.argv.indexOf("--repo");
404406const trustedRefIndex = process.argv.indexOf("--trusted-workflow-ref");
407+ const verifierShaIndex = process.argv.indexOf("--verifier-source-sha");
408+ const verifierFileIndex = process.argv.indexOf("--verifier-source-file");
405409if (
406410 runIndex < 0 ||
407411 repoIndex < 0 ||
408412 trustedRefIndex < 0 ||
413+ verifierShaIndex < 0 ||
414+ verifierFileIndex < 0 ||
409415 process.argv[repoIndex + 1] !== "openclaw/openclaw" ||
410- process.argv[trustedRefIndex + 1] !== "main"
416+ process.argv[trustedRefIndex + 1] !== "main" ||
417+ process.argv[verifierShaIndex + 1] !== process.env.FAKE_VERIFIER_SHA ||
418+ process.argv[verifierFileIndex + 1] !== process.argv[1] ||
419+ !process.argv.includes("--json")
411420) {
412421 console.error("validator invocation contract mismatch");
413422 process.exit(2);
@@ -416,7 +425,13 @@ const fixture = JSON.parse(
416425 readFileSync(join(process.env.FAKE_VALIDATOR_FIXTURES, \`\${process.argv[runIndex + 1]}.json\`), "utf8"),
417426);
418427if (fixture.exitCode) {
419- console.error("fixture validator rejection");
428+ process.stdout.write(
429+ \`\${fixture.rawOutput ?? JSON.stringify({
430+ error: fixture.error ?? "fixture validator rejection",
431+ schema: "openclaw.release-validation-evidence/v3",
432+ valid: false,
433+ })}\\n\`,
434+ );
420435 process.exit(fixture.exitCode);
421436}
422437process.stdout.write(\`\${JSON.stringify(fixture.record)}\\n\`);
@@ -449,10 +464,7 @@ function setUpFixtures(runs: RunFixture[]): {
449464 JSON . stringify ( { workflow_runs : runs . map ( ( { runId } ) => ( { id : Number ( runId ) } ) ) } ) ,
450465 ) ;
451466 for ( const run of runs ) {
452- writeFileSync (
453- join ( fixtures , `${ run . runId } .json` ) ,
454- JSON . stringify ( { exitCode : run . exitCode ?? 0 , record : run . record } ) ,
455- ) ;
467+ writeFileSync ( join ( fixtures , `${ run . runId } .json` ) , JSON . stringify ( run ) ) ;
456468 }
457469 return { binDir, fixtures, validatorPath } ;
458470}
@@ -531,6 +543,7 @@ function runResolver(args: {
531543 ...process . env ,
532544 FAKE_GH_FIXTURES : args . fixtures ,
533545 FAKE_VALIDATOR_FIXTURES : args . fixtures ,
546+ FAKE_VERIFIER_SHA : verifierSha ,
534547 GITHUB_OUTPUT : "" ,
535548 OPENCLAW_RELEASE_CI_SUMMARY_VALIDATOR : args . validatorPath ,
536549 PATH : `${ args . binDir } :${ process . env . PATH } ` ,
@@ -714,11 +727,12 @@ describe("scripts/github/find-reusable-release-validation.sh", () => {
714727 expect ( parseOutput ( result . stdout ) ) . toMatchObject ( { reuse : "true" } ) ;
715728 } ) ;
716729
717- it ( "skips validator rejection and selects the next strict record" , ( ) => {
730+ it ( "surfaces bounded validator rejection and selects the next strict record" , ( ) => {
718731 const { clone, priorSha } = getSharedRepo ( ) ;
719732 const record = normalizedEvidence ( { runId : "111" , targetSha : priorSha } ) ;
733+ const validatorError = `evidence source mismatch\n${ "x" . repeat ( 600 ) } ` ;
720734 const { binDir, fixtures, validatorPath } = setUpFixtures ( [
721- { exitCode : 1 , runId : "222" } ,
735+ { error : validatorError , exitCode : 1 , runId : "222" } ,
722736 { record, runId : "111" } ,
723737 ] ) ;
724738
@@ -732,7 +746,33 @@ describe("scripts/github/find-reusable-release-validation.sh", () => {
732746
733747 expect ( result . status ) . toBe ( 0 ) ;
734748 expect ( parseOutput ( result . stdout ) ) . toMatchObject ( { evidence_run_id : "111" , reuse : "true" } ) ;
735- expect ( result . stderr ) . toContain ( "run 222: shared evidence validator rejected the run" ) ;
749+ expect ( result . stderr ) . toContain (
750+ `run 222: shared evidence validator rejected the run: evidence source mismatch ${ "x" . repeat ( 472 ) } ...; skipping` ,
751+ ) ;
752+ expect ( result . stderr ) . not . toContain ( "\nxxxxxxxx" ) ;
753+ } ) ;
754+
755+ it ( "uses the generic rejection diagnostic when validator output is malformed" , ( ) => {
756+ const { clone, priorSha } = getSharedRepo ( ) ;
757+ const record = normalizedEvidence ( { runId : "111" , targetSha : priorSha } ) ;
758+ const { binDir, fixtures, validatorPath } = setUpFixtures ( [
759+ { exitCode : 1 , rawOutput : "not-json" , runId : "222" } ,
760+ { record, runId : "111" } ,
761+ ] ) ;
762+
763+ const result = runResolver ( {
764+ binDir,
765+ fixtures,
766+ repoDir : clone ,
767+ targetSha : priorSha ,
768+ validatorPath,
769+ } ) ;
770+
771+ expect ( result . status ) . toBe ( 0 ) ;
772+ expect ( parseOutput ( result . stdout ) ) . toMatchObject ( { evidence_run_id : "111" , reuse : "true" } ) ;
773+ expect ( result . stderr ) . toContain (
774+ "run 222: shared evidence validator rejected the run; skipping" ,
775+ ) ;
736776 } ) ;
737777
738778 it . each ( [
0 commit comments