Skip to content

fix(types): isolate JSON values across reused scans - #784

Open
jay-babu wants to merge 1 commit into
stephenafamo:mainfrom
jay-babu:fix/upstream-json-scan-fresh
Open

jay-babu wants to merge 1 commit into
stephenafamo:mainfrom
jay-babu:fix/upstream-json-scan-fresh

Conversation

@jay-babu

Copy link
Copy Markdown
Contributor

JSON[T].Scan decoded into the existing value. When a scan destination is reused, nested pointers and slices retained by a previously returned row could be mutated by the next row; absent fields also survived subsequent scans.

Decode each database value into a fresh T, assigning it only after successful decoding. A SQL NULL resets the value. Ordinary UnmarshalJSON behavior is unchanged.

Validation: go test ./types, including regression coverage for retained previous rows, omitted fields, failed scans, and SQL NULL. Needed for Zeus to use Bob's existing JSON wrapper instead of model-specific scanners.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 21:12

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jay-babu

Copy link
Copy Markdown
Contributor Author

Another thing to do is upgrade to json v2 in >1.27.0, this pr would be slightly tweaked with that

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.

2 participants