M5: Debugging and visual (trace, breakpoints, visual comparison, ARIA snapshot) — v0.6.0 #8

Merged
akib merged 2 commits from akib/m5-debugging into main 2026-11-10 11:41:07 +00:00 AGit
Owner

M5: Debugging and visual (v0.6.0)

Depends on #7 (M4). This branch is built on m4-outside-access; until #7 is merged this PR also shows the M4 commit. Merge #7 first.

New

  • Trace timeline (M5.1): Run with trace, or "Trace this step". Each step gets before/after pictures, the element's box, the page URL, and a network summary when CDP is already on. Reports shows a filmstrip, and the HTML export includes it. Storage is bounded and the oldest runs are evicted first. Tracing never attaches the debugger on its own.
  • Breakpoints (M5.2): "Pause here" + 🐞 Debug, with Continue / Step / Stop in a banner. The element is highlighted while paused, and a pause survives closing and reopening the editor. Also "pause on error".
  • Visual comparison (M5.3): the Screenshot block's compare keeps a baseline per block, with masks by locator or rectangle, threshold and maxDiffRatio. A difference fails with visual.mismatch and keeps a diff image. "Accept new baseline" is in Reports. Exports to toHaveScreenshot. No new dependency (src/core/pixelDiff.ts).
  • ARIA snapshot assert (M5.4): Assert aria-snapshot with Playwright-style partial templates. Exports to toMatchAriaSnapshot, which passes under real npx playwright test.
  • Run from here / Re-run failed (M5.5).
  • Engine hooks first (182cecd: runOnce(options), Host.debug, Host.trace) with unit tests, so each feature could be built separately.

Verification (this machine)

  • npm run check: 1079 unit/DOM tests
  • npm run e2e: 343 checks in 28 specs, Chromium 156 (new m5-trace, m5-debug incl. the banner and header controls, m5-visual, m5-aria)
  • M5 specs in Brave Origin (headed)
  • npm run e2e:firefox: 52 checks, Firefox 159, now with visual comparison, trace, a debug pause and ARIA snapshot
  • npm run build, npm run build:firefox

Not done / not verified

  • Debug and trace options are not exposed over the bridge (MCP/CLI) yet.
  • A failed visual step carries no comparison id. The Reports panel finds the comparison by node and time window instead.
  • Google Chrome (not installed here), Edge, macOS and Windows not run.

🤖 Generated with Claude Code

## M5: Debugging and visual (v0.6.0) > **Depends on #7 (M4).** This branch is built on `m4-outside-access`; until #7 is merged this PR also shows the M4 commit. Merge #7 first. ### New - **Trace timeline (M5.1)**: Run with trace, or "Trace this step". Each step gets before/after pictures, the element's box, the page URL, and a network summary when CDP is already on. Reports shows a filmstrip, and the HTML export includes it. Storage is bounded and the oldest runs are evicted first. Tracing never attaches the debugger on its own. - **Breakpoints (M5.2)**: "Pause here" + 🐞 Debug, with Continue / Step / Stop in a banner. The element is highlighted while paused, and a pause survives closing and reopening the editor. Also "pause on error". - **Visual comparison (M5.3)**: the Screenshot block's `compare` keeps a baseline per block, with masks by locator or rectangle, `threshold` and `maxDiffRatio`. A difference fails with `visual.mismatch` and keeps a diff image. "Accept new baseline" is in Reports. Exports to `toHaveScreenshot`. No new dependency (`src/core/pixelDiff.ts`). - **ARIA snapshot assert (M5.4)**: Assert `aria-snapshot` with Playwright-style partial templates. Exports to `toMatchAriaSnapshot`, which passes under real `npx playwright test`. - **Run from here / Re-run failed (M5.5)**. - Engine hooks first (`182cecd`: `runOnce(options)`, `Host.debug`, `Host.trace`) with unit tests, so each feature could be built separately. ### Verification (this machine) - `npm run check`: 1079 unit/DOM tests - `npm run e2e`: 343 checks in 28 specs, Chromium 156 (new `m5-trace`, `m5-debug` incl. the banner and header controls, `m5-visual`, `m5-aria`) - M5 specs in **Brave Origin** (headed) - `npm run e2e:firefox`: 52 checks, Firefox 159, now with visual comparison, trace, a debug pause and ARIA snapshot - `npm run build`, `npm run build:firefox` ### Not done / not verified - Debug and trace options are not exposed over the bridge (MCP/CLI) yet. - A failed visual step carries no comparison id. The Reports panel finds the comparison by node and time window instead. - Google Chrome (not installed here), Edge, macOS and Windows not run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
StepSettings pause/trace, RunOptions (trace, debug.pauseOnError, startAt), RunRecord.mode,
StepRecord.trace (StepTrace), Host.debug and Host.trace (optional, no-ops when absent),
bf:run-workflow carries options. Engine tests in tests/core/engineM5.test.ts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On the engine hooks of 182cecd (runOnce(options), Host.debug, Host.trace, StepSettings.pause/trace).

- Trace (M5.1): src/browser/trace.ts, page ops box/highlight, before/after pictures with the element box,
  URL and network summary (only when CDP is already on), bounded storage (~t| keys, oldest runs evicted),
  filmstrip and per-step trace in Reports and the HTML export. Open Tab steps traced on their new tab;
  templated locators rendered for the box.
- Debug (M5.2): src/browser/debugChannel.ts (pause in storage.session, survives editor reopen, keep-alive,
  1 h cap, element highlighted), DebugBanner (Continue / Step / Stop), RunControls (Run, Run with trace,
  Debug, pause on error), "Pause here" / "Trace this step" toggles.
- Visual (M5.3): src/core/pixelDiff.ts (no dependency), Screenshot compare/threshold/maxDiffRatio/mask/
  updateBaseline, src/browser/visual.ts (IndexedDB baselines, createImageBitmap + OffscreenCanvas),
  visual.mismatch, VisualComparePanel with Accept, toHaveScreenshot export, baselines deleted with workflows.
- ARIA (M5.4): src/core/ariaSnapshot.ts, Assert aria-snapshot, toMatchAriaSnapshot export.
- Run from here and suites "Re-run failed" (M5.5).
- Firefox e2e covers visual, trace, a debug pause and ARIA (e2e-only session read through the background:
  Firefox content scripts cannot read storage.session).
- Docs: lesson 07 section + glossary, guide sections, wiki updates, status, version 0.6.0.

Verified: npm run check (1079 tests); npm run e2e (343 checks, 28 specs, Chromium 156); M5 specs in Brave
Origin (headed); npm run e2e:firefox (52 checks, Firefox 159); build and build:firefox.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
akib merged commit 20a603701a into main 2026-11-10 11:41:07 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
akib/blockflow!8
No description provided.