Skip to content

client: --value numbers in decimal only; refuse decimals too large for a number - #12

Merged
boeboe merged 2 commits into
mainfrom
fix/value-numbers
Nov 5, 2026
Merged

boeboe merged 2 commits into
mainfrom
fix/value-numbers

Conversation

@boeboe

@boeboe boeboe commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Follow-up to v0.5.0. Prepares v0.5.1.

--value and --attribute treated anything strconv.ParseFloat accepts as a number, and quietly sent a number it could not hold as text:

Input Before Now
0x1p3 the number 8 the text "0x1p3"
Inf, NaN refused as an invalid object (exit 3) text
1_000 the number 1000 text
1e400 the text "1e400" (exit 0) exit 3 invalid_input
0.35, -2, .5, 1E5, true, 1:2 unchanged unchanged

A number is now written in decimal, as JSON writes numbers. Anything else is text, which the OpenADR 3 valuesMap schema allows a value to be. The parts of an x:y point follow the same rule. CSV input was already parsed as JSON by go-openadr's timeline.ReadCSV, so it does not change.

Verified locally:

  • make check (coverage 94.6%) and make e2e.
  • 20 s of FuzzFlagValues, now also checking that no NaN or Inf number comes out.
  • scripts/interop.sh and scripts/interop301.sh against openadr-interop v0.6.3.
  • SAST passes.

The guide, docs/exitcodes.md and RELEASE.md are updated.

🤖 Generated with Claude Code

…mber refused

0x1p3, Inf, NaN and 1_000 were read as numbers by strconv.ParseFloat; JSON
has no such numbers, so they are text now, which OpenADR allows a value
to be. A decimal no float64 holds, such as 1e400, was sent as text; it
exits 3 invalid_input now. Points follow the same rule. v0.5.1 notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@boeboe
boeboe merged commit 6350871 into main Nov 5, 2026
21 checks passed
@boeboe
boeboe deleted the fix/value-numbers branch November 5, 2026 10:01
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.

1 participant