Skip to content

fix: honor an explicit size_thresh_mask=0 in Gate - #86

Merged
paulmueller merged 1 commit into
DC-analysis:mainfrom
paulmueller-agent:fix-gate-size-thresh-zero
Nov 23, 2026
Merged

paulmueller merged 1 commit into
DC-analysis:mainfrom
paulmueller-agent:fix-gate-size-thresh-zero

Conversation

@paulmueller-agent

Copy link
Copy Markdown
Contributor

Gate.__init__ set "size_thresh_mask": size_thresh_mask or self._default_size_thresh_mask. An explicit 0 is falsy, so it was silently replaced by the default value 10. This happened both when the user passed size_thresh_mask=0 and when online_gates=True took 0 from the "online_contour:bin area min" metadata.

As a result, a gate built from a pipeline identifier with s=0 reported s=10 in its own identifier, and masks with 1–10 pixels were dropped although the user asked to keep them.

Decision (discussed with the maintainer): honor an explicit 0.

Fix

The default is only used when size_thresh_mask is None (not given, and not found in the metadata with online gates). The docstring mentions that 0 keeps all non-empty masks.

Results change only for users who explicitly passed 0, or who use online gates on files where "bin area min" is 0.

Tests

  • New test_gate_mask_size_thresh_zero: an explicit 0 gives norm:o=0^s=0 and keeps a 1-pixel mask; 0 from the metadata with online gates gives norm:o=1^s=0; and the PPID round trip. It fails on main (10 == 0) and passes here.
  • The gate and gate PPID tests pass, as do all 74 pipeline tests, run one per process locally.
  • flake8 is clean, and ruff shows no new errors.

🤖 Generated with Claude Code

`Gate` used `size_thresh_mask or 10`, so an explicit 0 (passed by the
user or taken from the "bin area min" metadata with online gates) was
silently replaced by the default value 10. A gate created from a
pipeline identifier with "s=0" therefore had the identifier "s=10".
The default is now only used if `size_thresh_mask` is None.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.22%. Comparing base (dd52e14) to head (bdbad80).

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #86   +/-   ##
=======================================
  Coverage   88.21%   88.22%           
=======================================
  Files          63       63           
  Lines        4541     4543    +2     
=======================================
+ Hits         4006     4008    +2     
  Misses        535      535           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@paulmueller
paulmueller merged commit 0fa2626 into DC-analysis:main Nov 23, 2026
8 checks passed
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.

2 participants