Skip to content

Support all in batch coordinate ranges - #156

Merged
arjunrajlab merged 5 commits into
masterfrom
codex/support-all-batch-ranges
Aug 7, 2026
Merged

Support all in batch coordinate ranges#156
arjunrajlab merged 5 commits into
masterfrom
codex/support-all-batch-ranges

Conversation

@arjunrajlab

Copy link
Copy Markdown
Collaborator

Summary

  • allow users to enter all in Batch XY, Batch Z, and Batch Time fields
  • expand all from dataset IndexXY, IndexZ, and IndexT metadata, with single-position fallbacks for missing dimensions
  • route WorkerClient and direct SAM batching paths through the shared dataset-aware parser
  • support the equivalent all value in Crop range fields and the legacy Cellori loop
  • update interface placeholders and worker documentation

Why

Batch fields previously accepted only numeric ranges such as 1-3, 5-8. The range parser had no dataset-dimension context, so the literal all could not be expanded safely and instead failed numeric parsing. This change centralizes dataset-aware expansion while preserving existing numeric and current-tile behavior.

User impact

Users can now type all (case-insensitive, with surrounding whitespace allowed) to process every available XY position, Z slice, or time point. Datasets without a corresponding IndexRange dimension correctly resolve to coordinate 0.

Validation

  • annotation_utilities: 22 tests passed
  • worker_client: 14 tests passed
  • Crop Docker worker: 15 tests passed
  • Random Squares Docker worker: 3 tests passed
  • Python syntax checks and git diff --check passed

@arjunrajlab
arjunrajlab marked this pull request as ready for review July 19, 2026 11:52

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f55e54fe1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread workers/annotations/crop/entrypoint.py Outdated
arjunrajlab and others added 4 commits July 19, 2026 08:23
Resolves three conflicts between this branch's dataset-aware `all` batch
parsing and master's batch-coordinate validation (#165) / select-field
validation (#168).

worker_client.py: master added `_parse_batch_values`, which reported
malformed Batch input with sendError before the clients were built. This
branch needs the dataset's IndexRange to expand `all`, so parsing has to
happen after datasetClient exists. Folded master's per-field error message
into the shared `get_batch_ranges()` so it raises a ValueError naming the
offending field, and WorkerClient catches it, sends the banner, and
re-raises. `_parse_batch_values` is gone; the direct SAM batching loops now
inherit the clear message too, which they never had.

CELLPOSESAM.md / CROP.md: kept master's more precise wording (1-indexed,
empty-selection error, size-one dimension note) and added this branch's
`all` documentation alongside it rather than replacing either.

Also mirrored the branch's skill updates into .claude/skills/, which it had
only applied to .agents/, and fixed the duplicate "### 7" the textual
auto-merge produced in the hardening catalog. Corrected the stale sweep
counts there (claimed ~6 WorkerClient / ~26 direct; actually 43 / 10).

Added two regression tests for the merged behavior: get_batch_ranges names
the field that failed to parse, and returns re-iterable lists rather than
one-shot generators.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The `or all` placeholder was added by hand to each worker when `all` support
landed, which is why a codex review caught crop still missing it. Auditing the
rest showed the copying had already cost us: five workers had no placeholder at
all, three label wordings were in circulation, and only two of eighteen carried
the tooltip.

Adds batch_argument_parser.batch_interface_fields(), which returns the three
standard fields with a consistent placeholder, label and tooltip numbered from
`display_order`, and BATCH_RANGE_PLACEHOLDER for non-standard range fields.
Both live next to process_range_list/get_batch_ranges deliberately: the
placeholder is a promise about what the parser accepts, and keeping them in one
module is what stops them drifting apart again. 13 workers now splat the helper
into their interface dict (-348 lines of duplication); sam2_propagate calls it
and rewords Z/Time, which is the intended way to specialize.

Also fixes three shipped workers whose range fields could never have accepted
`all`, because they called process_range_list without all_values -- registration
('Apply to XY coordinates') and the two blob intensity workers ('Z planes').
They now pass the dataset range, so `all` works, and only then advertise it.

Deliberately NOT converted: cellori_segmentation, random_point{,_annotation_M1}
and test_multiple_annotation{,_M1}. All five are unbuilt and parse batch fields
with their own one-indexed utils.process_range_list, so giving them the shared
fields would advertise an `all` their compute() rejects. Left as-is and recorded
in the hardening skill.

An AST sweep now confirms no worker advertises `all` without passing
all_values. Adds helper tests (including that the field names it emits are the
ones get_batch_ranges reads) and a registration test that `all` really parses.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@arjunrajlab
arjunrajlab merged commit 603f243 into master Aug 7, 2026
1 check 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.

1 participant