Skip to content

Image ignore regions in visualci.yml (sc-9018); CLI 0.2.22 - #134

Merged
ndbroadbent merged 2 commits into
mainfrom
image-ignore-regions
Dec 3, 2026
Merged

ndbroadbent merged 2 commits into
mainfrom
image-ignore-regions

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Shortcut: sc-9018. Requested by Fleetlayer's iPhone suite: iOS 26's Liquid Glass tab bar lenses a pixel or so differently on each simulator run, so 1 to 4 of 16 shots showed as changed in the bottom ~150 px.

Rebased onto the repo layout change (#137): frontend/ at the top level, app/ in the root workspace.

Config shape

The existing scoped ignore rules gain two image fields, next to json_paths and text_patterns:

ignore:
  - snapshots: "ios/**"
    region: { bottom: 150 }        # top / bottom / left / right bands, in pixels of the image
  - snapshots: "screenshots/app/**"
    rects: [{ x: 0, y: 0, width: 300, height: 40 }]

Invalid ones are refused with a message naming the rule: an empty region, a zero or oversized side, a zero-size rect, unknown fields, and more than 100 areas in all. A rule must still ignore something (text or image).

Where masking happens

  • visualci_core::diff::diff_masked: masked pixels are never counted as changed, so they stay out of the counts, the regions and the fingerprint. The overlay hatches them. DiffResult gains masked (areas in canvas pixels) and masked_pixels (the differing pixels the mask hid).
  • app/: BuildSettings::image_mask collects the areas from the build's own rules (its builds.config file, else the project's), the same model as text rules, so a past build is compared and shown with its own settings. diffs::find_or_compute resolves the areas against the canvas, and the mask's hash goes into the diff cache key. A page that differs only inside the mask is the new page state masked (migration), and its snapshot is unchanged. A new mask counts as hiding more, so it brings the visualci.yml review item.
  • MCP get_snapshot gives each page's masked and masked_pixels next to regions. The download manifest has masked. The review UI hatches the areas over the base, head, diff and slider views, shows a "masked" pill and the masked pixel count. The PR comment shows the raw images, so it says how many areas were masked instead of hatching them.

Not done: a ±1 px shift tolerance.

Tests (build box, all green)

  • Workspace (app/ included): cargo fmt --all --check, clippy -D warnings, cargo test against Postgres 17 and RustFS (new: config parsing and refusals, mask resolution, diff with changes inside, partly outside and without the mask).
  • visualci-app (new tests/masks.rs: end to end through the API. A change only inside the iOS mask concludes unchanged with page state masked. A change partly outside reports only the outside region. A non-matching glob is unaffected. MCP and the review page's API list the masked areas. Adding a mask hides more.) MCP goldens updated for the new schema and descriptions; PR comment golden updated.
  • frontend/: pnpm build, pnpm test (new masked-areas.test.tsx), skills.mjs --check.

VisualCI build: what should change

  • site/visualci.schema.json: the new region/rects fields and the Edges/Rect definitions.
  • json/ request snapshots: the MCP tools lists (update_project's and get_snapshot's descriptions, the ignore rule schema) and get_skill (the visualci-config skill description).
  • No screenshots should change: the seeded builds have no masks.

CLI and core changed, so the workspace is 0.2.22 (plugin 0.1.51). The docs' VISUALCI_VERSION pins move after the release.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@visualci-com

visualci-com Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #167 · 339 unchanged · no changes

This PR vs base: 7 changed since #122, across 3 builds

docspring/visualci · journeys · build #165 · 12 unchanged · no changes

This PR vs base: 2 changed since #119, across 3 builds

Updated as builds change. Agents can review with VisualCI's MCP tools.

@ndbroadbent ndbroadbent changed the title Image ignore regions in visualci.yml (sc-9018); CLI 0.2.21 Image ignore regions in visualci.yml (sc-9018); CLI 0.2.22 Dec 3, 2026
@ndbroadbent
ndbroadbent marked this pull request as ready for review December 3, 2026 15:12
…c-9018); CLI 0.2.22

An ignore rule can now carry `region` (bands along the image's edges: top, bottom, left, right, in pixels) and
`rects` (x, y, width, height). For the snapshots its glob matches, those pixels are left out of the image diff:
never counted as changed, nor in the regions or the fingerprint. A page that differs only inside them gets the new
page state `masked` and its snapshot stays unchanged.

- visualci-core: `ScopedIgnoreRule.region`/`rects`, validated with clear messages (at most 100 areas in all);
  `ImageMask` resolves them against a diff's canvas; `diff::diff_masked` skips masked pixels and hatches them in the
  overlay; `DiffResult` gains `masked` and `masked_pixels`.
- app/: `BuildSettings::image_mask` takes the areas from the build's own rules (its file's, else the project's), so
  past builds are compared and shown with their own settings. The mask's hash is part of the diff cache key. A new
  mask counts as hiding more, so it brings the visualci.yml review item. Migration allows the `masked` page state.
- get_snapshot and the download manifest list each page's masked areas; the PR comment names masked areas next to
  the images it shows.
- Review UI: masked areas hatched over the base, head, diff and slider views; "masked" page pill and pixel count.
- Docs: visualci.yml reference (Masking part of an image), the mobile page (Liquid Glass tab bar), design.md;
  skills regenerated; plugin 0.1.51; visualci.schema.json regenerated.
@ndbroadbent
ndbroadbent merged commit d661e42 into main Dec 3, 2026
14 checks passed
@ndbroadbent
ndbroadbent deleted the image-ignore-regions branch December 3, 2026 15:39
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