Repository navigation
fix(client): accept diffSensitivity 0-4 (Very Strict) in PERCY_VISUAL_CONFIG - #2453
Conversation
The API passes visual-config.diffSensitivity straight through as the 0-indexed fuzz level (0 = Very Strict, matching the project enum and the snapshot diffSensitivity schema). The 1..5 range made Very Strict unreachable and silently turned "1" into Strict. Fixes PER-10796 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 7 remain after this review. 📜 Recent review details⏰ Context from checks skipped due to timeout. (7)
🧰 Additional context used📚 Code guidelines (8)📓 Path-based instructions (8)Source excerpt: **`PERCY_TOKEN`** — read only from env vars or explicit flags; never log it, never write it to `package.json`, `.percy.yml`, or any committed file.📄 CodeRabbit inference engine (percy/browserstack-ai-harness-percy:stacks/stack-domain-percy-cli/rules/security.md) Files:
Source excerpt: Read `../rules/security.md` first.📄 CodeRabbit inference engine (percy/browserstack-ai-harness-percy:stacks/stack-domain-percy-cli/knowledge/DEPENDENCIES.md) Files:
Source excerpt: GraalJS scripts must not use Node globals.📄 CodeRabbit inference engine (percy/browserstack-ai-harness-percy:stacks/stack-domain-percy-app-sdk/agents/stack-percy-app-sdk-code-reviewer.md) Files:
Source excerpt: Match the dominant style for the area you're touching.📄 CodeRabbit inference engine (percy/browserstack-ai-harness-percy:stacks/stack-domain-percy-cli/rules/commit-conventions.md) Files:
Source excerpt: Known user-facing errors, their meaning, and remediation.📄 CodeRabbit inference engine (percy/browserstack-ai-harness-percy:stacks/stack-domain-percy-cli/knowledge/ERROR-CATALOG.md) Files:
Source excerpt: | Symptom | Cause | |---|---| | Tests pass but exit hangs | Asset discovery did not finish; raise `discovery.networkIdleTimeout` in `.percy.yml`.📄 CodeRabbit inference engine (percy/browserstack-ai-harness-percy:stacks/stack-domain-percy-web-sdks/knowledge/flow-percy-exec-lifecycle.md) Files:
Source excerpt: Healthcheck (same as web SDKs).📄 CodeRabbit inference engine (percy/browserstack-ai-harness-percy:stacks/stack-domain-percy-web-sdks/knowledge/flow-snapshot-appium.md) Files:
Source excerpt: Add an entry to this file.📄 CodeRabbit inference engine (percy/browserstack-ai-harness-percy:stacks/stack-domain-percy-web-sdks/knowledge/FEATURE-FLAGS.md) Files:
🔇 Additional comments (1)
📝 WalkthroughWalkthroughThe client rejected ChangesdiffSensitivity validation
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~5 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The client now accepts 0 and caps the setting at 4, matching the shared schema. No actionable supported-path risk is established, so the change appears ready for normal checks. 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
Comment ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
|
Match Project.diff_sensitivity_level and the snapshot diffSensitivity schema. Index 5 in the differ is an internal app-percy value with the same threshold (60) as 4. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Fixes PER-10796
Root cause
packages/client/src/client.js:137validatesPERCY_VISUAL_CONFIG.diffSensitivityas an integer 1–5. The API does not remap it:Build#settings(percy-apiapp/models/percy/build.rb:531) passes it through untouched, andCompareJobService.fetch_fuzz_factor(lib/percy/compare_job_service.rb:510-511) returns it as the fuzz level, overriding the project setting. That index is 0-based, the same scale asProject.diff_sensitivity_level(very_strict: 0 … very_relaxed: 4) and the snapshotdiffSensitivityschema inpackages/core/src/config.js:70(0–4).So:
'diffSensitivity' must be an integer between 1 and 5, so Percy is disabled for the run.1is quietly Strict, not "most strict". It also overrides a project that is already set to Very Strict. In PER-10796, build 54272606 (project 465815, project level = 0) carriedvisual_config {"diffSensitivity": 1}, compared at Strict, and missed a#FDDFC3 → #FCEAC0toggle change (max per-channel delta 11, which is under Strict's threshold of 15).Fix
Lower bound 1 → 0. I kept the upper bound at 5 so nobody who passes 5 today gets a failing build. Fuzz index 5 is valid in the differ; it's what the app-percy iPhone path uses.
Testing
diffSensitivity: 0is accepted and forwarded asvisual-config.-1is rejected.🤖 Generated with Claude Code
Summary by CodeRabbit
diffSensitivity: integer values from 0 through 4 are accepted, including 0, and values outside that range or non-integer values are rejected. The setting uses a zero-indexed scale, where 0 is Very Strict and 4 is Very Relaxed.