Skip to content

fix: salesforce bulk upload null and numeric CSV formatting - #6923

Merged
fracasula merged 4 commits into
release/1.74.xfrom
fix/salesforce_bulk_upload_transformer
Apr 29, 2026
Merged

fracasula merged 4 commits into
release/1.74.xfrom
fix/salesforce_bulk_upload_transformer

Conversation

@ItsSudip

@ItsSudip ItsSudip commented Apr 29, 2026 •

Copy link
Copy Markdown
Member

🔒 Scanned for secrets using gitleaks 8.28.0

Description

Fixes two CSV-formatting bugs in the Salesforce Bulk Upload destination that surfaced for Fullscript while integrating against the Salesforce Bulk API.

Bug 1 — null values rendered as <nil>. A trait whose JSON value was null arrived in the CSV as the literal four-character string <nil>, because fmt.Sprintf("%v", nil) is what the writer was using. Salesforce treats this as a real text value rather than a null, polluting target fields and breaking validation rules. The fix renders top-level nulls as empty cells, which Salesforce treats as null/unset:

value1,,value3        // null in the middle field
value1,value2,        // null in the trailing field

Bug 2 — numeric values rendered in scientific notation. Because every JSON number lands in Go as float64 and %v falls back to %g, any integer-valued number with more than ~6 significant digits switched to scientific notation. So a phone number 1234567890 was being uploaded as 1.23456789e+09, and an array of IDs as [1.23456789e+09 9.87654321e+09]. The fix uses strconv.FormatFloat(v, 'f', -1, 64) for floats — same round-trip precision guarantee, never scientific notation. Arrays and maps are emitted as JSON via jsonrs.Marshal, so nested numbers also stay plain and nested nulls render as null instead of <nil>.

The formatter (FormatCSVValue) lives in router/batchrouter/asyncdestinationmanager/common so other async destinations (Bing Ads, Lytics, Marketo, SFTP, Snowpipe discards) that exhibit the same pattern can adopt it in follow-ups.

Changes

  • New common.FormatCSVValue helper that:
    • returns "" for top-level nil so CSV cells become empty
    • formats float64 via strconv.FormatFloat(_, 'f', -1, 64) to avoid scientific notation
    • emits []any and map[string]any as JSON via jsonrs.Marshal (e.g. [1234567890,9876543210], {"id":1234567890,"name":"foo"}); falls back to fmt.Sprintf("%v", v) if marshalling fails
    • falls through to fmt.Sprintf("%v", v) for every other type so existing primitives (string, bool) are byte-identical
  • Salesforce Bulk's createCSVFile now routes every cell through common.FormatCSVValue
  • New unit tests for the helper (common/utils_test.go) and end-to-end CSV tests for null cells and numeric cells (salesforce-bulk-upload/utils_test.go)

Behavior change for arrays and maps

Composite values are now serialized as JSON instead of Go's default fmt.Sprintf("%v", …) shape:

Input Before After
["Go", "Python"] [Go Python] ["Go","Python"]
[1234567890, 9876543210] [1.23456789e+09 9.87654321e+09] [1234567890,9876543210]
{"id": 1234567890} map[id:1.23456789e+09] {"id":1234567890}

Primitive cells (strings, bools, small ints, fractional floats) and null cells are byte-identical to the old output where it was already correct.

The hash-based job-to-record matching in matchRecordsToJobs is unaffected because Salesforce echoes the exact CSV cell back in success/failure records — both sides of the hash change together, and dataHashToJobID has no cross-run state.

Linear Ticket

INT-6278 — Salesforce bulk upload: Fix null and array formatting

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
@ItsSudip
ItsSudip requested a review from achettyiitr April 29, 2026 10:30
@ItsSudip
ItsSudip enabled auto-merge (squash) April 29, 2026 12:24
@fracasula
fracasula disabled auto-merge April 29, 2026 14:09
@fracasula
fracasula merged commit dec04f3 into release/1.74.x Apr 29, 2026
283 of 297 checks passed
@fracasula
fracasula deleted the fix/salesforce_bulk_upload_transformer branch April 29, 2026 14:09
fracasula pushed a commit that referenced this pull request Apr 29, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.74.1](v1.74.0...v1.74.1)
(2026-04-29)


### Bug Fixes

* salesforce bulk upload null and numeric CSV formatting
([#6923](#6923))
([dec04f3](dec04f3))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
atzoum pushed a commit that referenced this pull request May 12, 2026
# Description

Syncing patch release v1.74.1 to main branch

**↓↓ Please review and edit commit overrides before merging ↓↓**

BEGIN_COMMIT_OVERRIDE
fix: salesforce bulk upload null and numeric CSV formatting (#6923)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Sudip Paul <[email protected]>
Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
This was referenced May 12, 2026
itsmihir pushed a commit that referenced this pull request May 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.75.0-rc.1](v1.74.0...v1.75.0-rc.1)
(2026-05-12)


### Features

* snowpipe batch status
([#6926](#6926))
([f00dd89](f00dd89))
* support clickhouse day week month partitions
([#6931](#6931))
([00ff494](00ff494))
* support concurrency during partition migration flushing
([#6929](#6929))
([dd2f658](dd2f658))


### Bug Fixes

* **router:** delays in finding worker slots when event ordering is
disabled
([#6930](#6930))
([a7389f8](a7389f8))
* rsources failed keys batch fails to be inserted with postgres error
21000 ([#6940](#6940))
([3c7a1ec](3c7a1ec))
* salesforce bulk upload null and numeric CSV formatting
([#6923](#6923))
([5e67a45](5e67a45))


### Miscellaneous

* debug snowpipe streaming importing job size
([#6941](#6941))
([73d3bbe](73d3bbe))
* filtering overflow events for snowpipe streaming above 16MB
([#6921](#6921))
([2e5192b](2e5192b))
* pyt managed session
([#6910](#6910))
([c7aa7c4](c7aa7c4))
* remove deprecated fetch-tables endpoint
([#6944](#6944))
([fdb2649](fdb2649))
* sync release v1.74.0 to main branch
([#6920](#6920))
([e844f82](e844f82))
* workflow cleanup
([#6924](#6924))
([da7161d](da7161d))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
itsmihir pushed a commit that referenced this pull request May 14, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.75.0](v1.74.0...v1.75.0)
(2026-05-12)


### Features

* snowpipe batch status
([#6926](#6926))
([f00dd89](f00dd89))
* support clickhouse day week month partitions
([#6931](#6931))
([00ff494](00ff494))
* support concurrency during partition migration flushing
([#6929](#6929))
([dd2f658](dd2f658))


### Bug Fixes

* **router:** delays in finding worker slots when event ordering is
disabled
([#6930](#6930))
([a7389f8](a7389f8))
* rsources failed keys batch fails to be inserted with postgres error
21000 ([#6940](#6940))
([3c7a1ec](3c7a1ec))
* salesforce bulk upload null and numeric CSV formatting
([#6923](#6923))
([5e67a45](5e67a45))


### Miscellaneous

* debug snowpipe streaming importing job size
([#6941](#6941))
([73d3bbe](73d3bbe))
* filtering overflow events for snowpipe streaming above 16MB
([#6921](#6921))
([2e5192b](2e5192b))
* pyt managed session
([#6910](#6910))
([c7aa7c4](c7aa7c4))
* remove deprecated fetch-tables endpoint
([#6944](#6944))
([fdb2649](fdb2649))
* sync release v1.74.0 to main branch
([#6920](#6920))
([e844f82](e844f82))
* workflow cleanup
([#6924](#6924))
([da7161d](da7161d))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
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.

4 participants