Skip to content

feat: accept declarative VRT matching options - #41

Merged
longlho merged 1 commit into
mainfrom
codex/declarative-vrt-matching
Sep 17, 2026
Merged

longlho merged 1 commit into
mainfrom
codex/declarative-vrt-matching

Conversation

@longlho

@longlho longlho commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Consumers currently need a compiled JavaScript policy module even when comparison tolerances are fixed per Bazel target. Component and page suites can end up maintaining separate adapters just to supply the same screenshot matching options.

Allow both component_visual_test and visual_test to accept:

matching = {"threshold": "0.1", "maxDiffPixelRatio": "0.01"}

The rule generates an ESM policy in declared runfiles and uses the existing comparison validator. Values are JSON numeric strings because Starlark has no floats; they are parsed, never evaluated as code. This requires no ambient environment reads or consumer compilation target. Existing compiled-module labels remain supported, and defaults are unchanged.

Updated the documentation and React examples. Bazel tests pass for generated policies, numeric validation, compiled policies, and suite configuration (matching_config_test, built_inputs_test, config_test). Both public macros' generated policy targets build, and their input descriptors analyze. Full browser execution was not run; the React example requires a separately supplied runtime.tar.

@longlho
longlho marked this pull request as ready for review September 17, 2026 14:48
@longlho
longlho merged commit 2051c78 into main Sep 17, 2026
13 checks passed
@longlho
longlho deleted the codex/declarative-vrt-matching branch September 17, 2026 14:48
longlho pushed a commit that referenced this pull request Sep 18, 2026
🤖 I have created a release *beep* *boop*
---


## 3.3.0 (2026-09-17)

## What's Changed
* feat: accept declarative VRT matching options by @longlho in
#41


**Full Changelog**:
v3.2.0...v3.3.0

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

1 participant