@@ -88,6 +88,10 @@ function recipeBrowserEvidenceForExecution(execution: RecipeExecutionResult, man
8888 }
8989
9090 const parsed = parseJsonObject ( execution . stdout )
91+ if ( ! parsed && command === "wordpress.editor-validate-blocks" ) {
92+ const evidence = recipeBrowserEvidenceFromEditorValidateBlocksExecution ( execution , manifestFiles )
93+ return evidence ? [ evidence ] : [ ]
94+ }
9195 if ( ! parsed ) {
9296 return [ ]
9397 }
@@ -99,10 +103,39 @@ function recipeBrowserEvidenceForExecution(execution: RecipeExecutionResult, man
99103 } )
100104 }
101105
102- const evidence = recipeBrowserEvidenceFromParsedExecution ( execution , command , parsed , manifestFiles , recipe )
106+ const evidence = command === "wordpress.editor-validate-blocks"
107+ ? recipeBrowserEvidenceFromEditorValidateBlocksExecution ( execution , manifestFiles , parsed )
108+ : recipeBrowserEvidenceFromParsedExecution ( execution , command , parsed , manifestFiles , recipe )
103109 return evidence ? [ evidence ] : [ ]
104110}
105111
112+ function recipeBrowserEvidenceFromEditorValidateBlocksExecution ( execution : RecipeExecutionResult , manifestFiles : Map < string , ArtifactManifestFile > , parsed ?: Record < string , unknown > ) : RecipeBrowserEvidence | undefined {
113+ const files = recipeBrowserEvidenceFiles ( {
114+ validateBlocks : "files/browser/editor-validate-blocks.json" ,
115+ summary : "files/browser/editor-validate-blocks-summary.json" ,
116+ } , manifestFiles )
117+ const summaryFile = browserEvidenceFileRef ( "files/browser/editor-validate-blocks-summary.json" , manifestFiles )
118+ if ( Object . keys ( files ) . length === 0 && ! summaryFile ) {
119+ return undefined
120+ }
121+
122+ const validation = parsed ?? ( typeof execution . result ?. stdout === "string" ? parseJsonObject ( execution . result . stdout ) : undefined )
123+ const summary = stripUndefined ( {
124+ editorValidateBlocks : validation ,
125+ } )
126+ return stripUndefined ( {
127+ schema : "wp-codebox/recipe-browser-evidence/v1" ,
128+ phase : execution . recipePhase ,
129+ index : execution . recipeStepIndex ,
130+ command : "wordpress.editor-validate-blocks" ,
131+ metadata : execution . recipeStepMetadata ,
132+ status : execution . exitCode === 0 ? "completed" : "failed" ,
133+ summaryFile,
134+ files,
135+ summary : Object . keys ( summary ) . length > 0 ? summary : undefined ,
136+ } ) as RecipeBrowserEvidence
137+ }
138+
106139function recipeBrowserEvidenceFromParsedExecution ( execution : RecipeExecutionResult , command : string , parsed : Record < string , unknown > , manifestFiles : Map < string , ArtifactManifestFile > , recipe : WorkspaceRecipe | undefined ) : RecipeBrowserEvidence | undefined {
107140 const files = recipeBrowserEvidenceFiles ( parsed . files , manifestFiles )
108141 const summaryFile = browserEvidenceFileRef ( stringValue ( ( parsed . files as Record < string , unknown > | undefined ) ?. summary ) , manifestFiles )
@@ -169,7 +202,7 @@ function browserEvidenceFileRef(path: string | undefined, manifestFiles: Map<str
169202}
170203
171204function recipeCommandProducesBrowserEvidence ( command : string ) : boolean {
172- return command . startsWith ( "wordpress.browser-" ) || command === "wordpress.editor-canvas-probe" || command === "wordpress.html-capture" || command === "wordpress.visual-compare"
205+ return command . startsWith ( "wordpress.browser-" ) || command === "wordpress.editor-canvas-probe" || command === "wordpress.editor-validate-blocks" || command === "wordpress. html-capture" || command === "wordpress.visual-compare"
173206}
174207
175208export async function executeRecipeWorkflowStep ( runtime : Runtime , workflowStep : ReturnType < typeof recipeWorkflowSteps > [ number ] , recipeDirectory : string , sandboxWorkspace ?: ReturnType < typeof sandboxWorkspaceContract > , artifactRoot ?: string , options ?: RecipeRunOptions , inputMountPathMap : readonly InputMountPathMapping [ ] = [ ] ) : Promise < RecipeExecutionResult > {
0 commit comments