M0: stabilise and test (v0.2.0) #3

Merged
akib merged 25 commits from akib/m0-stabilise into main 2026-11-05 17:31:06 +00:00 AGit
Owner

Summary

Milestone M0: Stabilise and test from docs/IMPLEMENTATION.md, released as v0.2.0. Every P0/P1/P2 bug in docs/PLAN.md §6 is fixed, plus three more found while testing.

Engine and blocks

  • Import, Duplicate and templates keep step settings and connection ports. Import now refuses connections to missing blocks and duplicate block ids.
  • Timed-out steps are fenced off: they can't emit more data, overlap their retry, or add steps to a finished run. Blocks get ctx.aborted().
  • Start runs only from ▶ Run or a Run Workflow call.
  • Switching on vs editing:
    • Plain start blocks run once when a workflow is switched on, not on every edit or browser start.
    • Edits restart a workflow only when its start blocks change.
  • Long runs keep the worker awake, so Manual Step and slow pages are no longer interrupted.
  • Timer delays of up to 600 s wait inside the run, and Stop works mid-wait.
  • HTTP Request's "stop on HTTP errors" now fails the step, so retries and the error output apply.
  • Expressions use the engine's clock, and Filter's {{…}} fields are marked templated.

Pages, picker and recorder

  • Real input inside iframes: clicks and typing through the debugger now land in the right place, same-origin and cross-origin.
  • Picker and recorder work inside iframes and open shadow roots, and the recorder follows popup tabs.
  • Recording into an existing workflow connects to it instead of adding a second chain. Each password field gets its own secret name.
  • Navigate back/forward work in Chromium after a goto; they fall back to the page's history.back()/forward().
  • aria.ts: an unlabelled <section> no longer crashes role lookups with a stack overflow.

Editor

  • Several editor tabs merge each other's saves instead of overwriting them.
  • In-editor toasts and dialogs replace alert/confirm/prompt.
  • Undo history is kept per workflow, and paste lands at the mouse.
  • "Use real mouse and keyboard" appears only on blocks that use it.
  • Runs and Reports show correct trigger and status labels.
  • A first-run "Try it" card works with the npm run playground test page.

Playwright export

  • Exported specs embed BlockFlow's own expression, CSV and template code, so they behave like the extension.
  • Waits for responses, asserts that retry, dialogs, uploads, popups, Run Script and delays are all exported.
  • Step retries, timeouts and error branches carry over.

Tests and CI

  • The e2e runner is split into specs (npm run e2e -- <spec>). New specs cover the blocks that had no browser test, frames and recording, editor UX, and Playwright export.
  • Firefox e2e (npm run e2e:firefox) drives Firefox over WebDriver BiDi. It uses a bridge content script that only e2e builds register.
  • CI gets jobs for Chromium e2e and Firefox e2e, plus a coverage report.

Test plan

  • npm run check: typecheck, 395 unit/DOM tests, learning examples, block guide, wiki links
  • npm run build and npm run build:firefox
  • npm run e2e in Brave Origin: 10 specs, 122 checks, all passing
  • npm run e2e:firefox: Firefox 159, 14 checks, all passing
  • The CI e2e jobs run on GitHub after the mirror receives main

🤖 Generated with Claude Code

## Summary Milestone **M0: Stabilise and test** from `docs/IMPLEMENTATION.md`, released as **v0.2.0**. Every P0/P1/P2 bug in `docs/PLAN.md` §6 is fixed, plus three more found while testing. ### Engine and blocks - **Import, Duplicate and templates** keep step settings and connection ports. Import now refuses connections to missing blocks and duplicate block ids. - **Timed-out steps** are fenced off: they can't emit more data, overlap their retry, or add steps to a finished run. Blocks get `ctx.aborted()`. - **Start** runs only from ▶ Run or a Run Workflow call. - **Switching on vs editing:** - Plain start blocks run once when a workflow is switched on, not on every edit or browser start. - Edits restart a workflow only when its start blocks change. - **Long runs** keep the worker awake, so Manual Step and slow pages are no longer interrupted. - **Timer delays** of up to 600 s wait inside the run, and Stop works mid-wait. - **HTTP Request**'s "stop on HTTP errors" now fails the step, so retries and the error output apply. - Expressions use the engine's clock, and Filter's `{{…}}` fields are marked templated. ### Pages, picker and recorder - **Real input inside iframes:** clicks and typing through the debugger now land in the right place, same-origin and cross-origin. - **Picker and recorder** work inside iframes and open shadow roots, and the recorder follows popup tabs. - **Recording into an existing workflow** connects to it instead of adding a second chain. Each password field gets its own secret name. - **Navigate back/forward** work in Chromium after a goto; they fall back to the page's `history.back()/forward()`. - **`aria.ts`:** an unlabelled `<section>` no longer crashes role lookups with a stack overflow. ### Editor - Several editor tabs merge each other's saves instead of overwriting them. - In-editor toasts and dialogs replace `alert`/`confirm`/`prompt`. - Undo history is kept per workflow, and paste lands at the mouse. - "Use real mouse and keyboard" appears only on blocks that use it. - Runs and Reports show correct trigger and status labels. - A first-run "Try it" card works with the `npm run playground` test page. ### Playwright export - Exported specs embed BlockFlow's own expression, CSV and template code, so they behave like the extension. - Waits for responses, asserts that retry, dialogs, uploads, popups, Run Script and delays are all exported. - Step retries, timeouts and error branches carry over. ### Tests and CI - The e2e runner is split into specs (`npm run e2e -- <spec>`). New specs cover the blocks that had no browser test, frames and recording, editor UX, and Playwright export. - **Firefox e2e** (`npm run e2e:firefox`) drives Firefox over WebDriver BiDi. It uses a bridge content script that only e2e builds register. - CI gets jobs for Chromium e2e and Firefox e2e, plus a coverage report. ## Test plan - [x] `npm run check`: typecheck, 395 unit/DOM tests, learning examples, block guide, wiki links - [x] `npm run build` and `npm run build:firefox` - [x] `npm run e2e` in Brave Origin: 10 specs, 122 checks, all passing - [x] `npm run e2e:firefox`: Firefox 159, 14 checks, all passing - [x] The CI e2e jobs run on GitHub after the mirror receives `main` 🤖 Generated with [Claude Code](https://claude.com/claude-code)
akib added 25 commits 2026-11-05 17:30:10 +00:00
- Import, Duplicate and templates keep step settings and edge ports;
  import refuses edges to missing blocks and duplicate block ids.
- A timed-out step is fenced off: no more outputs, no overlap with its
  retry, nothing added to a finished run. Blocks get ctx.aborted().
- Start runs only by hand or when called. Plain start blocks run once
  when a workflow is switched on, not on edits or browser start; edits
  restart a workflow only when its start blocks change.
- Live runs keep the worker awake (HybridScheduler.hold/release).
- Timer delays up to 600 s wait inside the run (Stop works mid-wait);
  longer delays still continue as a new run, also on a workflow that is off.
- HTTP Request failOnError fails the step (retries, error output apply).
- Samples no longer use Open Tab's old newTab key.
- Watch tabs live in storage.session; a cancelled pick resets the editor;
  editor tabs merge each other's saves instead of overwriting them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/IMPLEMENTATION.md: per milestone, each task with files, design,
tests and size; M0 progress, block coverage gaps, Firefox verification,
the bridge/MCP/CLI architecture, and a tracking table. Linked from
PLAN.md, README, the Roadmap page and the wiki sidebar.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- tests/e2e/harness.mjs launches the browser and holds the helpers;
  tests/e2e/specs/*.mjs hold the scenarios; `npm run e2e -- <spec>`
  runs a subset, `npm run e2e:run` skips the build.
- Editor sync compares workflows by canonical JSON: storage does not
  keep key order, so a plain JSON compare saw every save as a change
  from another tab and reloaded the canvas, wiping undo history.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- tests/e2e/firefox.mjs (npm run e2e:firefox) installs the e2e build as
  a temporary add-on in Firefox via BiDi webExtension.install and runs
  14 checks through the real background script.
- Firefox BiDi cannot open moz-extension:// pages, so e2e builds register
  a bridge content script on the local fixture origin
  (src/entrypoints/e2e-bridge.content.ts); regular builds never register it.
- import.meta.env.BF_E2E is defined for test-only hooks.
- README, Installing and Capabilities record the Firefox results.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- now()/today() read the clock from the evaluation context; the engine and the
  data blocks pass Host.now (EvalEnv), so FakeHost's fixed clock applies
- Filter's left/right are templated + perItem: the editor offers and checks
  {{...}}, the engine leaves them for the block's per-item rendering
- deleting a workflow removes its timers and bf:state:<id>::* keys
  (diffWorkflows reports `removed`)
- trigger labels (page event, called by another workflow), Reports filter
  gets Interrupted and Running
- stale texts: file input in Fill Form points at Upload File; role option hint
  lists include-hidden
- block reference anchors follow github-slugger (leading dash, U+FE0F kept);
  wiki.mjs slug keeps marks too
- drop the unused activeTab permission, clearScreenshots and clearRecording
- blocks declare `realInput: true` when their page actions honour the step
  setting (used by the editor in the next commit)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- toast / confirm dialog / input dialog (components/Dialogs.tsx) replace every
  window.alert/confirm/prompt in the editor, including the recorder's start URL
- undo/redo history kept per workflow id across switches
- paste puts the blocks at the mouse on the canvas (offset when the mouse is
  outside or has not moved; Ctrl+D keeps the offset)
- "Use real mouse and keyboard" only on blocks that declare realInput
- All workflows: the switch is disabled with a tooltip while a workflow has
  problems; "Turn all on" names the skipped ones in one message; "Last
  activity" comes from run records (bf:runs), with the run's status

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Unit (tests/core/moreBlocks.test.ts): Scroll (top/bottom/element, until the end,
maxScrolls), Page Info (page/local/session/cookies), Context Menu (config to menu
item, id parsing, click payload, a click starting the flow), Page Visited, Navigate
back/forward/reload, Press Key, Stop, Notify, Repeat.

e2e (tests/e2e/specs/blocks-coverage.mjs): Start, Timer (delay, Stop during a
delay, repeating trigger), Schedule alarm, Context Menu, Watch Element, Navigate,
Press Key, Page Info, Stop, Repeat/Filter, Notify. New fixtures meta.html,
keys.html, ticker.html.

The context menu item/payload mapping moves from background.ts into pure helpers
in src/core/blocks/contextMenu.ts so it can be unit-tested. BF_E2E builds define
import.meta.env.BF_E2E and accept a bf:e2e-menu-click message (compiled out of
other builds) because an automated browser cannot open the right-click menu.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- ci.yml: new e2e job (Playwright's Chromium, BF_HEADLESS=1 under xvfb-run);
  the check job runs npm run test:coverage and uploads coverage/ as an artifact.
- npm run test:coverage with @vitest/coverage-v8 3.2.7 (matches vitest 3.2.7).
- Wiki Testing and Tooling pages: spec layout, running one spec, the BF_E2E hook,
  the blocks-coverage scenarios and fixtures, CI jobs. IMPLEMENTATION M0.3 marked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	wxt.config.ts
- Chromium's tabs.goBack/goForward skip history entries added without
  a user gesture, so Back after Open Tab + goto failed ("Cannot find a
  next page in history"). Fall back to history.back()/forward() in the
  page. The blocks-coverage spec now checks back/forward normally.
- The bridge registration uses the boolean import.meta.env.BF_E2E.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Inline BlockFlow's runtime (the real source of expression, condition, csv,
  urlPattern and template, read with ?raw and wrapped per module) so templates
  ({{$json.x}}, dashed keys, expressions, secrets) and the data blocks
  (Data Table with real CSV, Transform, Filter, Set Variable, For Each, Repeat,
  If) behave exactly as in the extension.
- Wait For response -> waitForResponse helper (10 s look-back, BlockFlow URL
  patterns, status 2xx/201/list).
- Assert: web-first matchers (toHaveText/Value/Attribute/Count, page
  toHaveURL/toHaveTitle, not./regex forms), expect.poll + compare for the other
  operators, expect.soft / soft poll.
- Step settings: timeoutSeconds -> { timeout }, retries -> retry(), onError
  continue/port -> try/catch (error branch only on failure), disabled skipped.
- Open Tab where current/workflow reuses page; Timer delay -> waitForTimeout;
  Dialogs, Upload File (Buffer / request.get), Wait for Popup, Run Script
  (page.evaluate with data) mapped; the rest is a // BlockFlow-only: comment.
- New e2e spec playwright-export: three richer workflows run in BlockFlow, are
  exported from the editor and pass under npx playwright test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
- docs/manual-test/playground.html: things to watch, click and fill;
  `npm run playground` serves docs/manual-test at http://localhost:7357
  (scripts/playground.mjs). Not an extension page: Chromium refuses to script
  chrome-extension:// pages, the extension's own included (checked in
  Chromium 131: "Cannot access contents of url chrome-extension://...")
- "Try it" card on the canvas: shows whether the playground is up, creates the
  playground-tour template (also in + New), dismissal kept in bf:onboarding
- tests/e2e/specs/editor-ux.mjs: dialogs and toasts, state cleanup on delete,
  real-input setting, undo per workflow, paste at the mouse, Try it card + the
  template passing against the playground; authoring.mjs answers the recorder's
  in-editor dialog; the harness starts with the card dismissed

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The agent's locate now adds the offsets of same-origin frames (box, border,
padding) and answers a cross-origin hand-over with where that frame starts;
the driver adds those offsets up, so debugger clicks and typing hit the
element inside frames. resolveLocator searches every same-origin frame a
frame= step matches and only hands over to a cross-origin one when nothing
is found. readSelectorInPage (test-only) is gone; its coverage moved to the
agent's read tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Picker and recorder use composedPath()[0], so elements in open shadow
  roots are picked/recorded themselves; generateSelector writes host >>> css.
- Both are injected into every frame. Only the top frame has a toolbar; the
  frames sync through bf:picker-sync / bf:recorder-sync relayed by the
  background, and work out their frame=<iframe css> prefix (frameElement for
  same-origin parents, a postMessage question for cross-origin ones).
- The recorder follows tabs the page opens: a Wait for Popup step, then
  tab "popup" on the steps there.
- Recording into a non-empty workflow continues after the selected block
  (or the end of the main path), to its right and connected, without a
  second Open Tab for a site the workflow already opens.
- One secret per password field, named from its label/name, deduplicated.
- Picker hint fits the mode (watch / action / form); picking uses the
  nearest upstream Open Tab's URL and reuses one picker tab per editor.
- clearRecording (unused) removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Editor behaviour (dialogs and toasts, per-workflow undo, paste at the mouse,
real-input setting, switch on All workflows, Try it card), the playground and
`npm run playground`, state cleanup on delete, EvalEnv, dropped activeTab and
helpers, the editor-ux e2e spec; lesson 03 notes that extension pages cannot
be scripted (why the playground is served over http).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
getRole(section) asks for its accessible name (a section is a region only when
named), and accessibleName asked getRole again. Regions never take their name
from content, so accessibleName skips the role lookup for a section without a
role attribute.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	docs/IMPLEMENTATION.md
#	docs/wiki/Testing.md
#	package.json
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Usage guide (§10, §12, §17), wiki pages (Picker and Recorder, Locators, Page
Agent, Page Protocol, Browser Host, Background Worker, Message Protocol,
Storage Keys, Editor Components, Capabilities, Troubleshooting), lesson 7
pointer, and the M0.2 rows in IMPLEMENTATION.md. Editor: keep the original
secrets alert line (merges with the toast change on m0-stabilise).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	docs/IMPLEMENTATION.md
#	docs/wiki/Browser-Host.md
#	docs/wiki/Storage-Keys.md
#	src/browser/recording.ts
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
akib merged commit 955ac26d54 into main 2026-11-05 17:31:06 +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!3
No description provided.