Repository navigation
fix(diff): compare a bare diff snapshot against the last snapshot - #2544
Open
cavalcanticampos wants to merge 1 commit into
Open
cavalcanticampos wants to merge 1 commit into
cavalcanticampos wants to merge 1 commit into
Conversation
`diff snapshot` without `--baseline` is documented to compare against the last snapshot taken in the session, but the daemon used an empty baseline, so every line of an unchanged page came back as an addition. The daemon now keeps the text of the last snapshot per tab (bounded to 32 tabs, like the delta snapshot revisions) and uses it as the implicit baseline. A diff snapshot's own capture becomes the next baseline, so repeated diffs report what changed since the previous one. Fixes vercel-labs#1755 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
@cavalcanticampos is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1755.
What changes for users
agent-browser diff snapshotwithout--baselinenow does what the help text, the docs and the MCP tool description already say: it compares the current page against the last snapshot taken on the tab. On an unchanged page it reports no changes instead of every line as an addition.agent-browser open file:///.../snapshot_diff_probe.html agent-browser snapshot agent-browser diff snapshot # before: 6 additions; now: no changesThis takes option 1 from the issue (the docs describe the intent), since the help text,
README.md,docs/content/docs/diffing.mdxand the MCP description all promise it.How it works
DaemonStatekeepslast_snapshot_text, the text of the last snapshot per page session. It is bounded to 32 entries, likesnapshot_revisions.snapshotrecords its tree there, for both full and delta responses.diff snapshotwith no--baselinereads it as the baseline, and after a successful diff stores its own capture, so repeated diffs report what changed since the previous one. A failed diff (for example an unmatched--selector) changes nothing, as with the ref map today.--baseline <file>is unchanged.The help text and
diffing.mdxnow say "on the current tab" and mention that a diff counts as a snapshot.Verification
On Linux (WSL2), rustc 1.99:
cargo fmt -- --check,cargo clippy -- -D warnings: clean.cargo test: 2051 passed, 204 ignored. Two new unit tests cover per-tab replacement and the 32-entry bound.e2e_diff_snapshot_without_baseline_uses_last_snapshot(headless Chrome, thesnapshot_diff_probefixture):snapshot, then a barediff snapshotreports no change; after editing the button text, it reports exactly 1 addition and 1 removal; a third bare diff reports no change.cargo test e2e_diff -- --ignored --test-threads=1: all 3 diff e2e tests pass.main'sactions.rsfails with the bug from the issue (@@ -0,0 +1,6 @@, the whole page as additions).Not run: the docs site suite (
pnpm --filter docs ...). The docs change is one sentence indiffing.mdx.Related: #1647 asks for
-i/--interactiveondiff snapshot. With this change that matters more, since asnapshot -ifollowed by a barediff snapshotcompares an interactive tree with a full one. I opened that as a separate PR to keep this one focused.🤖 Generated with Claude Code