Skip to content

Warn and render na_color when color column is all-NaN#637

Merged
timtreis merged 2 commits intomainfrom
fix/issue-599-all-nan-color-column
Apr 24, 2026
Merged

Warn and render na_color when color column is all-NaN#637
timtreis merged 2 commits intomainfrom
fix/issue-599-all-nan-color-column

Conversation

@timtreis
Copy link
Copy Markdown
Member

@timtreis timtreis commented Apr 24, 2026

Fixes #599.

Summary

  • All-NaN color column previously raised a misleading ValueError blaming instance-id alignment even when the join succeeded
  • When dtypes match (genuine all-NaN case): now emits a warning and renders every element with na_color, consistent with partial-NaN behaviour
  • When dtypes differ (genuine alignment failure): keeps the error, rephrased to drop the incorrect "could not be aligned" language

timtreis and others added 2 commits April 24, 2026 22:57
Previously an all-NaN color column raised a misleading ValueError that
blamed instance-id alignment even when the join succeeded. Now:
- if dtypes differ (genuine alignment failure) the error is kept but
  rephrased to drop the incorrect "could not be aligned" language
- if dtypes match (all-NaN column) a warning is emitted and every
  element is rendered with na_color, consistent with partial-NaN behaviour

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove the dtype_hint gate that could silently swallow genuine alignment
failures when _build_alignment_dtype_hint returns "" for reasons other
than matching dtypes. Instead always warn and render with na_color,
appending the dtype hint to the message when present.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.33%. Comparing base (9afec7e) to head (560535b).

Files with missing lines Patch % Lines
src/spatialdata_plot/pl/utils.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #637      +/-   ##
==========================================
- Coverage   76.40%   76.33%   -0.08%     
==========================================
  Files          11       11              
  Lines        3230     3232       +2     
  Branches      758      758              
==========================================
- Hits         2468     2467       -1     
- Misses        464      466       +2     
- Partials      298      299       +1     
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/utils.py 66.38% <0.00%> (-0.15%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis merged commit c6ab456 into main Apr 24, 2026
7 of 8 checks passed
@timtreis timtreis deleted the fix/issue-599-all-nan-color-column branch April 24, 2026 23:23
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.

All-NaN color column raises misleading 'instance IDs could not be aligned' error

2 participants