revert(runner): drop per-tick HTML capture

Removes captureHTML helper and its three call sites; HTMLAvailable
flag no longer set on Step.
This commit is contained in:
pj committed 2026-04-27 19:51:55 +07:00
1 parent 18c2458783
commit ced6b5db7f
1 file changed
+8 -49
+8 -49
View File
@@ -73,7 +73,6 @@ func Run(ctx context.Context, options Options) (Summary, error) {
var hierarchyErr error
var metrics *trace.Metrics
var logs []verifier.LogEntry
var htmlCaptured bool
g, _ := errgroup.WithContext(ctx)
g.Go(func() error {
@@ -92,10 +91,6 @@ func Run(ctx context.Context, options Options) (Summary, error) {
})
var v8Overrides map[int]json.RawMessage
if web, ok := options.Driver.(driver.WebDriver); ok {
g.Go(func() error {
htmlCaptured = captureHTML(ctx, web, options.TraceWriter, logger, si, false)
return nil
})
g.Go(func() error {
overrides, err := web.EvaluateExtractors(ctx)
if err != nil {
@@ -112,12 +107,6 @@ func Run(ctx context.Context, options Options) (Summary, error) {
captureScreenshot(ctx, options, logger, postStep, true)
return nil
})
if web, ok := options.Driver.(driver.WebDriver); ok {
g.Go(func() error {
captureHTML(ctx, web, options.TraceWriter, logger, postStep, true)
return nil
})
}
pendingPostScreenshot = false
}
g.Wait()
@@ -180,15 +169,14 @@ func Run(ctx context.Context, options Options) (Summary, error) {
}
step := trace.Step{
Index: stepIndex,
Timestamp: stepStart,
Screen: screen,
Action: traceAction,
Violations: violations,
Hierarchy: tree,
Residuals: residuals,
Metrics: metrics,
HTMLAvailable: htmlCaptured,
Index: stepIndex,
Timestamp: stepStart,
Screen: screen,
Action: traceAction,
Violations: violations,
Hierarchy: tree,
Residuals: residuals,
Metrics: metrics,
}
if err := options.TraceWriter.WriteStep(step); err != nil {
return summary, fmt.Errorf("step %d trace: %w", stepIndex, err)
@@ -229,9 +217,6 @@ func Run(ctx context.Context, options Options) (Summary, error) {
if pendingPostScreenshot {
captureScreenshot(ctx, options, logger, pendingPostScreenshotStep, true)
if web, ok := options.Driver.(driver.WebDriver); ok {
captureHTML(ctx, web, options.TraceWriter, logger, pendingPostScreenshotStep, true)
}
}
summary.EndTime = time.Now()
@@ -489,32 +474,6 @@ func nextActionFromV8(ctx context.Context, web driver.WebDriver) (verifier.Actio
}
}
// captureHTML pulls the current document HTML from a WebDriver-capable
// driver and stamps it into the trace under html/. Returns true on a
// successful non-empty write so the Step.HTMLAvailable flag advertises the
// payload to the inspect UI.
func captureHTML(ctx context.Context, web driver.WebDriver, writer *trace.Writer, logger *slog.Logger, stepIndex int, after bool) bool {
html, err := web.Document(ctx)
if err != nil {
logger.Warn("html capture failed", "step", stepIndex, "after", after, "err", err)
return false
}
if html == "" {
return false
}
var writeErr error
if after {
writeErr = writer.WriteHTMLAfter(stepIndex, []byte(html))
} else {
writeErr = writer.WriteHTML(stepIndex, []byte(html))
}
if writeErr != nil {
logger.Warn("html write failed", "step", stepIndex, "after", after, "err", writeErr)
return false
}
return true
}
func captureScreenshot(ctx context.Context, options Options, logger *slog.Logger, stepIndex int, after bool) {
image, err := options.Driver.Screenshot(ctx)
if err != nil {