Skip to content

[v2.16]fix(driver): accept UINT64 write values for numeric tags - #2961

Merged
fengzeroz merged 1 commit into
emqx:v2.16from
ZhouBox:v2.16
Nov 13, 2026
Merged

fengzeroz merged 1 commit into
emqx:v2.16from
ZhouBox:v2.16

Conversation

@ZhouBox

@ZhouBox ZhouBox commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Sparkplug B encodes UInt64 metrics as an unsigned 64-bit value, which cannot be represented by an INT64 write value. Accept NEU_TYPE_UINT64 writes for numeric tags, evaluate the range with the unsigned value, and extend cal_decimal and float conversion accordingly. INT64 write values keep their signed semantics.

Sparkplug B encodes UInt64 metrics as an unsigned 64-bit value, which cannot
be represented by an INT64 write value. Accept NEU_TYPE_UINT64 writes for
numeric tags, evaluate the range with the unsigned value, and extend
cal_decimal and float conversion accordingly. INT64 write values keep their
signed semantics.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T03:10:36.408721Z 26a4f82 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codecov-commenter

codecov-commenter commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.88%. Comparing base (68e9946) to head (26a4f82).
⚠️ Report is 1 commits behind head on v2.16.

Files with missing lines Patch % Lines
src/adapter/driver/driver.c 75.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            v2.16    #2961      +/-   ##
==========================================
- Coverage   69.00%   68.88%   -0.12%     
==========================================
  Files         137      137              
  Lines       34860    34870      +10     
==========================================
- Hits        24055    24021      -34     
- Misses      10805    10849      +44     

☔ 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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26a4f828b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (write_type == NEU_TYPE_INT64) {
result = (long double) value;
} else if (write_type == NEU_TYPE_UINT64) {
result = (long double) (uint64_t) value;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve fractional checks for wide UINT64 transforms

On the x86_64 target configured in .github/workflows/ci.yml, long double has only 64 mantissa bits, so for newly accepted unsigned values above INT64_MAX the subsequent bias or division can round away every fractional bit before the integer check. For example, writing UINT64_MAX to a UINT64 tag with bias 0.5 turns result into UINT64_MAX - 1, passes the integrality check, and makes cal_decimal write that different value, whereas the exact transformed value is a half-integer that should be rejected; preserve the fractional remainder or use wider/exact arithmetic in both validation and conversion.

Useful? React with 👍 / 👎.

@ZhouBox
ZhouBox requested a review from fengzeroz November 13, 2026 03:15
@fengzeroz
fengzeroz merged commit 87d8ad6 into emqx:v2.16 Nov 13, 2026
14 checks passed
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.

3 participants