Skip to content

Add optional Playwright trace review and comments - #1850

Merged
max-sixty merged 8 commits into
mainfrom
codex/browser-recording
Oct 6, 2026
Merged

max-sixty merged 8 commits into
mainfrom
codex/browser-recording

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Browser recordings can now be reviewed and commented on through an optional Leaf package. Playwright owns recording and the original trace archive; Leaf imports native action checkpoints, PNG screenshots, filmstrip frames and saved accessibility elements into one timeline. Following a comment restores the recorded moment, and the full Playwright viewer remains linked beside the controls.

This PR ships the optional Leaf timeline for a trial alongside Playwright recording and its native viewer. Max requested that provisional integration be merged and recorded that he is not sure it is great. Permanent retention remains undecided; TODO.md makes further DOM selection work conditional on keeping the integration.

  • Add the playwright package, a trace-format-9 importer, a review widget and a worked example. Direct selection of arbitrary DOM elements and passages remains in Playwright's viewer.
  • Capture declared local media with data readings and embed those bytes in offline exports. Stable image comments use content-addressed media IDs. Include resource selectors in the page-lifetime contract to prevent a layer revision from silently discarding that media.
  • Expose optional native checkpoint screenshots in the existing browser recorder. Keep normal motion recording unchanged by default.
  • Pin reviewed thread screenshots independently from published example media, so publishing a recording cannot replace a runtime's approved image expectations.
  • Keep timeline controls, evidence origin and display width stationary when moving between checkpoints and intermediate frames. Anchor image ink to the raster itself so drawings remain aligned after resizing. Use Leaf's command declarations for pointer and keyboard navigation; cover one-step activation, comments and frame-toggle scroll behavior in browser regressions.

Validation: browser/import/recording tests, mouse/Enter/Space navigation, and real desktop and phone journeys with 40 timeline stops: image origin, width and controls remain fixed, with at most 1.1 px image-height variation from native JPEG rounding. Image ink stays aligned after desktop-to-phone resizing. Formatting, JavaScript, TypeScript and bundle gates pass after integrating main. The full Python gate passed 2,344 tests; the importer/deadline repair then passed all 185 focused checks. After integrating the latest main, all 48 macOS image checkpoints pass at the existing strict tolerance, and both trace browser regressions pass (12 tests passed, one Linux-only test skipped). Resource-lifetime regressions and the 102-page website build also pass. CI validates the pushed head.

This was written by Codex on behalf of max-sixty

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new resources selector affects which media bytes a source preserves, but the page-lifetime contract comparison still compares only schema and records. With a bound source, changing its selector from images[].url to other[].url under the same contract returns no transition error. That lets a re-vendored page keep the same source id while its previously declared images stop being captured in snapshots and exports. Include resources in that comparison so a change in media meaning requires a new source id.

The PR description and TODO.md also leave the choice between Leaf's timeline and Playwright's viewer unresolved. I’m withholding approval until that design decision is made.

leaf-agent
leaf-agent previously approved these changes Oct 6, 2026
@max-sixty
max-sixty merged commit 152bd89 into main Oct 6, 2026
4 checks passed
@max-sixty
max-sixty deleted the codex/browser-recording branch October 6, 2026 01:07
max-sixty added a commit that referenced this pull request Oct 6, 2026
A publication to `max-sixty/leaf-assets` cloned the repository's head
and set a directory to exactly the files that run produced. If another
branch had published a file into that directory since this branch's pin,
the file was on the head but missing from this run, so the publication
deleted it. While #1793 was in review, another session's thread-image
publication removed its new `inline-dark` images this way.

- **`clone`** now checks out the revision `leaf-assets.json` pins. A
stage's additions, replacements and removals are therefore measured
against the set this branch reads.
- **`publish`** commits that change, records it at
`refs/leaf-assets/change` in the checkout, and `replay`s its file list
onto the current head:
  - each file the change added or altered takes the change's copy;
- each file it removed is removed, whatever the head did to that file
meanwhile;
  - files other branches published since the pin survive.
- **Retries.** A refused push replays onto the new head and tries again,
up to three times. A later `publish` call on the same checkout replays
the kept change onto the head as it then stands.
- **Catalog links** derive from the commit each attempt pushes. An
unchanged checkout keeps its pin rather than moving to the head.
- **Thread-snapshot acceptance** (`thread_snapshots_revision`, from
#1850) still installs its whole expectation tree exactly as staged.
`clone` and `stage` return a `Checkout` (its path, the pin key it was
cloned from, and with `replace_tree=True` the directory it owns), and
`publish` takes that value. `replay` installs an owned tree whole from
the change, so head files outside the tree survive. The pin a checkout
publishes is the one it was cloned from: `stage`/`clone` take
`revision_key`, and `publish` no longer does.
- **`AGENTS.md`**:
- a conflict on the media `revision` takes the later pin, which now
holds both branches' files;
- a file both branches published is published again from the merged
tree;
- a conflict on `thread_snapshots_revision` is accepted again from the
merged tree.

## Validation

`test_a_publication_keeps_what_others_published_since_its_pin` is new.

- **Two branches share one pin.** Between them they add, rewrite and
remove files, and touch the same files in each direction:
  - both rewrite one file;
  - the first removes a file the second rewrites;
  - the first rewrites a file the second removes.
- **Result.** The head holds the first's addition, the second's
addition, and the second's choice on every shared file.
- **Retry.** A third publication is refused by the remote. Another
publisher then lands, and the third's retry lands on top with both
changes.
- **Against older code.**
  - Pre-PR code: the test fails on the first branch's dropped file.
- This PR's earlier cherry-pick version: it fails on both modify/delete
conflicts.

The existing publication test passes in both variants, including the
refused push and its retry.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants