Surface corrupt sidecars at viewer open; pin mask-from-edge alignment#25
Merged
Merged
Conversation
… seams Adversarial review pass 2, items 7-8. Corrupt-sidecar visibility: the viewer's ROI/mask sidecar wrappers swallowed every loader exception into an always-None error slot, so a corrupt .rois.json/.masks.json read as "no ROIs/masks" at viewer open — and the next save would overwrite the damaged file without the user ever knowing their data was there. The wrappers now return the error message for corrupt files (missing sidecars stay silent — they are normal), and both mixin load paths show it in the status bar. With the discovery fix from PR #23, only genuine corruption raises, so the message fires exactly when data is at risk. Mask-from-edge-detection alignment (review focus #4): the architecture checked out — the dialog operates on the displayed array, the ROI restriction rasterises at the display shape, the scrim overlay blocks viewer state changes while the dialog is open, and _active_mask_array shape-guards stale rasters. New tests pin those guarantees: emitted masks have the input array's exact shape with edges only inside the ROI, the handler stamps source context (path/channel/data_basis) and persists, the shape guard hides mismatched masks from the overlay, and the channel- mismatch note is surfaced. Also adds an end-to-end pin that a saved GUI dict carrying after_geometric_ops replays correctly through apply_processing_state_to_scan (the CLI/export path), closing the sidecar-replay smoke-test item. Co-Authored-By: Claude Fable 5 <[email protected]>
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
Adversarial review pass 2, items 7–8 (plus the sidecar-replay smoke-test item).
Corrupt-sidecar visibility (
gui/viewer/roi_sidecar.py,mask_sidecar.py, both mixins)The viewer's sidecar wrappers swallowed every loader exception into an always-
Noneerror slot — a corrupt.rois.json/.masks.jsonread as "no ROIs/masks", and the next save would overwrite the damaged file silently. The wrappers now return an error message for corrupt files (missing sidecars stay silent), and both load paths show it in the status bar. With PR #23's discovery fix, only genuine corruption raises, so the message fires exactly when data is at risk.Mask-from-edge-detection alignment (review focus #4 — verified sound, now pinned)
The architecture held up: the dialog operates on the displayed array, ROI restriction rasterises at the display shape, the scrim overlay blocks viewer state changes while open, and
_active_mask_arrayshape-guards stale rasters. New tests pin: exact-shape ROI-restricted mask emission, source-context stamping + sidecar persistence + activation, the shape guard hiding mismatched overlays, and the channel-mismatch note.Replay smoke test
End-to-end pin that a saved GUI dict with
after_geometric_opsreplays correctly throughapply_processing_state_to_scan(the CLI/export path).Test plan
test_sidecar_discovery.py, 4 intest_edge_detection_dialog.py, 1 intest_processing_scope_seams.py.🤖 Generated with Claude Code