@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
55import { dirname , join , resolve } from "node:path" ;
66import { pathToFileURL } from "node:url" ;
77import { expectDefined } from "@openclaw/normalization-core" ;
8- import { describe , expect , it , vi } from "vitest" ;
8+ import { afterEach , describe , expect , it , vi } from "vitest" ;
99import {
1010 buildReleaseExecutionPlanArtifact ,
1111 releaseCompositeJobsSha256 ,
@@ -39,10 +39,12 @@ import {
3939 validateRequestedEvidenceReuse ,
4040 validateTrustedProducerIdentity ,
4141} from "../../scripts/release-ci-summary.mjs" ;
42+ import { useAutoCleanupTempDirTracker } from "../helpers/temp-dir.js" ;
4243
4344const SCRIPT = "scripts/release-ci-summary.mjs" ;
4445const MANIFEST_ARTIFACT_ENTRY = "full-release-validation-manifest.json" ;
4546const hasUnzip = spawnSync ( "unzip" , [ "-v" ] , { stdio : "ignore" } ) . status === 0 ;
47+ const tempDirs = useAutoCleanupTempDirTracker ( afterEach ) ;
4648
4749describe ( "GitHub API commands" , ( ) => {
4850 it ( "delegates authentication to gh for REST and artifact requests" , ( ) => {
@@ -340,7 +342,7 @@ describe("runReleaseCiGh", () => {
340342
341343describe ( "Release execution plan artifact reads" , ( ) => {
342344 it ( "treats GitHub CLI 2.93 missing named artifacts as unavailable" , ( ) => {
343- const root = mkdtempSync ( join ( tmpdir ( ) , "release-plan-missing-artifact-" ) ) ;
345+ const root = tempDirs . make ( "release-plan-missing-artifact-" ) ;
344346 const ghPath = join ( root , "gh" ) ;
345347 writeFileSync (
346348 ghPath ,
@@ -362,7 +364,6 @@ process.exit(1);
362364 } else {
363365 process . env . PATH = previousPath ;
364366 }
365- rmSync ( root , { force : true , recursive : true } ) ;
366367 }
367368 } ) ;
368369} ) ;
@@ -1302,17 +1303,42 @@ describe("release CI summary child correlation", () => {
13021303 } ;
13031304 manifest . executionPlanSha256 = String ( executionPlan . sha256 ) ;
13041305 manifest . sourceParentRunAttempt = 1 ;
1306+ manifest . runAttempt = "2" ;
13051307 manifest . childEvidence = {
13061308 releaseChecks : releaseChecksEvidence ,
13071309 } ;
1310+ fixture . parentRun . run_attempt = 2 ;
1311+ fixture . parentView . attempt = 2 ;
1312+ fixture . artifact . name = `full-release-validation-${ fixture . runId } -2` ;
1313+ const skippedParentJob = {
1314+ completed_at : "2026-08-22T00:02:00Z" ,
1315+ conclusion : "skipped" ,
1316+ id : fixture . parentJob . id + 1 ,
1317+ name : fixture . parentJob . name ,
1318+ run_attempt : 2 ,
1319+ started_at : "2026-08-22T00:02:00Z" ,
1320+ status : "completed" ,
1321+ steps : [ ] ,
1322+ } ;
13081323 client . loadExecutionPlan = ( ) => executionPlan ;
1324+ client . loadManifest = ( requestedRunId : string , requestedRunAttempt : number ) => {
1325+ expect ( requestedRunId ) . toBe ( fixture . runId ) ;
1326+ expect ( requestedRunAttempt ) . toBe ( 2 ) ;
1327+ return { artifact : fixture . artifact , manifest } ;
1328+ } ;
1329+ client . getParentJobs = ( requestedRunId : string ) => {
1330+ expect ( requestedRunId ) . toBe ( fixture . runId ) ;
1331+ return [ fixture . parentJob , skippedParentJob ] ;
1332+ } ;
13091333 client . getRunAttemptJobs = ( _runId : string , attempt : number ) =>
13101334 attempt === 1 ? [ firstAttemptJob ] : [ secondAttemptJob ] ;
1311- fixture . client . getJobLog = ( ) =>
1312- [
1335+ fixture . client . getJobLog = ( jobId : number ) => {
1336+ expect ( jobId ) . toBe ( fixture . parentJob . id ) ;
1337+ return [
13131338 `TARGET_SHA: ${ fixture . targetSha } ` ,
13141339 `Dispatched openclaw-release-checks.yml: ${ fixture . childRun . html_url } (attempt 1)` ,
13151340 ] . join ( "\n" ) ;
1341+ } ;
13161342
13171343 const evidence = validateReleaseRunEvidence (
13181344 {
@@ -1359,6 +1385,44 @@ describe("release CI summary child correlation", () => {
13591385 ) . toThrow ( "execution plan child dispatch tuple mismatch" ) ;
13601386 } ) ;
13611387
1388+ it ( "rejects a parent recovery that reruns a sealed child dispatch slot" , ( ) => {
1389+ const child = expectedChildDispatches ( "28717729503" , 2 , "main" ) . find (
1390+ ( entry ) => entry . manifestKey === "releaseChecks" ,
1391+ ) ;
1392+ if ( ! child ) {
1393+ throw new Error ( "missing release checks fixture" ) ;
1394+ }
1395+ const parentManifest = { runAttempt : 2 , runId : "28717729503" } ;
1396+ const parentJobs = [
1397+ {
1398+ completed_at : "2026-08-22T00:01:00Z" ,
1399+ conclusion : "success" ,
1400+ id : 900 ,
1401+ name : child . parentJobName ,
1402+ run_attempt : 1 ,
1403+ started_at : "2026-08-22T00:00:00Z" ,
1404+ status : "completed" ,
1405+ steps : [ ] ,
1406+ } ,
1407+ {
1408+ completed_at : "2026-08-22T00:02:00Z" ,
1409+ conclusion : "success" ,
1410+ id : 901 ,
1411+ name : child . parentJobName ,
1412+ run_attempt : 2 ,
1413+ started_at : "2026-08-22T00:01:00Z" ,
1414+ status : "completed" ,
1415+ steps : [ ] ,
1416+ } ,
1417+ ] ;
1418+
1419+ expect ( ( ) =>
1420+ selectManifestParentJob ( parentJobs , child , parentManifest , 1 , {
1421+ requireSkippedCarryForward : true ,
1422+ } ) ,
1423+ ) . toThrow ( "manifest parent job was redispatched during recovery" ) ;
1424+ } ) ;
1425+
13621426 it ( "accepts beta advisory release-check failures through canonical policy" , ( ) => {
13631427 const fixture = trustedMainPackageFixture ( ) ;
13641428 fixture . manifest . releaseProfile = "beta" ;
0 commit comments