Skip to content

fix(driver): parse exponent space info sizes#75

Merged
SheltonZhu merged 3 commits into
developfrom
fix/space-info-decimal-size
May 22, 2026
Merged

fix(driver): parse exponent space info sizes#75
SheltonZhu merged 3 commits into
developfrom
fix/space-info-decimal-size

Conversation

@SheltonZhu

Copy link
Copy Markdown
Owner

Summary

  • Address Codex review feedback from fix(driver): handle decimal space info sizes #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

Test Plan

  • 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

@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: 273a4ffeae

ℹ️ 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".

Comment thread pkg/driver/info.go
Comment on lines +115 to +116
sizeInt, _ := size.Int(nil)
return sizeInt.Int64(), nil

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 Guard int64 conversion when parsing space sizes

Converting size.Int(nil) directly with Int64() can silently wrap on values outside the int64 range, so very large exponent inputs now deserialize to incorrect negative/garbled sizes instead of failing. For example, parsing "1e19" yields a wrapped negative int64. Before this change, oversized/non-integer forms were rejected by strconv.ParseInt; now this path accepts them and corrupts SpaceInfo values. Add an explicit range check (e.g., IsInt64) and return an error when out of bounds.

Useful? React with 👍 / 👎.

@SheltonZhu

Copy link
Copy Markdown
Owner Author

@codex review

@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: 3744dc9854

ℹ️ 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".

Comment thread pkg/driver/info.go
Comment on lines +116 to +117
sizeInt, _ := size.Int(nil)
if !sizeInt.IsInt64() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Guard against infinity before converting to big.Int

parseSpaceSize can panic on valid string inputs like "Inf" or "-Inf": big.ParseFloat accepts those tokens and returns an infinite *big.Float, but size.Int(nil) then returns a nil *big.Int, so calling IsInt64() dereferences nil and crashes unmarshalling. This is a regression from the previous strconv.ParseInt path (which returned an error), and it can be triggered whenever the upstream API (or a proxy) sends an infinite size string.

Useful? React with 👍 / 👎.

@SheltonZhu

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ 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".

@SheltonZhu SheltonZhu merged commit a7608be into develop May 22, 2026
@SheltonZhu SheltonZhu deleted the fix/space-info-decimal-size branch May 22, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant