feat(runner): thread step screenshot into PushSnapshot

This commit is contained in:
pj committed 2026-06-12 10:29:56 +05:30
1 parent 1b3545abb2
commit bae2ca6e8d
1 file changed
+5 -3
+5 -3
View File
@@ -105,6 +105,7 @@ func Run(ctx context.Context, options Options) (Summary, error) {
var tree *hierarchy.Tree var tree *hierarchy.Tree
var hierarchyErr error var hierarchyErr error
var transitional bool var transitional bool
var screenshotPNG []byte
var metrics *trace.Metrics var metrics *trace.Metrics
var logs []verifier.LogEntry var logs []verifier.LogEntry
@@ -118,7 +119,7 @@ func Run(ctx context.Context, options Options) (Summary, error) {
// screenshot describe the same frame, then re-fetches the pair // screenshot describe the same frame, then re-fetches the pair
// while the tree still looks transitional. // while the tree still looks transitional.
g.Go(func() error { g.Go(func() error {
tree, transitional, hierarchyErr = fetchSyncedState(gctx, options, logger, si) tree, screenshotPNG, transitional, hierarchyErr = fetchSyncedState(gctx, options, logger, si)
return nil return nil
}) })
g.Go(func() error { g.Go(func() error {
@@ -184,6 +185,7 @@ func Run(ctx context.Context, options Options) (Summary, error) {
if !transitional { if !transitional {
if err := options.Verifier.PushSnapshot(verifier.SnapshotInput{ if err := options.Verifier.PushSnapshot(verifier.SnapshotInput{
Tree: tree, Tree: tree,
ScreenshotPNG: screenshotPNG,
LastAction: lastAction, LastAction: lastAction,
StepTime: stepStart, StepTime: stepStart,
StepIndex: stepIndex, StepIndex: stepIndex,
@@ -855,7 +857,7 @@ const (
// on a still-transitional tree. Callers use it to skip the verifier for // on a still-transitional tree. Callers use it to skip the verifier for
// that step so the previous/current extractor advance does not absorb // that step so the previous/current extractor advance does not absorb
// transient state. // transient state.
func fetchSyncedState(ctx context.Context, options Options, logger *slog.Logger, stepIndex int) (tree *hierarchy.Tree, transitional bool, err error) { func fetchSyncedState(ctx context.Context, options Options, logger *slog.Logger, stepIndex int) (tree *hierarchy.Tree, png []byte, transitional bool, err error) {
var pngBytes []byte var pngBytes []byte
var previousJSON string var previousJSON string
retryLoop: retryLoop:
@@ -896,7 +898,7 @@ retryLoop:
logger.Warn("screenshot write failed", "step", stepIndex, "err", writeErr) logger.Warn("screenshot write failed", "step", stepIndex, "err", writeErr)
} }
} }
return tree, transitional, err return tree, pngBytes, transitional, err
} }
// isTransitionalHierarchy returns true when the tree carries more than one // isTransitionalHierarchy returns true when the tree carries more than one