fix(preprod): Use odiff CLI mode to work around server-mode false match bug#112829
Conversation
…ch bug odiff server mode has a stdin buffer reuse bug that causes non-deterministic false match=True results. Switch to CLI mode (one subprocess per comparison) until the upstream fix lands. All server-mode code is commented out for easy revert once dmtrKovalenko/odiff#170 is released in odiff-bin. Also derives changed pixel count from the diff mask histogram instead of parsing odiff stdout, which is more reliable.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d075061. Configure here.
|
|
||
| _CLI_FLAG_MAP = { | ||
| "outputDiffMask": "diff-mask", | ||
| } |
There was a problem hiding this comment.
Incorrect CLI flag name mapping for diff mask
High Severity
The _CLI_FLAG_MAP maps "outputDiffMask" to "diff-mask", producing CLI flag --diff-mask. The actual odiff CLI flag is --output-diff-mask. The standard camelCase-to-kebab-case conversion of outputDiffMask yields output-diff-mask, but the map incorrectly drops the output- prefix. This causes odiff to receive an unrecognized flag, likely making every comparison fail with a RuntimeError (non-zero exit code not in the allowed set {0, 21, 22}).
Reviewed by Cursor Bugbot for commit d075061. Configure here.
There was a problem hiding this comment.
wrong, i intentionally changed this (and verified this is the correct setup)
…ch bug (#112829) Switch snapshot image comparison from odiff server mode to CLI mode (one subprocess per comparison) to work around a non-deterministic false match bug caused by stdin buffer reuse in server mode. The upstream fix is at dmtrKovalenko/odiff#170. All server-mode code is commented out (not deleted) for easy revert once the fix is released in odiff-bin. Also changes pixel counting from parsing odiff stdout (which varied across versions) to counting non-zero pixels from the diff mask via PIL histogram — more reliable and version-independent.
odiff-bin v4.3.8 ships the upstream fix for the server-mode stdin buffer reuse bug (dmtrKovalenko/odiff#170), so we can drop the CLI-mode fallback introduced in #112829 and go back to using server mode. Also: - Pin odiff-bin to exact 4.3.8 (no caret) in package.json and CI - Point _find_odiff_binary() at node_modules/odiff-bin/bin/odiff.exe; v4.3.8's post-install only chmods this path, while raw_binaries/ ship without the execute bit - Extract _fetch_batch_images helper in tasks.py to avoid per-iteration closure rebinding inside the batch loop Co-Authored-By: Claude <noreply@anthropic.com>
) Reverts the odiff CLI-mode workaround (#112829) now that odiff-bin v4.3.8 ships the upstream fix for the server-mode stdin buffer reuse bug ([dmtrKovalenko/odiff#170](dmtrKovalenko/odiff#170)). Snapshot comparison goes back to using server mode — one persistent subprocess per batch instead of spawning one per comparison. ### Dependency pin `odiff-bin` is pinned to exact `4.3.8` (no caret) in `package.json`, `pnpm-lock.yaml`, and the CI workflow. Exact pin keeps dev / prod / CI in lockstep with minimal machinery. ### Bonus fix — binary resolution `_find_odiff_binary()` now points at `node_modules/odiff-bin/bin/odiff.exe` instead of `raw_binaries/odiff-<platform>`. v4.3.8's `post_install.js` only sets the execute bit on `bin/odiff.exe`; the raw binaries ship without `+x`, which was causing `PermissionError` on fresh installs. Despite the `.exe` suffix, this is the package's cross-platform entrypoint on all OSes. ### Minor cleanup Extracted `_fetch_batch_images` helper in `tasks.py` so the per-batch closure / lock / cache setup lives in one place instead of being rebuilt inside every loop iteration. Co-authored-by: Claude <noreply@anthropic.com>


Switch snapshot image comparison from odiff server mode to CLI mode
(one subprocess per comparison) to work around a non-deterministic
false match bug caused by stdin buffer reuse in server mode.
The upstream fix is at dmtrKovalenko/odiff#170.
All server-mode code is commented out (not deleted) for easy revert
once the fix is released in odiff-bin.
Also changes pixel counting from parsing odiff stdout (which varied
across versions) to counting non-zero pixels from the diff mask via
PIL histogram — more reliable and version-independent.