Skip to content

[wrangler] Fix rendering of nested objects in R2 SQL query results#12506

Merged
petebacondarwin merged 7 commits intocloudflare:mainfrom
sesteves:sesteves/krb-146
Feb 10, 2026
Merged

[wrangler] Fix rendering of nested objects in R2 SQL query results#12506
petebacondarwin merged 7 commits intocloudflare:mainfrom
sesteves:sesteves/krb-146

Conversation

@sesteves
Copy link
Contributor

@sesteves sesteves commented Feb 10, 2026

Fix wrangler r2 sql query rendering nested objects/arrays as [object Object] in table output.

SQL functions like approx_top_k return arrays of objects. The formatSqlResults function was calling String() on all cell values, which produces [object Object] for non-primitives. Now uses JSON.stringify for object types so they display as readable JSON.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: Bug fix with no new user-facing API or config

Open with Devin

Row values containing objects or arrays (e.g. from approx_top_k) were
rendered as "[object Object]" because String() was called directly on
non-primitive values. Use JSON.stringify for object types so nested
structures are displayed as readable JSON in the table output.
@sesteves sesteves requested a review from a team as a code owner February 10, 2026 10:02
@changeset-bot
Copy link

changeset-bot bot commented Feb 10, 2026

🦋 Changeset detected

Latest commit: 5d41218

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 10, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@12506

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@12506

miniflare

npm i https://pkg.pr.new/miniflare@12506

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@12506

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@12506

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@12506

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@12506

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@12506

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@12506

wrangler

npm i https://pkg.pr.new/wrangler@12506

commit: 5d41218

@github-project-automation github-project-automation bot moved this from Untriaged to In Review in workers-sdk Feb 10, 2026
- Replace individual toContain assertions with toMatchInlineSnapshot()
  so the full table output is captured (snapshot will be auto-populated
  on first CI run)
- Add JSON.stringify replacer to convert null values inside nested
  objects to empty strings, consistent with top-level null handling
- Add a null value in the test fixture to cover this case
Use the actual API response shape including the descriptor-based schema
and real approx_top_k result values (0:961, 1:485, 2:364).
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Empty toMatchInlineSnapshot() does not auto-populate in CI. Use
toContain checks that validate the full JSON-stringified output,
consistent with the existing successful query test in this file.
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 new potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

@github-project-automation github-project-automation bot moved this from In Review to Approved in workers-sdk Feb 10, 2026
@petebacondarwin petebacondarwin merged commit e5efa5d into cloudflare:main Feb 10, 2026
33 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Feb 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants