Repository navigation
load_design raises DesignCheckError for an unreadable experiment_design.csv - #62
Merged
Merged
Conversation
Owner decision of 31 October 2026 (plan §12 question 43): the public load_design() no longer returns the default design together with a `problem` string when the saved experiment_design.csv cannot be read. It raises DesignCheckError with the one error unreadable_experiment_design, whose message is read_confirmed_design's "The experiment design cannot be read: ..." followed by the lenient reader's refusal naming the line and column; the DesignFormatError is its __cause__. It now returns (design, changes). Without a file it still returns the default design (the first run, not an unreadable file). Callers keep their behaviour: notebook step 1 leaves the file untouched, shows the refusal and replaces the file only on an answer (question 42); `check` prints the refusal and its suggested action and writes nothing. Contract §12 and §16, the user guide and plan §12 record it as a breaking change for the next release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WX6rdMV1r5jUPUR94kxV5a
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
Owner decision of 31 October 2026 (plan §12 question 43, follow-up to PR #61). This is a breaking API change for the next release.
experiment_design.csvcannot be read,load_design(output_folder, repeats)now raisesDesignCheckError. Before, it returned the default design together with aproblemstring. The error holds one issue,unreadable_experiment_design. Its message isread_confirmed_design's "The experiment design cannot be read: …" followed by the lenient reader's refusal, which names the line and column (for exampleexperiment_design.csv, line 2, column confirmed_on: '26/10/2026' is not a date in the form YYYY-MM-DD …). The issue also gives the path and a suggested action, and theDesignFormatErroris its__cause__. No default design is returned and the file is not touched. The return value is now(design, changes). The issue builder is shared withread_confirmed_design(_unreadable), so both readers give the same refusal text._open_design): catches the error and keeps the PR Keep an unreadable experiment_design.csv untouched in step 1 #61 behaviour: the file is left untouched, the refusal is shown in the red box, the questions start unanswered, and an explicit answer replaces the file.check): prints the refusal and its suggested action and writes nothing. The exit code is unchanged.runnever calledload_design: it usesread_experiment_designand already refused such a file without writing it.check), §8 (message code) and §9 (Python example), and plan §12 question 43.Decisions
DesignCheckErrorwith the existing codeunreadable_experiment_design, so the error carries aValidationIssue(code, message, paths, action) like the rest of the brick. It is still aValueError.DesignFormatErrorstays the lenient reader's own error and is chained as__cause__.load_designreturns the default design andDesignChanges(). A missing file is the normal first run, not an unreadable file. A path that exists but cannot be read (for example a folder namedexperiment_design.csv, or an I/O error) does raise.problem) rather than keeping it as an always-Nonefield. Old callers that unpack three values now fail loudly instead of silently ignoring a field that no longer means anything.Uses in other bricks (read-only grep of the local checkouts, not edited)
There are no uses of
load_designor itsproblemvalue in CellPatcher (32b8f8a), MorphoCoverage (beadc9d), MorphoEmbed (f0092aa), MorphoFeature (60a7832), MorphoObjects (b5cafef), MorphoRelate (5ccbaac), fiberfeatures (e2f5b97) or morphobricks-normalization (f784c95). Those bricks read the design withread_confirmed_design, or with their own readers. The SHAs are the local checkout HEADs, which may be behind their remotes.Notes for review
Tests
tests/test_design.py:load_designraises for a re-saved date, anNArepeat group, and a file without the columns (parametrised), and for a folder in place of the file. Each case checks the code, the message with its line and column, the path, the action and the cause, and that the file is unchanged.checkrefuses an unreadable design without writing it.febe0a8), all 7 new tests fail: the unreadable cases with "DID NOT RAISE DesignCheckError", the two return-value tests with "too many values to unpack", and the CLI test because the message differs.dev,notebook,zarr):ruff check .passes,ruff format --check .reports 74 files already formatted, andpytestgives 1469 passed, 1 skipped. The skip istests/test_discovery.py:665, "running with permissions that ignore file modes" (the run was as root), and is unrelated to this change.Generated by Claude Code