Conversation
…old, color_distance_limit - Fix incorrect default tolerance value in docs (0.0005 → 0.001 to match code) - Add decision tree for choosing between perceptual_threshold vs color_distance_limit - Clarify tolerance works with both color methods (not exclusive as docs claimed) - Correct color_distance_limit scale from 0-441 to 0-510 (RGBA, not RGB) - Document VIPS vs ChunkyPNG tolerance calculation difference (pixels vs bounding box) - Fix drivers.md tolerance example (0.3 → 0.001) to match recommendations - Add perceptual_threshold to YARD DSL docs (was missing) - Fix copy-paste errors in configuration.md section headings Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Reviewer's GuideDocumentation-only PR that corrects and clarifies how color comparison options ( Flow diagram for choosing color comparison method and toleranceflowchart TD
A(["Start: Configure visual diffs"]) --> B{"Which driver?"}
B -->|"VIPS (ruby-vips)"| C{"Primary goal?"}
B -->|"ChunkyPNG"| H{"Need cross-OS/browser robustness?"}
C -->|"Handle font/anti-aliasing differences"| D["Use perceptual_threshold: 2.0 (recommended)"]
C -->|"Legacy / fine-grained RGB control"| E["Use color_distance_limit (0-510)"]
D --> F{"Need to allow some differing pixels?"}
E --> F
F -->|"Yes"| G["Set tolerance (0.0-1.0), default 0.001 for VIPS"]
F -->|"No"| I["Rely on chosen color method only"]
H -->|"Yes"| J["Prefer VIPS with perceptual_threshold if possible"]
H -->|"No / staying on ChunkyPNG"| K["Use color_distance_limit (0-510)"]
K --> L{"Need to allow some differing regions?"}
L -->|"Yes"| M["Set tolerance (0.0-1.0) — counts diff bounding box area"]
L -->|"No"| N["Rely on color_distance_limit only"]
G --> O(["Done: perceptual_threshold or color_distance_limit + optional tolerance"])
I --> O
J --> C
M --> O
N --> O
Flow diagram for option exclusivity and evaluation orderflowchart TD
A(["Start: Run screenshot comparison"]) --> B["Read configuration: perceptual_threshold, color_distance_limit, tolerance, driver"]
B --> C{"Is perceptual_threshold set?"}
C -->|"Yes"| D["Activate perceptual_threshold (CIE dE00, 0-100+)"]
C -->|"No"| E{"Is color_distance_limit set?"}
E -->|"Yes"| F["Activate color_distance_limit (RGBA Euclidean, 0-510)"]
E -->|"No"| G["Use driver default color method (if any)"]
D --> H
F --> H
G --> H
H["Compute pixel-level differences using active color method"] --> I{"Is tolerance configured?"}
I -->|"VIPS driver"| J["Interpret tolerance as ratio of differing pixels (0.0-1.0)"]
I -->|"ChunkyPNG driver"| K["Interpret tolerance as ratio of diff bounding box area (0.0-1.0)"]
I -->|"No tolerance"| L["Treat any detected difference as failure"]
J --> M{"Difference ratio <= tolerance?"}
K --> M
M -->|"Yes"| N(["Result: Comparison passes (differences within tolerance)"])
M -->|"No"| O(["Result: Comparison fails (differences exceed tolerance)"])
L --> O
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 20 minutes and 28 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In
dsl.rbYARD docs for:color_distance_limitstill describe it as Euclidean RGB with a 0–441 scale, which conflicts with the updated docs specifying RGBA and 0–510; align this description with the new behavior. - The README section labeling
Capybara::Screenshot::Diff.tolerance = 0.0005as "Raw RGB tolerance" is a bit misleading now thattoleranceis documented as a ratio of differing pixels; consider rephrasing to match the terminology and explanation used indocs/configuration.md.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `dsl.rb` YARD docs for `:color_distance_limit` still describe it as Euclidean RGB with a 0–441 scale, which conflicts with the updated docs specifying RGBA and 0–510; align this description with the new behavior.
- The README section labeling `Capybara::Screenshot::Diff.tolerance = 0.0005` as "Raw RGB tolerance" is a bit misleading now that `tolerance` is documented as a ratio of differing pixels; consider rephrasing to match the terminology and explanation used in `docs/configuration.md`.
## Individual Comments
### Comment 1
<location path="docs/configuration.md" line_range="32" />
<code_context>
+| Standard Rails apps | 0.001 (default) | 15 | 1s |
| Pixel-perfect design tests | 0.0001 | 5 | 1s |
+**Note:** VIPS defaults to `tolerance: 0.001` (allow 0.1% pixel difference). ChunkyPNG has no default tolerance.
+
+## Choosing the Right Color Comparison Method
</code_context>
<issue_to_address>
**nitpick (typo):** Consider changing "allow" to "allows" for grammatical agreement.
Because "VIPS defaults to `tolerance: 0.001`" is the subject, the parenthetical should use the third-person form: "(allows 0.1% pixel difference)".
```suggestion
**Note:** VIPS defaults to `tolerance: 0.001` (allows 0.1% pixel difference). ChunkyPNG has no default tolerance.
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Screenshot diffs resolvedAll screenshots match their baselines. Previous diffs have been fixed. |
- Fix dsl.rb YARD: RGB 0-441 → RGBA 0-510 to match updated docs - Fix README: rename "Raw RGB tolerance" to "Tolerance-based comparison" - Fix typo: "allow" → "allows" in configuration.md Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Summary
Fixed 7 documentation consistency issues discovered during analysis of color comparison options.
Changes
Files Changed
Summary by Sourcery
Clarify and correct documentation around visual diff color comparison options and their interactions.
Documentation: