fix(driver): handle decimal space info sizes#74
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 75b6cf9e9b
ℹ️ 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 dot := strings.IndexByte(value, '.'); dot >= 0 { | ||
| value = value[:dot] | ||
| } | ||
| return strconv.ParseInt(value, 10, 64) |
There was a problem hiding this comment.
Parse exponent-form sizes without truncating significand
JSON numeric values may legally use exponent notation, but this logic truncates everything after the first . before parsing. For inputs like "size": 1.5e6 (or the same as a JSON string), value becomes "1", ParseInt succeeds, and the code silently records 1 byte instead of 1500000. This introduces silent data corruption for any scientific-notation payloads instead of surfacing an error.
Useful? React with 👍 / 👎.
## Summary - Address Codex review feedback from #74 by parsing exponent-form space size values correctly. - Replace manual decimal truncation with high-precision numeric parsing and integer truncation. - Add regression coverage for numeric and string exponent payloads. ## Source - Follow-up to Codex review on #74: #74 (comment) - Original issue source: OpenListTeam/OpenList#2343 ## Test Plan - [x] `go test ./pkg/driver -run 'TestInfoResponseUnmarshals(Decimal|Exponent)SpaceSizes' -count=1`\n- [x] `git diff --check`\n- [x] `go test ./... -run 'TestInfoResponseUnmarshals(Decimal|Exponent)SpaceSizes' -count=1`
Summary
space_infosizes.Source
Test Plan
git diff --checkgo test ./pkg/driver -run TestInfoResponseUnmarshalsDecimalSpaceSizes -count=1go test ./... -run TestInfoResponseUnmarshalsDecimalSpaceSizes -count=1Notes
go test ./...without filtering currently requires a valid 115COOKIE; with an empty cookie it fails existing integration tests withbad cookie/user not login.