Support all in batch coordinate ranges - #156
Merged
Merged
Conversation
arjunrajlab
marked this pull request as ready for review
July 19, 2026 11:52
There was a problem hiding this comment.
💡 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".
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
allin Batch XY, Batch Z, and Batch Time fieldsallfrom datasetIndexXY,IndexZ, andIndexTmetadata, with single-position fallbacks for missing dimensionsallvalue in Crop range fields and the legacy Cellori loopWhy
Batch fields previously accepted only numeric ranges such as
1-3, 5-8. The range parser had no dataset-dimension context, so the literalallcould 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 correspondingIndexRangedimension correctly resolve to coordinate0.Validation
annotation_utilities: 22 tests passedworker_client: 14 tests passedgit diff --checkpassed