Skip to content

feat(grid): make BLOB columns readable (#401) - #632

Merged
EVWorth merged 1 commit into
mainfrom
feat/results-blob-viewer
Sep 11, 2026
Merged

EVWorth merged 1 commit into
mainfrom
feat/results-blob-viewer

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Stacked on #631.

FR-3.1.9. A BLOB arrives as an array of bytes and was rendered with String(value), so a PNG stored in a MEDIUMBLOB showed as 137,80,78,71,13,10,26,10,… — every byte, comma-separated. That is not a preview of anything.

The cell now says what the value is and how big: [image/png, 12.4 KB]. The type comes from the bytes themselves, because a result set carries no filename and no column comment to read it from.

Opening one gives the three views the requirement asks for, and which opens first is decided by the bytes. An image opens as an image; something that reads as text opens as text; anything else opens as hex — for a compiled blob the hex is the content, and dropping the user on an empty-looking text pane would suggest the value was empty.

Views that cannot say anything are not offered. An image tab on bytes no <img> can render is a broken-icon placeholder, which is worse than no tab. An SVG gets all three, since it is both. The text view decodes non-fatally, so a blob that is mostly text with one stray byte is still readable with U+FFFD marking where it went wrong.

Around the edges

  • Hex stops at 64 KB and says so. A 50 MB value is 3.2 million lines, and building them all to show the first screenful locks the window up.
  • Copy puts hex on the clipboard, not 137,80,78,71. Pasting a byte array into anything is useless; hex round-trips through UNHEX().
  • Download saves the bytes under the type they claim to be, with a matching extension. Saving a PNG as column.txt loses the only thing that made it openable.
  • Edit is disabled: there is no text form, and round-tripping one through the editor would corrupt the value.

Verification

2374 unit tests (29 on the byte helpers, 12 on the viewer, 4 on the cell) and 331 browser tests. Verified against MEDIUMBLOB, BLOB and VARBINARY columns on live MySQL 8.0.46 — including confirming the old rendering was exactly what the issue described.

Also fixed two flaky assertions in ResultsGrid.test.tsx that waited on the schema call rather than on the state that follows it.

Closes #401

🤖 Generated with Claude Code

@EVWorth
EVWorth changed the base branch from feat/results-row-count to main September 11, 2026 05:16
FR-3.1.9. A BLOB arrives as an array of bytes and was rendered with
`String(value)`, so a PNG stored in a MEDIUMBLOB showed as
`137,80,78,71,13,10,26,10,…` — every byte, comma-separated. That is not a
preview of anything (#401).

The cell now says what the value is and how big: `[image/png, 12.4 KB]`. The
type comes from the bytes themselves, because a result set carries no filename
and no column comment to read it from.

Opening one gives the three views the requirement asks for, and which opens
first is decided by the bytes. An image opens as an image; something that
reads as text opens as text; anything else opens as hex — for a compiled blob
the hex *is* the content, and dropping the user on an empty-looking text pane
would suggest the value was empty.

Views that cannot say anything are not offered. An image tab on bytes no
`<img>` can render is a broken-icon placeholder, which is worse than no tab.
An SVG gets all three, since it is both. The text view decodes non-fatally, so
a blob that is mostly text with one stray byte is still readable with U+FFFD
marking where it went wrong.

Around the edges:

- Hex stops at 64 KB and says so. A 50 MB value is 3.2 million lines, and
  building them all to show the first screenful locks the window up.
- Copy puts hex on the clipboard rather than `137,80,78,71`. Pasting a byte
  array into anything is useless; hex round-trips through UNHEX().
- Download saves the bytes under the type they claim to be, with a matching
  extension. Saving a PNG as `column.txt` loses the only thing that made it
  openable.
- Edit is disabled: there is no text form, and round-tripping one through the
  editor would corrupt the value.

Verified against MEDIUMBLOB, BLOB and VARBINARY columns on MySQL 8.0.46.

Co-Authored-By: Claude Opus 5 <[email protected]>
@EVWorth
EVWorth force-pushed the feat/results-blob-viewer branch from bbf65d4 to 4c14eb7 Compare September 11, 2026 05:29
@EVWorth
EVWorth merged commit 310a7f1 into main Sep 11, 2026
12 checks passed
@EVWorth
EVWorth deleted the feat/results-blob-viewer branch September 11, 2026 05:33
@EVWorth EVWorth mentioned this pull request Sep 11, 2026
48 tasks
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.

[P1] [doc-drift] FR-3.1.9 BLOB preview (image/hex) — image/hex views missing

1 participant