Repository navigation
Flows: compare two runs of a flows file checkpoint by checkpoint (compare:flows) - #78
Draft
brentvatne wants to merge 1 commit into
Draft
brentvatne wants to merge 1 commit into
brentvatne wants to merge 1 commit into
Conversation
…pare:flows) compare:flows --before DIR --after DIR [--output FILE] pairs the checkpoints of two runs by flow and checkpoint name and diffs each pair with the review's screenshot diff, setting aside the status bar and home indicator as a review does. Each checkpoint is unchanged, changed (with the regions that differ), missing (no picture on one side, with why), different-size (another device or orientation, so not diffed), added or removed. The runs' conditions that differ (app, platform, device, OS version, locale, orientation, appearance) are listed rather than refused, so an iPhone run and an Android run still line up. On a foldable the status bar is not set aside, because a run does not record which panel was in use; the result says so. The pairing is a pure function in contracts/flow-comparison.ts; the diff is in review/flow-comparison.ts. cli now imports review, which ARCHITECTURE lists.
|
Viewer preview of d6b9733 · reports from brentvatne/euxy#163
The link stays the same on every push. Deploy run |
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.
What and why
A flows run records named checkpoints so that two runs line up step by step (#74), but nothing paired them. This adds the comparison:
src/contracts/flow-comparison.ts, a pure function).src/review/flow-comparison.ts).unchanged;changed, with the regions that differ;missing, with why one side has no picture;different-size, for another device or orientation, so it isn't diffed;addedorremoved, when only one run's flows file has it.clinow importsreview. That points down a layer, as the dependency rule allows, and ARCHITECTURE lists it.The output is JSON for now. A step-by-step view in the Viewer is a separate step.
Screenshots
Live demo on euxy: https://explore-flows-compare.expo.app
The same flows file was run on two euxy builds, then compared:
main(07d5aab). Full reportResults:
changed, 0.21% of pixels. One region (x 8–35%, y 62–64%), exactly the "Latency offset" → "Output latency" label.unchanged. Onmain, the Settings screenshot shows the Dynamic Island in the status bar and the other doesn't; that difference is set aside.unchangedis correct there.The demo page is a one-off static page made from the JSON. It is not part of this PR.
Code examples
{ "flow": "Settings", "checkpoint": "Settings", "before": { "observationId": "obs_…", "screenshot": "assets/….png" }, "after": { "observationId": "obs_…", "screenshot": "assets/….png" }, "verdict": "changed", "mismatchPercentage": 0.21, "regions": [{ "x": 8.21, "y": 62.01, "width": 26.37, "height": 1.83 }] }Try it
Testing
test/node/flow-comparison.test.mjs(6 tests):unchanged;changed, with the region where it was painted;npm testpasses (1740 tests),tscis clean, and lint shows only the 6 existing Viewer warnings.🤖 Generated with Claude Code