Repository navigation
History Panel : handle long metadata description #369
Description
Description
When a recorded history action carries a very long / voluminous piece of metadata (e.g. an image "Brightness and contrast" adjustment whose parameters embed a full histogram with thousands of bin counts and bin edges), the History panel's Description column fails to summarize it:
- The full raw content is rendered immediately in the row, instead of the intended compact single-line summary.
- Because the label word-wraps thousands of characters, the affected row grows to an enormous height, which in turn breaks vertical scrolling of the History tree view (scrolling becomes erratic/unusable once such a row is present).
Steps to Reproduce
- Open an image (or signal) in DataLab.
- Start history record
- Apply an operation whose parameters/metadata embed a large array or histogram (e.g. adjust Brightness/Contrast on an image).
- Locate the row corresponding to that action in History panel.
Expected Behavior
- The Description column should always show a compact, single-line summary by default, regardless of how large the underlying metadata is.
- The full/raw content should only appear when the row is explicitly expanded (chevron toggle), and even then it should not corrupt the tree's scrolling behavior.
- Vertical scrolling in the History tree should remain smooth no matter the size of a given action's description.
Actual Behavior
- The Description column immediately displays the entire raw content (e.g. full histogram
counts/bin_edgesarrays), even though the row is not expanded. - The resulting row height is huge, and vertical scrolling of the History tree breaks once such a row exists.
Likely Root Cause
HistoryAction.description_summary (datalab/history/action.py) falls back to "the first non-empty line of self.description" when the recorded parameters are not guidata.dataset.DataSet instances. When the metadata's textual representation has no newline (e.g. a dict containing large arrays serialized on a single line), that "first line" is actually the entire raw content, so no real truncation/summarization happens. This unbounded string is then set on CollapsibleDescriptionWidget's QLabel (datalab/widgets/historydescription.py), which word-wraps it, producing an oversized row inside HistoryTree (datalab/widgets/historytree.py).
Suggested Fix
- Truncate
description_summaryto a fixed max length (with an ellipsis) when falling back to the raw description, independently of newline presence. - Consider capping the HTML/expanded description as well, to avoid pathological cases even when a row is expanded.
Screenshot
See attached screenshot: the Description column shows a full histogram (counts/bin_edges arrays) inline for a single "Brightness and contrast" action, and vertical scrolling of the tree is broken as a result.
Environment
- DataLab version: 1.3.0
- OS: Windows
This bug was found during development of "feat/live-processing-preview" : feat(processing): add live previews and brightness/contrast #368 ; with the new processing action "Exposure/Brightness and contrast" that genrate large metadata (histogram values) but it's independant to this new feature (however, need to be fixed after feat(processing): add live previews and brightness/contrast #368 merge to simplify git workflow)
Activity