@@ -2,7 +2,7 @@ import { mkdir, writeFile } from "node:fs/promises"
22import { join , relative } from "node:path"
33import { stripUndefined , type ArtifactBundle , type RuntimeInfo } from "@automattic/wp-codebox-core"
44import type { RunOutput } from "../runtime-command-wrappers.js"
5- import type { RecipeArtifactPointerCommandStatus , RecipeArtifactPointerState , RecipePhaseEvidence } from "./recipe-run-types.js"
5+ import type { RecipeArtifactPointerCommandStatus , RecipeArtifactPointerState , RecipeBrowserEvidence , RecipePhaseEvidence } from "./recipe-run-types.js"
66
77export class RecipeArtifactPointerTracker {
88 private command : string | undefined
@@ -11,6 +11,7 @@ export class RecipeArtifactPointerTracker {
1111 private artifacts : ArtifactBundle | undefined
1212 private failure : RunOutput [ "error" ] | undefined
1313 private phases : RecipePhaseEvidence [ ] = [ ]
14+ private browserEvidence : RecipeBrowserEvidence [ ] = [ ]
1415
1516 constructor ( private readonly directory : string | undefined , private readonly runId : string , private readonly recipePath : string , private readonly startedAt : string ) { }
1617
@@ -23,8 +24,9 @@ export class RecipeArtifactPointerTracker {
2324 this . commandStatus = state . commandStatus ?? this . commandStatus
2425 this . runtime = state . runtime ?? this . runtime
2526 this . artifacts = state . artifacts ?? this . artifacts
26- this . failure = state . failure ?? this . failure
27+ this . failure = state . failure ?? ( state . commandStatus === "completed" || state . commandStatus === "running" ? undefined : this . failure )
2728 this . phases = state . phases ?? this . phases
29+ this . browserEvidence = state . browserEvidence ?? this . browserEvidence
2830
2931 const pointer = stripUndefined ( {
3032 schema : "wp-codebox/recipe-run-artifact-pointer/v1" ,
@@ -39,6 +41,7 @@ export class RecipeArtifactPointerTracker {
3941 commandStatus : this . commandStatus ,
4042 failure : this . failure ,
4143 failurePhase : recipeArtifactPointerFailurePhase ( this . failure , this . phases ) ,
44+ browserEvidence : this . browserEvidence . length > 0 ? this . browserEvidence : undefined ,
4245 paths : recipeArtifactPointerPaths ( this . directory , this . runtime , this . artifacts ) ,
4346 } )
4447
0 commit comments