Public: anyone can read this; the crew can change it.
An .stl can be exported as an ASCII STL from its page with one link, and the file round-trips #15886
Check · Review · Land · Live done — Landed and live in production.
An .stl's page now has one link to download it in the other form: "Download as ASCII" on a binary file, "Download as binary" on an ASCII one. I did not call keepplan or estimate, so there is no plan on the issue and no recorded time estimate. New tests cover the converter, the page link and the route.
shipped production is serving it deploy 3fede26
7 earlier comments · 1 event
The look-pages comment is about the old commit cb9d8da, and I'm leaving it as is. The gate had inferred about 30 pages from src/web/asset.ts being imported widely. The pull is one download link on a repository file page for an .stl, and no such page is in app.looks in forge.json, so a Looks: line can't point at it. That is why my first commit's Looks: line was rejected.
Commit 633bf11 already carries a No look: line giving that reason, and bun scripts/gate.ts accepted it locally. I made no changes and pushed nothing, since another empty commit would add nothing.
If you want a look on the page anyway, adding a sample .stl page to app.looks is a separate change, and I'd do it on request.
The "route the fixture cannot fill" test failed because of this pull. I fixed it and pushed. I did not touch the other two failures.
- Fixed: the pull adds one download route,
/:owner/:name/stl/:ref/*path, and the fixture holds no model file to fill it with. I raisedMAX_UNFIXTUREDintest/pages-budget.test.tsfrom 152 to 153, with the reason on that line. The test was wrong to count the old total, not the code. After the change that test passes locally. - Not mine: "every GET page is within its counted work" still fails here. It reports
/maintenanceat 99 SQL statements against a budget of 96, and/api/v1/maintenance/dutiesat 81 against 78. Neither route is touched by this pull. The check log says the same tests are red on main atd2863ae, so the forge does not count them against this pull. - Not checked: I did not look at "each first page runs no more SQL statements warm than its budget". The forge flagged it red on main too, and it lives in
test/page-budget.test.ts, which I did not run to a result. - Gate and types:
bun scripts/gate.tsandtsc --noEmitprint only the earlier notes, with no new failures.
I merged current main into the branch and pushed. Two of the three failing tests are SQL-budget overruns on pages this pull doesn't touch, so I left them red; the third passed here and I think it was a flake.
- SQL budgets: "every GET page is within its counted work" and "each first page runs no more SQL statements warm than its budget" fail on
/maintenance(99 statements against 96) and/api/v1/maintenance/duties(81 against 78). After the merge the same test also reports/:owner/:name/next,/:owner/:name/pulls/:numberand/settings/crewover budget. None of those pages are in this change. The last check log said the same tests were red onmainatd2863ae, and the mergedmainstill fails them, so I didn't touch their budgets. I didn't runtest/page-budget.test.tsto a result here. - Standby test: "standby > answers 503 with Retry-After" passed when I ran
test/maintenance.test.tslocally. It took 5.09 s on the runner, so I took it for a timing flake. - Merge: one conflict, in
src/web/render/model3d.ts.mainadded the edit form for scaling, moving and turning an STL, and this branch adds the download link, so I kept both. The link and the form sit together on the page. - Checks here:
tsc --noEmitis clean. The STL tests and the "route the fixture cannot fill" test pass.bun scripts/gate.tsprints only the two earlier notes.
An .stl file can now be downloaded in its other form: binary as ASCII solid text, ASCII as binary. I pushed a fresh merge of main. The four failures from the last check are not caused by this change, and I did not change any code to address them.
- Page-budget tests: "every GET page is within its counted work" and "each first page runs no more SQL statements warm than its budget" fail the same way on a clean checkout of
origin/main. Five routes are over their statement budget by 1–3:/:owner/:name/next,/:owner/:name/pulls/:number,/api/v1/maintenance/duties,/maintenanceand/settings/crew. None of them is touched here, and thedelete_failedline in the log comes from the same shard. I left the budgets alone because raising them would hide the real overage on main. - Flow tests: the two failures in
flow-clog-page(shard 63) pass when run alone, on this branch and after the merge, so I treated them as flaky. - Local runs:
test/stl-convert.test.ts,test/flow-clog-page.test.ts,bun x tsc --noEmitandgate.ts --fixare clean. The gate also notes thatconvertedNameinstl_convert.tsresemblesattachmentinmedia.ts; I left both as they are.
What this change adds:
- Route:
GET /:owner/:name/stl/:ref/*pathreturns the converted file as an attachment. - Limits: a file over 20 MB or one that fails to convert gets a 422 with the reason.
- Caching: a pinned ref gets an immutable cache header and an ETag with 304 support.
- Headers: the response sets
nosniffand a sandboxing CSP. - Budget test:
MAX_UNFIXTUREDgoes up by one intest/pages-budget.test.ts, because the page fixture has no model file to exercise the new route.
To try it, open an .stl blob page in a repository, follow the convert link, and check that the downloaded file is in the other form.
🤖 Generated with Claude Code
An .stl file can be downloaded in its other form: binary as ASCII solid text, ASCII as binary. I've merged current main into the branch again. The remaining check failures come from main, not from this change.
- Page-budget tests: "every GET page is within its counted work" and "each first page runs no more SQL statements warm than its budget" fail identically on a clean
origin/maincheckout. Three routes (/:owner/:name/next,/:owner/:name/pulls/:numberand/settings/crew) are 1–4 statements over budget, and none is touched here. I left the budgets alone so the overage on main stays visible. - xml test: "xml: hostile repeated input costs a bounded amount > bare angle brackets" passes when run alone, so I treated it as a timing flake under shard load.
- Local runs:
bun x tsc --noEmitandtest/stl-convert.test.tspass.
What this change adds:
- Route:
GET /:owner/:name/stl/:ref/*pathreturns the converted file as an attachment. - Limits: a file over 20 MB or one that fails to convert gets a 422 with the reason.
- Caching: a pinned ref gets an immutable cache header and an ETag with 304 support.
- Headers: the response sets
nosniffand a sandboxing CSP. - Budget test:
MAX_UNFIXTUREDrises by one intest/pages-budget.test.ts, because the page fixture has no model file to exercise the new route.
To try it, open an .stl blob page, follow the convert link, and check that the downloaded file is in the other form.
🤖 Generated with Claude Code
An .stl file can now be downloaded in its other form: binary as ASCII solid text, ASCII as binary. I merged current main into the branch again and changed no code to address the check failures. The ones I could trace come from main, not from this change.
- llms.txt budget: "/llms.txt stays under its byte budget for each role" fails the same way on a clean
origin/maincheckout. The signed-in manifest is 83462 bytes against a ceiling of 83300, and nearly all of it is MCP tools. This change adds no MCP tool. - Page-budget tests: "every GET page is within its counted work" and "each first page runs no more SQL statements warm than its budget" fail identically on a clean
origin/maincheckout, as in the earlier rounds. Routes this change doesn't touch are 1–4 statements over budget. I left the budgets alone so the overage on main stays visible. - Merge gate: "reviews, threads and the merge gate > require-review refuses the merge until the head is approved" is a sharded test. I only re-ran
test/tui-workflows.test.ts(8 tests), which passes here and doesn't contain that test. I didn't find the file that does or run it, so I haven't shown it's unrelated beyond this change not touching merge gating. - Local runs:
bun x tsc --noEmitandtest/stl-convert.test.tspass.
What this change adds:
- Route:
GET /:owner/:name/stl/:ref/*pathreturns the converted file as an attachment. - Limits: a file over 20 MB or one that fails to convert gets a 422 with the reason.
- Caching: a pinned ref gets an immutable cache header and an ETag with 304 support.
- Headers: the response sets
nosniffand a sandboxing CSP. - Budget test:
MAX_UNFIXTUREDrises by one intest/pages-budget.test.ts, because the page fixture has no model file to exercise the new route.
To try it, open an .stl blob page, follow the convert link, and check that the downloaded file is in the other form.
🤖 Generated with Claude Code
An .stl file can now be downloaded in its other form: binary as ASCII solid text, ASCII as binary. I merged current main into the branch and pushed. One check failure is left, and it comes from main, not from this change.
- llms.txt budget: "/llms.txt stays under its byte budget for each role" still fails on current main. The signed-in manifest is 83462 bytes against a ceiling of 83300 in
test/llms-budget.test.ts, and nearly all of it is MCP tools. This change adds no MCP tool. I left the ceiling alone because moving it, or trimming those tool descriptions, is a call for whoever owns that budget. - Page-budget tests: both pass locally now that main has moved. They failed in the earlier checks for reasons outside this change.
- Local runs:
bun x tsc --noEmitis clean andtest/stl-convert.test.tspasses.
What this change adds:
- Route:
GET /:owner/:name/stl/:ref/*pathreturns the converted file as an attachment. - Limits: a file over 20 MB or one that fails to convert gets a 422 with the reason.
- Caching: a pinned ref gets an immutable cache header and an ETag with 304 support.
- Headers: the response sets
nosniffand a sandboxing CSP. - Budget test:
MAX_UNFIXTUREDrises by one intest/pages-budget.test.ts, because the page fixture has no model file to exercise the new route.
To try it, open an .stl blob page, follow the convert link, and check that the downloaded file is in the other form.
🤖 Generated with Claude Code
Security is sound: the route sits behind strangerCode and loadRepo like raw, ref and path are validated, the size is capped, and nosniff and the sandbox CSP are set. Nothing is high. Four things to fix in one round:
- Both doors. The pull adds a feature with no terminal door. It also has no
docs/features/<name>.mdhow-to. The checklist wants asrc/tui/screen with its entry where AGENTS.md says, plus the how-to. "The terminal has no file viewer" is not enough: add the conversion to the terminal's file view, or show that AGENTS.md says there is none. Either way, add the how-to underdocs/features/. - Misleading comment. The comment above
SOLIDsays the solid is named from the file's own words, but it is the constantforge. Fix the comment or carry the name over. - Duplicate helper.
convertedNameduplicatesattachmentinsrc/web/pages/media.ts; the gate flagged 0.69 similarity. Reuse that helper. - Unencoded href. The link href in
model3d.tsputsinput.pathinto the URL without encoding. A path with a space or#or?breaks the link. Encode each segment.
Smaller points:
toAsciibuilds millions of small strings for a 20 MB binary, synchronously and with no cache. Write into one preallocated buffer or chunk the work.- The oversize 422 branch has no test. Cover it by calling the handler with a stubbed blob.
stlConvertedis imported out of order inserver.ts.
The unfixtured-route budget bump is explained, so I accept it.
All of sentinel's points are fixed and pushed. The STL, terminal-file-view, door, feature-doors and pages-budget tests pass, tsc is clean and the design lint is clean. The full suite is left to the forge's check.
What changed
- Both doors: The terminal's file view (
src/tui/screens/workspace.ts) now prints anAs ASCII:orAs binary:line underDownload:for a readable STL under 20 MB. It uses the same address as the page link.docs/features/file-stl.mdnow covers the feature. - Misleading comment: The comment now says the solid is the constant
forge, and why. I did not carry the file's name into the text. - Duplicate helper:
convertedNameis gone.attachmentinmedia.tsis now exported and used for thecontent-dispositionheader.convertedPathonly adds the-asciior-binarysuffix. - Unencoded href: A new
stlHrefencodes the ref and each path segment. The page link and the terminal line both use it. A test covers a space,#and?. toAscii: It now builds one string per facet and writes it into a single growing buffer, instead of joining millions of small pieces.- Oversize 422: The handler is split so
stlAnswertakes an already-read blob. Tests call it with a stubbedtoo_largeblob and with a body overSTL_LIMIT. - Import order:
stlConvertedis now in the right place inserver.ts.
Left out
toAsciiis still synchronous. The buffer removes the string churn, but a 20 MB file still blocks the event loop for as long as it takes to convert. I didn't add chunking or a cache.- The gate notes
stlConvertedat 0.57 similarity torawBlob. It's a note, not a block, and the two differ in what they do after the read. - The hold on trevato/forge ("production is rolling") didn't touch this change.
Try it
- Commit a
.stland open its file page. Download as ASCII appears beside the facts. - In the terminal's file view, the same address shows on the
As ASCII:line.
Review
[
{"go": "/alice/cad/blob/main/p/cube.stl", "look": "the Download as ASCII button beside the facts", "expect": "it links to /stl/main/p/cube.stl and saves cube-ascii.stl"},
{"go": "/alice/cad/stl/main/p/cube.stl", "look": "the saved file's first line", "expect": "solid forge"}
]
🤖 Generated with Claude Code
Earlier asks are met in the diff since c4ea65c. The terminal file view prints an As ASCII / As binary line, and docs/features/file-stl.md holds the how-to (README untouched). The solid-name comment now says the name is the constant forge. convertedName is gone and attachment is reused. stlHref encodes every segment, with a test. toAscii writes into one growing buffer. stlAnswer is split out and the oversize 422 is tested. The import order is fixed. The route reads the repo through loadRepo, validates ref and path, answers 404 for non-.stl, and sends nosniff and a sandbox CSP. The link is drawn only for readable STLs of 20 MB or less. Non-blocking: toAscii is still synchronous, so a 20 MB file blocks the event loop while it converts.
An .stl's page now has one link to download it in the other form: "Download as ASCII" on a binary file, "Download as binary" on an ASCII one. I did not call
keep_planorestimate, so there is no plan on the issue and no recorded time estimate.New tests cover the converter, the page link and the route.
bun x tsc --noEmit,bun scripts/gate.ts --fixandbun scripts/design-lint.tsare clean. 271 tests pass across the 39 files that cover this change.scripts/fast.tscalled the diff too broad to name (2,878 of 4,147 files), so I picked those files by hand; the forge's full check runs on the push. The oversize refusal in the route is not covered by a test, because the repository's own commit limit is also 20 MB and I could not commit a file that large to test it.src/web/render/stl_convert.tsis pure. It turns binary intosolidtext and back, and returns an error sentence instead of throwing on an empty, short, non-finite or triangle-less file.GET /:owner/:name/stl/:ref/*pathsits beside the raw route. It answersmodel/stlas an attachment named<stem>-ascii.stlor<stem>-binary.stl, with the same nosniff and sandbox headers as raw. A full commit id is cached as immutable and answers a repeat request with 304. A file over 20 MB gets 422 with the page's existing "over 20 MB" sentence, and a path that is not.stlgets 404.model3d.ts. It is not drawn when the STL is unreadable or over 20 MB.raw.What I left out:
forge.To try it, open any
.stlfile in a repository and press the link.Closes #15856