Skip to content

fix(data_service): resolve bare signal names + list-safe sort fallback - #278

Merged
guillaume-byte merged 2 commits into
devfrom
fix/signal-sort-unhashable-list
Jul 29, 2026
Merged

fix(data_service): resolve bare signal names + list-safe sort fallback#278
guillaume-byte merged 2 commits into
devfrom
fix/signal-sort-unhashable-list

Conversation

@guillaume-byte

Copy link
Copy Markdown
Member

Sorting the grid by a signal (e.g. bce/sample) raised TypeError: unhashable type: 'list' and silently failed. Two causes:

  1. Sort received the bare signal name (bce/sample) but the dataframe column is signals//bce/sample -> pandas KeyError.
  2. The KeyError fallback did by in df.columns where by is a list, so pandas hashed the list -> TypeError.

Fix: resolve bare signal names to their signals// column before sorting, and make the fallback column-existence check list-safe.

Sorting the grid by a signal (e.g. bce/sample) raised
TypeError: unhashable type: 'list' and silently failed. Two causes:
1. Sort received the bare signal name (bce/sample) but the dataframe
   column is signals//bce/sample -> pandas KeyError.
2. The KeyError fallback did `by in df.columns` where by is a list,
   so pandas hashed the list -> TypeError.

Fix: resolve bare signal names to their signals//<name> column before
sorting, and make the fallback column-existence check list-safe.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 29, 2026 15:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes grid sorting failures when sorting by signal columns, particularly when the UI provides a bare signal name (e.g. bce/sample) but the dataframe uses prefixed signal columns (e.g. signals//bce/sample). It also hardens the error-recovery path to avoid TypeError: unhashable type: 'list' when by is a list.

Changes:

  • Resolve bare signal names in params["by"] to signals//<name> when that prefixed column exists.
  • Make the KeyError/ambiguity fallback column-existence check list-safe (all(...)) instead of by in df.columns.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3118 to +3122
# FIX: resolve bare signal names to their df column (signals//<name>)
_rb = params.get("by")
if _rb is not None:
_rbl = [_rb] if isinstance(_rb, str) else list(_rb)
_rbl = [(c if c in df.columns else ("signals//"+c if ("signals//"+c) in df.columns else c)) for c in _rbl]
Comment on lines +3118 to +3122
# FIX: resolve bare signal names to their df column (signals//<name>)
_rb = params.get("by")
if _rb is not None:
_rbl = [_rb] if isinstance(_rb, str) else list(_rb)
_rbl = [(c if c in df.columns else ("signals//"+c if ("signals//"+c) in df.columns else c)) for c in _rbl]
@guillaume-byte
guillaume-byte merged commit dcd649a into dev Jul 29, 2026
13 of 14 checks passed
@guillaume-byte
guillaume-byte deleted the fix/signal-sort-unhashable-list branch July 29, 2026 16:09
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.

2 participants