Skip to content

History Panel : handle long metadata description #369

Open

Description

@ThomasMalletCodra

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

  1. Open an image (or signal) in DataLab.
  2. Start history record
  3. Apply an operation whose parameters/metadata embed a large array or histogram (e.g. adjust Brightness/Contrast on an image).
  4. 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_edges arrays), 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_summary to 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.

Image

Environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions