Skip to content

Test failure on main: all_masks_overlay_shows_every_visible_mask_at_once paints the left mask black #1457

Closed

Description

@mattsivak

lightcraft-pipeline visualize::tests::all_masks_overlay_shows_every_visible_mask_at_once fails on main at b3d392b4 (Merge #1438, integration batch 32):

crates/pipeline/src/visualize.rs:432
left mask region painted
  left:  [0, 0, 0, 255]
 right:  [255, 255, 255, 255]

The All Masks overlay in the White on Black view leaves the pixel inside the left radial mask black instead of white. It fails consistently: 4 of 4 runs on one machine, and separately on two other branches (#1104, merged up to main, and #1102, rebased onto it). Neither branch touches crates/pipeline. Seen on macOS (Apple Silicon); not yet checked on Linux. It makes cargo xtask ci fail on main at the test step.

The test and the overlay came in with #919 (8e61ad6b, Ctrl/Cmd+Shift+O shows every mask overlay at once), merged via #1438. I haven't bisected whether it ever passed on main or whether another change in that batch broke it.

To reproduce: cargo test -p lightcraft-pipeline all_masks_overlay_shows_every_visible_mask_at_once

cc @csy2006

Activity

  1. mattsivak commented on Oct 13, 2026

    @mattsivak
    ContributorAuthor

    Likely cause, found while rebasing #995 (not yet confirmed with a fix): in the White on Black view, each mask in Overlay::AllMasks repaints the whole image, so the second (right) mask paints the first mask's area black again. Combining the masks first (e.g. max of the visible masks' weights), then rendering the view once, should make the test pass.

  2. squareSphere29 commented on Oct 13, 2026

    @squareSphere29
    Contributor

    Hit into the same error while correcting my PRs on Windows

    Upstream main is currently red
    visualize::tests::all_masks_overlay_shows_every_visible_mask_at_once fails on clean b3d392b, with none of my changes — I checked out the base and ran it in isolation to be sure.

    The failure is real, not environmental:

    assertion left == right failed: left mask region painted
    left: [0, 0, 0, 255] ← expected white, got black
    right: [255, 255, 255, 255]
    A WhiteOnBlack mask overlay painting black where a radial mask should be white — the "all masks at once" feature from 8e61ad6 Add Ctrl+O / Cmd+O to show every mask overlay at once, last touched by 40b7b9b fmt: satisfy rustfmt on AllMasks test.

  3. csy2006 commented on Oct 13, 2026

    @csy2006
    Contributor

    Thanks for the reports — I can reproduce this, and you're right: it's a compositing bug in the AllMasks overlay, not platform-specific.

    In visualize::apply the AllMasks branch loops over each visible mask and calls mask_view once per mask. For the white-on-black (and image-on-black) views, mask_view repaints the entire image on every call, so a later mask overwrites the region of an earlier mask wherever its own alpha is 0 — which is exactly the "only some masks show up" symptom. mattsivak's diagnosis is spot on.

    The fix is to merge all visible masks' alpha into one plane (per-pixel union) and draw it once, instead of drawing each mask separately. I'll put up a patch PR for #1457 shortly.

  4. FredApps commented on Oct 17, 2026

    @FredApps
    Contributor

    Recommend closing as fixed in v0.8.0, released October 14.

    Merged #1456 (481272c) addresses the reported All Masks failure: visible mask planes are combined using per-pixel maximum and rendered once, rather than later masks overwriting earlier ones. The regression still checks both visible mask regions; the hidden-mask expectation is corrected to black for the White on Black view.

    I verified that this merge is included in v0.8.0 and inspected the implementation/test change against the diagnosis above. No build from main is needed for this fix. I did not rerun the regression locally or find a reporter retest of the released version, so this is a release-backed closure recommendation, not a claim of a new runtime confirmation. If the same failure persists on v0.8.0, please include the exact commit/build and test output.

  5. csy2006 commented on Oct 17, 2026

    @csy2006
    Contributor

    Thanks for the clear write-up. I built v0.8.0 (16dbb90) and ran the overlay tests to confirm at runtime:

    cargo test -p lightcraft-pipeline visualize

    running 5 tests
    test visualize::tests::all_masks_overlay_shows_every_visible_mask_at_once ... ok
    test visualize::tests::point_color_range_keeps_the_selected_colour_only ... ok
    test visualize::tests::spots_view_marks_specks_at_any_size ... ok
    test visualize::tests::mask_overlay_shows_the_evaluated_alpha ... ok
    test tests_hdr::visualize_hdr_paints_only_what_rises_above_white ... ok
    test result: ok. 5 passed; 0 failed
    all_masks_overlay_shows_every_visible_mask_at_once is the regression test for this bug, and it passes on the release — so I can confirm the union-max fix (PR #1456 / 481272c, in v0.8.0) resolves #1457. From my side this is confirmed fixed, so closing the issue makes sense.

    Separately: my PR #1494 is now test-only — it adds boundary cases v0.8.0/main don't cover (all five MaskViews from one union, no-matching-plane leaves the image untouched, opacity only affecting the colour views). It's currently closed, but if those cases are worth having as extra coverage I'm happy to reopen it; otherwise I'll leave it closed to avoid duplication with #1599.

  6. skylartaylor commented on Oct 17, 2026

    @skylartaylor
    Member

    Closing as fixed, per the verification above. If it still reproduces on the version noted there, please reopen with details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions