You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2026/05/30 05:34:25 UTC

[PR] fix(big-number): color-format BigNumber values when value is 0 [superset]

rusackas opened a new pull request, #40544:
URL: https://github.com/apache/superset/pull/40544

   ### SUMMARY
   
   This is a re-open of #28038 (adopted from the original author @mtrentz). The original PR's branch was in a fork (`mtrentz/superset`) whose CI was never approved to run, leaving the PR stuck indefinitely. Moving the branch to `apache/superset` directly so CI runs.
   
   **The fix:** BigNumber visualization didn't apply color formatters when the value was exactly `0`, because `if (bigNumber)` is falsy for zero. Changed to `if (bigNumber !== null && bigNumber !== undefined)`.
   
   The test file used a top-level `function` declaration which caused TS2393 ("duplicate function implementation") in TypeScript's global-script mode. Changed to a `const` arrow function to avoid the issue.
   
   Closes #28038
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   cd superset-frontend
   npm test -- plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.test.tsx
   ```
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: closes #28038
   - [ ] Required feature flags
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(big-number): color-format BigNumber values when value is 0 [superset]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #40544:
URL: https://github.com/apache/superset/pull/40544#issuecomment-4581832564

   Congrats on making your first PR and thank you for contributing to Superset! :tada: :heart:
   
   Please read our [New Contributor Welcome & Expectations](https://github.com/apache/superset/wiki/New-Contributor-Welcome-&-Expectations) guide.
   
   We hope to see you in our [Slack](https://apache-superset.slack.com/) community too! Not signed up? Use our [Slack App](http://bit.ly/join-superset-slack) to self-register.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(big-number): color-format BigNumber values when value is 0 [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #40544:
URL: https://github.com/apache/superset/pull/40544#discussion_r3328214464


##########
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx:
##########
@@ -204,11 +204,8 @@ function BigNumberVis({
     let numberColor;
     if (hasThresholdColorFormatter) {
       colorThresholdFormatters!.forEach(formatter => {
-        const formatterResult = bigNumber
-          ? formatter.getColorFromValue(bigNumber as number)
-          : false;
-        if (formatterResult) {
-          numberColor = formatterResult;
+        if (typeof bigNumber === 'number' && !isNaN(bigNumber)) {
+          numberColor = formatter.getColorFromValue(bigNumber);
         }

Review Comment:
   **🟠 Architect Review — HIGH**
   
   The updated renderHeader loop assigns numberColor on every formatter call without checking the return value, so when multiple conditional-format rules are configured, a later formatter that returns undefined will overwrite a previously matched color and clear the applied threshold color.
   
   **Suggestion:** Preserve the previous semantics by only updating numberColor when formatter.getColorFromValue(bigNumber) returns a truthy value, e.g. compute formatterResult inside the numeric-type check and guard the assignment, so that 0 still passes the numeric check but non-matching rules do not overwrite an earlier matched color.
   
   
   [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=16d7a7ba50fe48048afdb333fa89b297&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=16d7a7ba50fe48048afdb333fa89b297&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is an **Architect / Logical Review** comment left during a code review. These reviews are first-class, important findings — not optional suggestions. Do NOT dismiss this as a 'big architectural change' just because the title says architect review; most of these can be resolved with a small, localized fix once the intent is understood.
   
   **Path:** superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx
   **Line:** 206:209
   **Comment:**
   	*HIGH: The updated renderHeader loop assigns numberColor on every formatter call without checking the return value, so when multiple conditional-format rules are configured, a later formatter that returns undefined will overwrite a previously matched color and clear the applied threshold color.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   If a suggested approach is provided above, use it as the authoritative instruction. If no explicit code suggestion is given, you MUST still draft and apply your own minimal, localized fix — do not punt back with 'no suggestion provided, review manually'. Keep the change as small as possible: add a guard clause, gate on a loading state, reorder an await, wrap in a conditional, etc. Do not refactor surrounding code or expand scope beyond the finding.
   Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(big-number): color-format BigNumber values when value is 0 [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40544:
URL: https://github.com/apache/superset/pull/40544#issuecomment-4581831779

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(big-number): color-format BigNumber values when value is 0 [superset]

Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #40544:
URL: https://github.com/apache/superset/pull/40544#issuecomment-4581841801

   ### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">🔨</span> Latest commit | 0ff66f84daeadbcfd517864cff7c84b4c7d71544 |
   |<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a1a76e16c795d00086296e2 |
   |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-40544--superset-docs-preview.netlify.app](https://deploy-preview-40544--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTQwNTQ0LS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.4xFISe1-rybhZL3iR0ft1nKOwg9T1vqhm2colzv00z8)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   |<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DcpLCoAgEADQu8w6QYWm7AYdw18lqCNDQRHdPXdv8V5oTKWdsAAM4NhWf3Rv6RYu7fUqLrLwlInFRlzs2VeILdOzhv7QKjthVOgnMwYp5YzaYNTw_Q) |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-40544--superset-docs-preview.netlify.app) -->
   _To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(big-number): color-format BigNumber values when value is 0 [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #40544:
URL: https://github.com/apache/superset/pull/40544#issuecomment-4581862020

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/40544?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `0%` with `2 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 64.01%. Comparing base ([`62b4ee3`](https://app.codecov.io/gh/apache/superset/commit/62b4ee3d9e03eaeb8ed6db7d90f1b4e340be7442?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`0ff66f8`](https://app.codecov.io/gh/apache/superset/commit/0ff66f84daeadbcfd517864cff7c84b4c7d71544?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 9 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/40544?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...lugin-chart-echarts/src/BigNumber/BigNumberViz.tsx](https://app.codecov.io/gh/apache/superset/pull/40544?src=pr&el=tree&filepath=superset-frontend%2Fplugins%2Fplugin-chart-echarts%2Fsrc%2FBigNumber%2FBigNumberViz.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQtZnJvbnRlbmQvcGx1Z2lucy9wbHVnaW4tY2hhcnQtZWNoYXJ0cy9zcmMvQmlnTnVtYmVyL0JpZ051bWJlclZpei50c3g=) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/40544?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #40544      +/-   ##
   ==========================================
   + Coverage   64.00%   64.01%   +0.01%     
   ==========================================
     Files        2629     2620       -9     
     Lines      141299   140971     -328     
     Branches    32545    32525      -20     
   ==========================================
   - Hits        90432    90237     -195     
   + Misses      49314    49183     -131     
   + Partials     1553     1551       -2     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/40544/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/40544/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `67.34% <0.00%> (+<0.01%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/40544?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(big-number): color-format BigNumber values when value is 0 [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40544:
URL: https://github.com/apache/superset/pull/40544#issuecomment-4581850143

   <!-- Bito Reply -->
   The provided PR comments file contains only the header row and one empty row. There is no actual comment data available to analyze or act upon. Please ensure the correct file is provided for review.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(big-number): color-format BigNumber values when value is 0 [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #40544:
URL: https://github.com/apache/superset/pull/40544#discussion_r3328261842


##########
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.test.tsx:
##########
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Tests for the color threshold formatter logic in BigNumberViz.
+ *
+ * The key fix: bigNumber === 0 is falsy, so the original code
+ *   `const result = bigNumber ? formatter.getColorFromValue(bigNumber) : false`
+ * would skip formatting for zero. The fix uses an explicit type check instead.

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Misleading docstring references non-existent bug</b></div>
   <div id="fix">
   
   The docstring describes code (`bigNumber ? formatter.getColorFromValue(bigNumber) : false`) that does not exist in `BigNumberViz.tsx` — the source already uses explicit type check at lines 207-208. This misleads future maintainers about what bug was fixed.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #e48db6</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(big-number): color-format BigNumber values when value is 0 [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on PR #40544:
URL: https://github.com/apache/superset/pull/40544#issuecomment-4581895347

   Closing — #28038 has been reopened and CI approved there. This duplicate is no longer needed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(big-number): color-format BigNumber values when value is 0 [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed pull request #40544: fix(big-number): color-format BigNumber values when value is 0
URL: https://github.com/apache/superset/pull/40544


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org