Skip to content

Surface corrupt sidecars at viewer open; pin mask-from-edge alignment#25

Merged
jacobson30-bot merged 1 commit into
mainfrom
sidecar-visibility-and-mask-alignment
Jun 11, 2026
Merged

Surface corrupt sidecars at viewer open; pin mask-from-edge alignment#25
jacobson30-bot merged 1 commit into
mainfrom
sidecar-visibility-and-mask-alignment

Conversation

@jacobson30-bot

Copy link
Copy Markdown
Contributor

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-None error slot — a corrupt .rois.json/.masks.json read 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_array shape-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_ops replays correctly through apply_processing_state_to_scan (the CLI/export path).

Test plan

  • 5 new tests in test_sidecar_discovery.py, 4 in test_edge_detection_dialog.py, 1 in test_processing_scope_seams.py.
  • Full suite green locally: 2331 passed, 3 skipped.

🤖 Generated with Claude Code

… 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]>
@jacobson30-bot jacobson30-bot merged commit db07d72 into main Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant