Skip to content

fix(looks-same): expose native diff percentage - #354

Open
Octember wants to merge 7 commits into
Visual-Regression-Tracker:masterfrom
Octember:fix/looks-same-native-percentage
Open

fix(looks-same): expose native diff percentage#354
Octember wants to merge 7 commits into
Visual-Regression-Tracker:masterfrom
Octember:fix/looks-same-native-percentage

Conversation

@Octember

@Octember Octember commented Jul 26, 2026

Copy link
Copy Markdown

Summary

  • preserve the existing lightweight Looks-Same boolean comparison path
  • when VRT already requests a saved diff, use Looks-Same native createDiffImage output
  • persist differentPixels / totalPixels as diffPercent alongside that artifact

Why

Looks-Same already calculates differentPixels and totalPixels while producing a diff image. VRT currently discards those metrics, so unresolved comparisons display Diff: 0%. The metrics stay strictly in the existing saveDiffAsFile path: ordinary comparisons do not allocate a diff image or change behavior.

Verification

  • real Looks-Same diff test asserts image artifact, mismatch count, and 50% result
  • npm test -- --runInBand src/compare/libs/looks-same/looks-same.service.spec.ts
  • npm run build
  • focused ESLint and Prettier checks

Summary by CodeRabbit

  • Bug Fixes
    • Diff results now include the diff name, percentage difference, and mismatched pixel count.
    • Diff images are saved consistently when requested.
    • Comparing identical images now reports an explicit error instead of silently omitting the diff.

@pashidlos pashidlos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bugbot found 1 issue on PR #354 (Bugbot).

Severity Location (file:line) Finding
high src/compare/libs/looks-same/looks-same.service.ts:87 createDiff no longer swallows looksSame errors and throws on equal: true. calculateDiff deletes the old diff file before getDiff, so a throw skips saveDiffResult and can leave a stale diffName pointing at a removed file.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ebd33a7e-06d2-4671-9146-76be2f9c3584

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

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