Repository navigation
Pin preprocessing v0.7.0 and normalization v0.7.1; pass a stopped run's refusal on (#126); document D47 (#124) - #133
Merged
Conversation
Preprocessing v0.7.0 (8865b72; core and zarr extra; was v0.6.1) and normalization v0.7.1 (fcfaeac; was v0.7.0), the requirement string preprocessing v0.7.0's pyproject pins (owner decision D-h). setup.py, AGENTS.md, docs/normalization.md, docs/normalization_contract.md and a new [Unreleased] CHANGELOG entry name the tags. Preprocessing v0.7.0 words the resolver's A_SCOPE_INCOMPLETE as "present in k of n images" (was "acquisitions", its #321): the four tests that quoted the old word, and docs/configuration_reference.md, now quote the new text. No golden changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
) Reworks draft PR #128 onto the preprocessing v0.7.0 pin. On a folder where preprocessing stopped without writing a run (Spec v29, R_HETEROGENEOUS_LAYOUT_NOT_ENABLED), RunInputs.open raises RunStoppedError; open_run's PreprocessingCheckError (chained from it) now holds first an issue whose code and message are the error's own code (RUN_FOLDER_STOPPED) and str(), with no action of CellPatcher's, then the error's issues unchanged and in order. RunReportUnreadableError gives one issue with its code (RUN_FOLDER_REPORT_UNREADABLE) and message, naming the report. Spec ADR 0005, construction and propagation: no rewording, no CellPatcher code around RUN_FOLDER_STOPPED (#128 added a preprocessing_run_refused issue after the stopped run's issues; that is gone). CellPatcher never reads discovery_report.json. A folder with neither a run nor a stopped run's report says to give a written run or run preprocessing first; a stale written run keeps its re-run advice. tests/test_stopped_run.py (from #128, with string-equal code and message checks, a guard that no discovery_report.json is read and a source scan for RUN_FOLDER_ literals); docs/normalization.md and the CHANGELOG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
Owner decision of 17 November 2026 on #124: keep D47. In memory an integer cell-mode mask is instance labels used as stored, so a 0/1 integer region is one object: an in-memory array carries no representation and its values cannot tell a region from labels, and CellPatcher labels no mask (Spec ADR 0005 BM2/BM4). A described file run declares the representation and refuses a binary mask as objects unless binary_mask_policy is set. docs/plan.md §13 records D47 with its reason and the rejected alternative; docs/patching_modes.md and run_patching's docstring warn that a region in cell mode is one large patch and say to pass instance labels. No behaviour change; tests/test_cell_strategy.py pins it through run_patching. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp9AxjpGPw9xfWAUJNqc
guijacquemet
commented
Nov 17, 2026
guijacquemet
left a comment
Contributor
Author
There was a problem hiding this comment.
Independent review: MERGE
Reviewed head da47ad4 against base de5b5ae. I worked in a fresh clone with a fresh Python 3.13 venv and ran pip install --no-cache-dir -e .[test,zarr,notebook] plus CPU torch. The bricks installed at preprocessing 8865b72 (v0.7.0) and normalization fcfaeac (v0.7.1). I compared the code against preprocessing v0.7.0 and against MorphoBricks-Spec main 1167108.
1. Pins: OK
setup.py:22-23and:67-68(zarr extra) pinmorphobricks-preprocessing @ git+https://github.com/CellMigrationLab/morphobricks-preprocessing@v0.7.0.setup.py:30-31pinsmorphobricks-normalization @ git+https://github.com/CellMigrationLab/morphobricks-normalization.git@v0.7.1.- The normalization string is byte-identical to preprocessing v0.7.0
pyproject.toml:29, which also uses the.git@v0.7.1spelling (:44gives the histology variant). That satisfies D-h.v0.7.1resolves tofcfaeac9c104…, andv0.7.0resolves to8865b7265e21…. - Every other mention is updated: AGENTS.md,
docs/normalization.md,docs/normalization_contract.md,docs/configuration_reference.mdand the four test quotes ("acquisitions" → "images"). Noenvironment.yamlor notebook install line carries a tag. The remainingv0.6.1and normalization-v0.7.0mentions are history only: the CHANGELOG, the version lists in normalization_contract, and the dated health snapshot in AGENTS.md.
2. #126 against ADR 0005 "Construction and propagation": OK
- In
run_open.py:215-243(_refusal_issues), aRunStoppedErrorbecomeserror(exc.code, str(exc), [folder])followed by*exc.issues. The code and message are taken straight from the exception and the action is empty. The issue objects are the exception's own tuple, passed on as-is: same objects, same order, and their paths are not re-sorted.RunReportUnreadableErroris handled the same way, with[exc.path]. - Preprocessing builds both texts itself in
run_inputs_stopped.py(_stopped_text,_unreadableand the report-version branch of_refusal). CellPatcher formats neither, and itssrchas no"RUN_FOLDER_literal and nodiscovery_report.json(confirmed by grep and by the source-scan test). - The cause is chained (
raise … from exc,run_open.py:197). Nothing is read from the experiment before the refusal.open_file_runandvalidate_image_and_mask_folderscallopen_runbefore anyfovs()or plane read, and preprocessing reads its report only when the folder has no manifest, before any pixel. - A written but stale run still goes through
_refusal_issue, unchanged. This is covered bytest_a_stale_run_still_advises_running_preprocessing_again.
3. Tests: OK
- I reverted
srctob928f59and kept the new tests.tests/test_stopped_run.pythen gives 9 failed, 2 passed. The two that pass are the stale-run test and the source scan, and both are expected to pass on old code too. - To check the D47 test, I added connected-component labelling inside
CellSegmentationStrategy.generate_regions.test_d47_an_in_memory_region_is_one_object_through_run_patchingthen fails attest_cell_strategy.py:368. So the test does pin the behaviour: one patch, label 1, area 136.
4. Goldens: OK
- The PR changes no file under
tests/fixtures.test_v062_output_parity.pyandtest_shared_labeller.pypass with normalization v0.7.1 installed. Neitherv062_parity/digests.jsonnorshared_labeller/golden.jsoncontains-0.0.
5. Docs, CHANGELOG and CI: OK
- The full suite, run in two halves, gives 955 + 2130 = 3085 passed, 0 skipped.
python tools/check.py --rules(code rules and Ruff) is clean. - All 7 CI checks pass on
da47ad4: pytest (test), (test,zarr), (test,zarr,notebook), pytest-torch, pytest-windows, rules and spec-pin. - The CHANGELOG and the new row in
docs/normalization.mddescribe what the code does.
Non-blocking notes
- The action text changes for a folder with no run. A plain manifest-less folder with no stopped report keeps its code and message,
preprocessing_run_refused/ "holds no run_manifest.json". Its action now reads "give a written run … or run preprocessing first" (run_open.py:233-240). This is deliberate and documented in the CHANGELOG, but it is the one change for a folder that is not a stopped run. The same branch also catches CellPatcher's own "run_manifest.json changed while it was opened" when the manifest disappears mid-open. That is a rare edge, and the advice is still reasonable there. - The public exception does not match the original byte for byte. Byte-equality holds at the issue level:
issues[0].codeandissues[0].messagematch the original. ButPreprocessingCheckErrorhas no.code, and itsstr()joinsstr(issue)for every issue, so the exception'sstr()is not the original message. That is howPreprocessingCheckErrorhas always worked, andRUN_FOLDER_*codes are not among the codes ADR 0005 lists. If the owner wants the stricter "own type withcode/str()equal" form, that belongs in a follow-up. - The spy in
test_the_issues_come_from_run_stopped_error_not_from_reading_the_reportis narrow. It patches onlyPath.read_text; a read throughread_bytesoropenwould get past it. The source-scan test covers this, so it is not a gap in practice.
Generated by Claude Code
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.
One commit per item, from
main(de5b5ae, after #127, #130, #132).Closes #126. Closes #124. Supersedes draft PR #128.
1. Pins (
b928f59)8865b72), both the core requirement and thezarrextra. It wasv0.6.1.fcfaeac). It wasv0.7.0.git+https://github.com/CellMigrationLab/morphobricks-normalization.git@v0.7.1is exactly the requirement string in preprocessing v0.7.0'spyproject.toml(D-h).tests/test_dependency_pins.pypasses, anddirect_url.jsonshows both bricks installed from their tags.setup.py,AGENTS.md,docs/normalization.md,docs/normalization_contract.mdand a new[Unreleased]CHANGELOG section name the new tags.What changes in preprocessing v0.7.0 and normalization v0.7.1, and what it meant for CellPatcher's tests:
A_SCOPE_INCOMPLETEnow says "present in k of n images" (it said "acquisitions"). Four tests quoted the old wording and are updated:test_cell_mask_request.py,test_channel_ids.py,test_condition_repeat_tree.pyandtest_ngff_labels.py.docs/configuration_reference.mdnow quotes the new text.unreadable_planesmessages are capped; v29 gives a single refusal. No CellPatcher test quoted these texts. v29 is covered by the newtest_stopped_run.py.-0.0as0.0. No golden changed:tests/fixtures/v062_parity/digests.jsonandtests/fixtures/shared_labeller/golden.jsonpass as they are, because no golden case writes a-0.0. Nothing was regenerated.2. A stopped run's refusal passed on unchanged (
39f8c53, reworked from #128)On a folder where preprocessing stopped without writing a run (Spec v29,
R_HETEROGENEOUS_LAYOUT_NOT_ENABLED), preprocessing'sRunInputs.openraisesRunStoppedError.open_runturns it into aPreprocessingCheckError(chainedfromit) that holds:codeisexc.code(RUN_FOLDER_STOPPED) and whosemessageisstr(exc), exactly, with an empty action (no advice from CellPatcher);exc.issues, unchanged and in order.RunReportUnreadableErrorgives one issue with its owncode(RUN_FOLDER_REPORT_UNREADABLE) andstr(exc), with the report as its path.This follows Spec ADR 0005, "Construction and propagation": nothing is reworded and no CellPatcher code is wrapped around
RUN_FOLDER_STOPPED.Changed from #128: #128 put a CellPatcher
preprocessing_run_refusedissue, worded by CellPatcher, after the stopped run's issues. That issue is gone. The error's own code and message come first instead.CellPatcher never reads
discovery_report.json: no reader is left insrc, and a test fails if it is read.Unchanged from #128:
The only "run preprocessing again" text left is inside preprocessing's own
RunStoppedErrormessage: "Fix what the errors say and run preprocessing again." It is passed on verbatim, as the ADR requires. CellPatcher adds none.tests/test_stopped_run.pycovers:run_patching_condition_repeat_tree, with code and message compared as strings to theRunStoppedErrorthatRunInputs.openraises, and the issues compared to the run's own errors;RunStoppedError, where the paths are not re-sorted anddiscovery_report.jsonis never read;RunReportUnreadableError;checkand provisional reports;RUN_FOLDER_literals anddiscovery_report.json.docs/normalization.md(troubleshooting table) and the CHANGELOG describe it.MorphoFeature #240, row A07, needs updating with this. The line that matches "no run_manifest.json" in CellPatcher's message will no longer match. The message is now preprocessing's
RUN_FOLDER_STOPPED: ....3. D47 kept and documented (
da47ad4, #124)Owner decision of 17 November 2026 for #124: keep D47 and document it.
docs/plan.md§13 records D47 with its reason: an in-memory array carries no representation, its values cannot tell a region from labels, and CellPatcher labels no mask (ADR 0005 BM2/BM4, P05). It also records the rejected alternative, arepresentation=argument.docs/patching_modes.mdgets a warning callout in Cell mode and a pitfall line: a 0/1 region in memory is one large patch, so pass instance labels (label_binary, or the recordedbinary_to_instancesconversion).run_patching's docstring says the same.tests/test_cell_strategy.py::test_d47_an_in_memory_region_is_one_object_through_run_patchingpins it.Checks
Fresh venv, Python 3.13,
.[test,zarr,notebook]plus CPU torch. Both bricks were installed from their tags (direct_url.json:v0.7.0→8865b72,v0.7.1→fcfaeac).PYTEST_ADDOPTSwas unset.python tools/check.py --rules(code rules and Ruff against the baseline): clean.tools/check.pywas run as the two halves above, not in one process.Generated by Claude Code