Skip to content

Fix(cuex): keep numbers in an external provider's reply as written - #164

Merged
briankane merged 1 commit into
kubevela:mainfrom
briankane:fix/external-reply-numbers
Nov 26, 2026
Merged

briankane merged 1 commit into
kubevela:mainfrom
briankane:fix/external-reply-numbers

Conversation

@briankane

@briankane briankane commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Description of your changes

An external provider's reply was decoded with encoding/json into map[string]any, so every number came back as a float64. CUE then held an HTTP status of 200 as a float: it interpolates as 2E+2 and doesn't unify with int, and an integer above 2^53 lost its last digits.

The reply is now read by CUE's own JSON decoder, which keeps an integer an int and every digit it was sent. A reply that isn't a JSON object is still an error.

How has this code been tested?

TestExternalProviderFnKeepsNumbersAsWritten serves a reply with an int status, a float and an integer above 2^53, and checks both Call and CallForResult keep each as written and the status unifies with int. go test ./cue/cuex/runtime/ passes.


Summary by cubic

Keeps numbers in external provider replies as written. Replies were decoded with encoding/json into map[string]any, turning every number into a float64, so an HTTP status of 200 became 2E+2 and integers above 2^53 lost digits. The reply is now read by CUE's own JSON decoder, which preserves integer kind and full precision. Replies that aren't JSON objects still return an error.

Written for commit db08c72. Summary will update on new commits.

View guided diff

A reply was decoded with encoding/json into map[string]any, so every number
became a float64. CUE then held an HTTP status of 200 as a float, which
interpolates as "2E+2" and does not unify with int, and an integer above
2^53 lost its last digits. The reply is now read by CUE's own JSON decoder,
which keeps an integer an int and every digit it was sent. A reply that is
not a JSON object is still an error.

Signed-off-by: Brian Kane <briankane1@gmail.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 2 files

View guided diff | Re-trigger cubic

@codecov

codecov Bot commented Nov 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.52%. Comparing base (e062254) to head (db08c72).

Files with missing lines Patch % Lines
cue/cuex/runtime/provider.go 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #164      +/-   ##
==========================================
- Coverage   92.54%   92.52%   -0.02%     
==========================================
  Files         115      115              
  Lines        6944     6946       +2     
==========================================
+ Hits         6426     6427       +1     
- Misses        518      519       +1     
Flag Coverage Δ
unit-test 92.52% <75.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. 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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@briankane
briankane merged commit 6b8007f into kubevela:main Nov 26, 2026
11 checks passed
briankane added a commit to briankane/workflow that referenced this pull request Nov 26, 2026
Picks up kubevela/pkg#164 for v0.8.0-alpha.3.

Signed-off-by: Brian Kane <briankane1@gmail.com>
briankane added a commit to kubevela/workflow that referenced this pull request Nov 26, 2026
* Fix: inject the multicluster client into the workflow context (#251)

[紧急] fix: inject multicluster client into workflow context

(cherry picked from commit 2df730a)
Signed-off-by: Brian Kane <briankane1@gmail.com>

* Fix: set the WorkflowRun identity labels in ApplyInParallel (#330)

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
(cherry picked from commit c6a8d92)
Signed-off-by: Brian Kane <briankane1@gmail.com>

* Chore: bump kubevela/pkg to 6b8007f3ec60

Picks up kubevela/pkg#164 for v0.8.0-alpha.3.

Signed-off-by: Brian Kane <briankane1@gmail.com>

---------

Signed-off-by: Brian Kane <briankane1@gmail.com>
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Co-authored-by: Cris <92035086+cuixiaojun001@users.noreply.github.com>
Co-authored-by: Arpit Jain <3242828+arpitjain099@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants