Public: anyone can read this; the crew can change it.

A Blender .blend shows the version and the data blocks it holds #16536

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A .blend now opens on its blob page as its Blender version, pointer size, byte order, block count and a table of block codes with counts. I haven't captured screenshots, and nothing here shows the page in a browser.

Notes

shipped production is serving it deploy f411bbe

opened this

A .blend now opens on its blob page as its Blender version, pointer size, byte order, block count and a table of block codes with counts. I haven't captured screenshots, and nothing here shows the page in a browser. I ran tsc, gate.ts --fix, design-lint and the covering tests (417 pass, including test/mcp-size.test.ts with the ceilings untouched), but not the full suite.

What changed

  • New kind blend: registered in kinds.ts by extension plus the BLENDER signature, with a 5 MB render cap, and drawn by renderers.ts.
  • Reader: blend-read.ts handles the old 12-byte header (4- or 8-byte pointers, either byte order) and the Blender 5 17-byte header with 32-byte block headers.
  • Page: blend.ts shows a codes table such as "Objects (OB)", with every value escaped and no script on the page. It reads only the file and block headers, never block contents.
  • Hostile files: the walk hops block to block by their own lengths, each hop is at least 20 bytes, and a length that lies makes the file unreadable. At most 64 distinct codes are kept; the rest go into "Other codes". Over the cap or unparseable files keep the source view with one line saying why.
  • MCP: the existing read_file tool carries about: {kind: "blend", version, pointerSize, endian, blocks, codes, other, says}. No new tool.
  • Terminal: the workspace shows the same facts through the new blend-note.ts.
  • Tests:
    • A SAMPLES entry in test/fuzz-renderers.test.ts, which also satisfies the random-bytes case.
    • test/render-blend.test.ts covers parse, escape, cap, malformed, a hostile flood of distinct codes, and the terminal note.
    • Tests for the read_file about, render-kinds and docs guards.
    • test/helpers/blend.ts builds sample files.
  • Reuse: bun scripts/similar.ts was not run. I copied the shape of the GIMP (.xcf) renderer, including its status-rows markup and the psd-view class.

Moved, not extended: .blend left the CAD header-facts kind, so binary-facts.ts now covers only .dwg and .fbx. Their tests and docs were updated.

Left out

  • Gzip- or zstd-compressed .blend files are not decompressed and stay plain binaries.
  • No object names, no editing, and no reading of the SDNA struct catalogue.
  • Files over 5 MB get the source view rather than a head-only read, because block headers are spread through the whole file.
  • No screenshots and no tab-by-tab check against a running preview.

Pre-push hook: it required a Try: commit, so one empty commit carries it.

To try: push a .blend (for example BLENDER-v404 plus blocks) to a repository and open it on its blob page.

[
  {"go": "/<owner>/<repo>/blob/main/scene.blend", "look": "Facts rows (Version, Pointers, Byte order, Blocks) and a Blocks by code table", "expect": "Version 4.4, 64-bit, Little-endian; rows like Objects (OB) with counts"},
  {"go": "/<owner>/<repo>/blob/main/cut.blend", "look": "A .blend whose block length lies past the end", "expect": "Source view with the line 'not a readable Blender file'"}
]

🤖 Generated with Claude Code

Closes #16023

9 earlier comments · 2 events
commented

A .blend now opens on its blob page as its Blender version, pointer size, byte order, block count and a table of block codes with counts. I haven't captured screenshots, and nothing here shows the page in a browser. I ran tsc, gate.ts --fix, design-lint and the covering tests (417 pass, including test/mcp-size.test.ts with the ceilings untouched), but not the full suite.

What changed

  • New kind blend: registered in kinds.ts by extension plus the BLENDER signature, with a 5 MB render cap, and drawn by renderers.ts.
  • Reader: blend-read.ts handles the old 12-byte header (4- or 8-byte pointers, either byte order) and the Blender 5 17-byte header with 32-byte block headers.
  • Page: blend.ts shows a codes table such as "Objects (OB)", with every value escaped and no script on the page. It reads only the file and block headers, never block contents.
  • Hostile files: the walk hops block to block by their own lengths, each hop is at least 20 bytes, and a length that lies makes the file unreadable. At most 64 distinct codes are kept; the rest go into "Other codes". Over the cap or unparseable files keep the source view with one line saying why.
  • MCP: the existing read_file tool carries about: {kind: "blend", version, pointerSize, endian, blocks, codes, other, says}. No new tool.
  • Terminal: the workspace shows the same facts through the new blend-note.ts.
  • Tests:
    • A SAMPLES entry in test/fuzz-renderers.test.ts, which also satisfies the random-bytes case.
    • test/render-blend.test.ts covers parse, escape, cap, malformed, a hostile flood of distinct codes, and the terminal note.
    • Tests for the read_file about, render-kinds and docs guards.
    • test/helpers/blend.ts builds sample files.
  • Reuse: bun scripts/similar.ts was not run. I copied the shape of the GIMP (.xcf) renderer, including its status-rows markup and the psd-view class.

Moved, not extended: .blend left the CAD header-facts kind, so binary-facts.ts now covers only .dwg and .fbx. Their tests and docs were updated.

Left out

  • Gzip- or zstd-compressed .blend files are not decompressed and stay plain binaries.
  • No object names, no editing, and no reading of the SDNA struct catalogue.
  • Files over 5 MB get the source view rather than a head-only read, because block headers are spread through the whole file.
  • No screenshots and no tab-by-tab check against a running preview.

Pre-push hook: it required a Try: commit, so one empty commit carries it.

To try: push a .blend (for example BLENDER-v404 plus blocks) to a repository and open it on its blob page.

[
  {"go": "/<owner>/<repo>/blob/main/scene.blend", "look": "Facts rows (Version, Pointers, Byte order, Blocks) and a Blocks by code table", "expect": "Version 4.4, 64-bit, Little-endian; rows like Objects (OB) with counts"},
  {"go": "/<owner>/<repo>/blob/main/cut.blend", "look": "A .blend whose block length lies past the end", "expect": "Source view with the line 'not a readable Blender file'"}
]

🤖 Generated with Claude Code

commented

<!-- look-pages 5dfb596e9486 --> Look pages for 5dfb596, from the gate:

  • look pages (inferred): this pull changes src/web/render/kinds.ts, src/web/render/renderers.ts, src/web/render/torrent.ts; the forge pictures / (src/web/render/kinds.ts), /docs (src/web/render/kinds.ts), /explore (src/web/render/kinds.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

No defect found and nothing changed, so I pushed nothing. No check of the head is recorded as failed, so the red verdict came from the forge cutting the check or re-running it, not from a test. The forge will check the head again by itself. If that run is red on a named test, send me its assertion and I'll fix it.

commented

I merged main into the branch and pushed it. The merge conflicted in two files, not the two the forge named. I ran the six test files that cover the change, plus the tsc check, and they passed. I did not run the full suite.

  • Conflicts: scripts/kinds-guide.ts and src/http/mcp/tools/read_file.ts. In both I kept the .blend entry from this branch and the .torrent entry from main.
  • Not conflicted: src/web/render/torrent.ts and test/render-torrent.test.ts merged without conflict.
  • Gate: the merge commit message carries the Direction: … (#16023) and No door: lines that the gate's "name the issue" and "both doors" rules asked for. The No door: reason is that the terminal has no file-open screen for this. The gate's remaining output after that was similarity notes. It flags blendNote, blend and ascii as close to existing xcf and binary-facts code. I did not merge them.
  • Not run: scripts/fast.ts found the diff too broad to name tests. A run on all of them was estimated at over five hours, so I started it and then ran only the six files above.
commented

<!-- look-pages 83d0aabc0afd --> Look pages for 83d0aab, from the gate:

  • look pages (inferred): this pull changes src/web/render/binary-facts.ts, src/web/render/blend-read.ts, src/web/render/blend.ts and 2 more; the forge pictures / (src/web/render/binary-facts.ts), /docs (src/web/render/binary-facts.ts), /explore (src/web/render/binary-facts.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

I made no change and pushed nothing. That comment is the gate's automatic list of look pages, not a review finding. It only names the pages that could change, and it lists 31 of them because this pull touches src/web/render/binary-facts.ts, which many routes import.

The visible change is the .blend file view, which needs a .blend file in a repository to show. None of the listed pages (/, /docs, /explore and the rest) renders one. If a reviewer wants the list narrowed, a Looks: <path> or No look: <why> line in a commit message overrides it. I did not pick a path because I have no .blend file in a repository on the forge to point at.

commented

I merged main into the branch and pushed it. The merge conflicted only in src/http/mcp/tools/read_file.ts.

I kept both sides there. The imports now include this branch's blend-read.ts and main's m3u.ts. The tool's doc string lists .blend, .torrent and .m3u.

bun x tsc --noEmit came back clean, and the five test files I ran passed (195 tests: mcp-read-file, render-blend, render-kinds, kinds-guide, fuzz-renderers). I did not run scripts/fast.ts or the full suite. The forge runs the full check on this push.

The merge commit message again carries the Direction: … (#16023) and No door: lines for the gate.

commented

<!-- look-pages 32754b1a9117 --> Look pages for 32754b1, from the gate:

  • look pages (inferred): this pull changes src/web/render/binary-facts.ts, src/web/render/blend-read.ts, src/web/render/blend.ts and 2 more; the forge pictures / (src/web/render/binary-facts.ts), /docs (src/web/render/binary-facts.ts), /explore (src/web/render/binary-facts.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
Changes requested — before the latest push

The reader is sound: lengths are bounds-checked, the code table is capped, codes are sanitised and values are escaped. Three things to fix in one round.

  1. Box 5 is not met. There are no before/after screenshots, and the review block has no pictures. The pull says none were taken. Push a real .blend to a repo on the preview, take both views (a readable file, and the source-view fallback), and attach them.
  2. There is no docs/features/blend.md. The only how-to for .blend was deleted from binary-facts.md. Add one in the format of the neighbouring pages (front matter topic and row), covering the page rows, the terminal note, the MCP about fields, the 5 MB cap, and that compressed files stay binary. Keep it out of README.
  3. Principle 1: the page explains itself twice. See the comment on blend.ts.

Also reuse the status-rows and dl markup as it stands, but drop the borrowed psd-view wrapper class. Use a neutral wrapper or none.

commented

I fixed points 2 and 3 and pushed. Point 1, the screenshots, is not done: there are still no before/after pictures and the review block still has none.

tsc, design-lint and the render-blend, render-kinds, docs-index and docs-link tests pass. I did not run the full suite.

  • Docs (point 2): I added docs/features/blend.md with the front matter and the layout of psd.md. It covers the page rows, the terminal note and the MCP about: {version, codes} fields. It also covers the 5 MB cap, the 64-code cap, and that gzip/zstd-compressed files stay binary. Nothing was added to the README.
  • Page (point 3): in src/web/render/blend.ts I removed the "block contents are not opened" footnote and kept the "no closing block" line. I also replaced the psd-view wrapper with a plain <div>. The status-rows and dl markup is unchanged.
  • Screenshots (point 1): I can't push a .blend file to a repository on the preview, and I have no browser to take the two views. The commit message has a No look: line giving that reason. To finish it, someone can push a real .blend (and a compressed one for the source-view fallback) to a repository on the preview and attach both views.
  • Look pages: the gate's inferred list comes from binary-facts.ts, which many routes import. No listed page shows a .blend, which is why I used No look:.
Approved

Earlier asks: docs/features/blend.md is added and README is untouched (met). The psd-view wrapper and the second footnote are gone from the page (met). Before/after screenshots are still missing, and torque says no .blend can be pushed to the preview from here. Non-blocking: attach a before/after of a real .blend and one compressed-file fallback once someone can push one.

I read the reader again. The walk checks every block length against the bytes left, steps at least 20 bytes a turn, caps distinct codes at 64, and escapes codes and names. The renderer is registered by extension plus signature, with a 5 MB cap. MCP read_file carries about, and the terminal has its own note. Tests cover parse, escape, cap, malformed and a code flood, and the fuzz sample is added. No new dependency. No security findings.

commented

Left #16023 open: 1 unticked item remain (The new test file is found by the gate list; bun scripts/design-lint.ts is clean; the pull carries a review block with before/after screenshots.).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs