Repository navigation
Stage 2: make_clean_run(description=...) builds a described run for tests - #228
Merged
Merged
Conversation
Stage 2 design PR 1. A brick's Stage 2 test needs a run with a published experiment description. make_clean_run takes description (bytes, text or a Description) and builds the declared tree (image_count images per member, RGB colour for rgb units), the declared masks named in mask_types, publishes the bytes, runs preprocessing and the mask step. make_described_run does the same with the mask step optional. Without description, nothing changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Scma6W3LC11s3qjXHZuGDm
…ribed # Conflicts: # CHANGELOG.md
This was referenced Nov 8, 2026
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.
What
testing.make_clean_run(folder, description=...)builds a described run, so downstream bricks can test Stage 2.descriptionis a published experiment description: bytes or text (published unchanged, so the run records their SHA-256) or aDescription(written canonically).image_counttiny images per member, with the unit's channels. Anrgbunit is written as RGB colour (YXS).mask_typesare then IDs of the description's masks. It writes one mask per image for each ID (instances: two labelled squares;binary: one region of 1s).morphobricks.toml, runs preprocessing and, with masks, the mask step.CleanRun, with a new last fielddescription(None for an undescribed run).testing.make_described_run(folder, description, masks=..., mask_step=...)is the same with the mask step optional, so masks can be leftnot yet checked(P28 tests).axes,shape,pixel_size,designandseedraiseValueErrortogether with a description. They are replaced by the description, so nothing is silently ignored.description,make_clean_runbehaves as before, and its signature gains only the last keyword.unit_foldermoved fromtests/description_tree.pyinto the new moduletesting_described.py, and the tests import it from there. The code rules refuse identical function bodies, so it could not stay in both.Why
Stage 2 design, PR 1 (section 1.1, "
testing.make_clean_runcannot build a described run"). Every brick's Stage 2 test needs one.Regression evidence
New
tests/test_make_described_run.py(21 tests). Each ofv03 v08 v13 v28 v30 v33 v34builds, opens withRunInputs, andfovs()gives the fixture's canonical IDs. The expected multiset of (condition ID, repeat group, technical repeat ID, channel IDs), with its image count, is computed from the parsed description. The file also covers the published bytes,v28as RGB,v08masks checked and unchecked, the refusals, and the unchanged undescribed behaviour.On
mainthe file fails at collection (make_described_runand thedescriptionargument do not exist), so 0 of 21 run. With the change, 21 pass.Checks
python tools/check.py: ruff check and format clean, 4596 passed, 4 skipped, code rules clean. The 4 skips are environmental: 3 need a case-sensitive-name file system check (test_cli_log.py:165,test_folder_rules.py:201and:229) and 1 needs file modes to apply (test_discovery.py:665, running as root).testing_describedis declared anorchestrationmodule inpyproject.toml.Needs an owner decision
description=<Spec fixture name or bytes>. Only bytes, text andDescriptionare accepted, because the Spec fixtures are not part of the installed package. A brick passes the bytes of its own vendored fixture. A name lookup would need the package to find a Spec checkout: say so if you want it.make_clean_runis at the 8-parameter limit, so the mask step is optional only inmake_described_run.make_clean_run(description=..., mask_types=...)always runs it.v17,v29) are not built. A description mixingrgband fluorescence units raisesValueError, and preprocessing refuses partial channel presence (P04).Generated by Claude Code