Skip to content

fix(dendrogram, v1.2): pass the color threshold to scipy as a number - #7306

Open
kz930 wants to merge 1 commit into
apache:release/v1.2from
kz930:backport/7234-dendrogram-threshold-v1.2
Open

fix(dendrogram, v1.2): pass the color threshold to scipy as a number#7306
kz930 wants to merge 1 commit into
apache:release/v1.2from
kz930:backport/7234-dendrogram-threshold-v1.2

Conversation

@kz930

@kz930 kz930 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

Backport of #7234 to release/v1.2. The automated backport, #7291, landed with cherry-pick conflict markers on a branch in this repository that I cannot push to, so this PR carries the resolved commit from my fork instead.

The conflict was in createDendrogram(): release/v1.2 still has the older body, and the cherry-picked commit rewrites the same lines. The resolution takes the cherry-picked side. It is line-for-line identical to what landed on main, plus the three assert messages that already exist on main and that the accompanying spec asserts on.

Any related issues, documentation, discussions?

Backport of #7234, which closed #7232. Supersedes #7291.

How was this PR tested?

DendrogramOpDescSpec on this branch: 9 tests, all passing. scalafmtCheckAll and scalafixAll --check are both clean.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (claude-opus-5[1m])

…e#7234)

### What changes were proposed in this PR?

Dendrogram's Color Threshold could not be set at all:

- the field was declared as a string and spliced into the generated
Python as a decode expression, so scipy received `'3'` rather than `3`
and raised `UFuncTypeError` comparing it against the linkage distances
- the only values that plotted were a blank field and the literal
`default`, and scipy documents those as equivalent — both mean 0.7 × max
distance — so nothing a user could type ever changed the coloring

This PR declares the field as `Option[Double]`:

- the number is spliced as a literal, so scipy gets a number
- an unset threshold stays `None`, the same 0.7 × max distance a blank
field already meant
- `@JsonDeserialize(contentAs = ...)` names the boxed class: Scala
erases `Option`'s element type, so without it Jackson leaves the raw
JSON value inside the Option and the first use throws
`ClassCastException`, and the primitive class would read a blank as 0 —
every link colored the same rather than "unset"

Compatibility: a numeric string saved earlier still reads as a number,
and those workflows were failing before this change anyway. A workflow
that stored the literal `default` no longer loads; clearing the field
plots the identical chart.

### Any related issues, documentation, discussions?

Fixes apache#7232.

### How was this PR tested?

- the operator's existing spec updated: a configured threshold is
asserted to reach the template as `color_threshold=42.5`, not as a
decoded string
- deserialization tests for a JSON number, a numeric string, blank, null
and absent — plus one that uses the value as a number, the case a round
trip cannot catch
- ran the generated Python against a pandas DataFrame:
`color_threshold=3.0` plots a figure and so does the unset case, while
passing the same value as a string, which is what the operator does
today, raises `UFuncTypeError`
- whole workflow-operator module: 2020 tests passing, `scalafmtCheck`
clean

### Was this PR authored or co-authored using generative AI tooling?

(backported from commit 351ce20)

Generated-by: Claude Code (claude-opus-5[1m])
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @aglinxinyuan
    You can notify them by mentioning @aglinxinyuan in a comment.

@codecov-commenter

codecov-commenter commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 52.83%. Comparing base (a9f39e2) to head (3e849d1).

Additional details and impacted files
@@                Coverage Diff                 @@
##             release/v1.2    #7306      +/-   ##
==================================================
- Coverage           52.87%   52.83%   -0.04%     
+ Complexity           2526     2520       -6     
==================================================
  Files                1078     1078              
  Lines               42369    42367       -2     
  Branches             4566     4565       -1     
==================================================
- Hits                22404    22386      -18     
- Misses              18646    18656      +10     
- Partials             1319     1325       +6     
Flag Coverage Δ *Carryforward flag
access-control-service 64.35% <ø> (ø)
agent-service 34.36% <ø> (ø) Carriedforward from a9f39e2
amber 52.85% <100.00%> (-0.11%) ⬇️
computing-unit-managing-service 1.65% <ø> (ø)
config-service 56.06% <ø> (ø)
file-service 61.72% <ø> (ø)
frontend 47.32% <ø> (ø) Carriedforward from a9f39e2
pyamber 93.07% <ø> (ø) Carriedforward from a9f39e2
python 90.88% <ø> (ø) Carriedforward from a9f39e2
workflow-compiling-service 58.69% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Yicong-Huang
Yicong-Huang requested a review from xuang7 August 4, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants