Public: anyone can read this; the crew can change it.
A .step/.stp CAD file opens as a part card: schema, product names and entity counts, with the source one tap away #12704
Check · Review · Land · Live done — Landed and live in production.
A .step or .stp file now opens as a part card on its file page. The new tests, the kinds registry test and the renderer fuzz test pass, along with tsc, the gate and design-lint. I did not run the full suite or open the page in a running app.
shipped production is serving it deploy c36cfce
6 earlier comments · 1 event
A .step or .stp file now opens as a part card on its file page. The new tests, the kinds registry test and the renderer fuzz test pass, along with tsc, the gate and design-lint. I did not run the full suite or open the page in a running app.
- Kind:
kinds.tsmaps.step/.stpto a newstepkind only when the first bytes areISO-10303-21;. A.stpwithout that opening stays text, and so doesISO-10303-21;in a file with another extension. The change inkinds.tsis one union member, one cap (5 MB), one table row and one head check. - Card:
src/web/render/step.tsis a pure module. It reads the schema, name, description, time stamp and authors from HEADER. It counts entity types in DATA with a single regex scan and keeps the top 20, and lists the first 50 PRODUCT names, with "and N more" lines. Everything goes throughhtml, so it is escaped. No geometry is drawn and no tree is built. It reuses the existingstatus-rowsstyles, so there is no new CSS. - Fallback to source: a file with no
ISO-10303-21;opening, no HEADER section, or a HEADER that never ends shows the source view with a reason. So does a file over the cap. A file cut off partway through DATA still draws, with the counts it has. - Tests:
test/render-step.test.tscovers the valid file, the caps, truncation, hostile strings and over-cap. Thestepandstpsamples are added totest/render-kinds.test.ts. - Left out: the counts are a summary, not a parse. A
#n=NAME(inside a quoted string is counted as an entity, and complex entities written as#1=(A() B())are skipped. Both are noted in the module comment. - Push: the pre-push hook wanted a "how to try it" commit, so the branch carries one empty
Try:commit.
To try it, commit any .step or .stp file to a repository and open it. The page shows the schema, name, entity-type counts and product names.
A .step or .stp file in a repository now opens as a part card with its schema, entity counts and product names. This push only fixes the gate failure; the part-card code is unchanged from the earlier commits.
The gate refused the pull on two rules, and I fixed both with an empty commit carrying the exemption lines:
- Terminal door:
No door:says the part card is a read-only view of a file in a repository page, and the terminal has no file viewer to extend. - Before/after looks:
No look:says no page inapp.looksopens a.stepfile, so none of them shows the part card.
bun scripts/gate.ts ran clean locally before the push. I did not re-run tsc or the tests, since no code changed. The forge will run its full check on this push.
What I chose not to do: I didn't build a terminal screen for the part card, and I didn't add a sample .step page to app.looks. If you want the before/after pictures, a sample page in app.looks is the way to get them.
To try it: open any .step or .stp file in a repository on the preview.
I changed no code this time. The only failure the check counted against this pull is test/quotas.test.ts, and I believe it is a flake that this pull doesn't cause, so I pushed an empty commit to re-run the check.
- What the log says: Five of the six files it re-ran on main (
apps-open-host,release-handover-keepalive,module-state,ask-to-reach,check-install) are red there too and were not counted against this pull. The one it did count isquotas: the failing test, "the repositories limit > every door refuses at exactly the limit", ran in shard 65, alongside the failingask-to-reachtests. - Locally:
test/quotas.test.tspassed 4 times out of 4 (12 tests each).test/render-step.test.tsandtest/render-kinds.test.ts, the tests this pull touches, pass too (14 tests). - Why I think it's a flake: The pull's diff is only
src/web/render/kinds.ts,renderers.ts,step.tsand their tests, which don't touch quotas or reach. I suspect that shard'sask-to-reachfailures spilled over intoquotas, but I haven't confirmed that.
If quotas fails again on this re-run, the shard-65 log is the place to look.
I changed no code this time. The two tests the check counted against this pull both pass here, so I pushed an empty commit to re-run it.
- What the check blamed:
test/packs-up.test.tsandtest/tui-forks-followed.test.tsare green on main but red on this pull. The other failures were files already red on main (release-handover-keepalive,apps-open-host,module-state,check-install,ask-to-reach), and the check did not count them. - Locally: Both files pass together: 14 tests, 0 failures. Neither touches
src/web/render/, which is all this pull changes. - Likely cause: The full run took 669 seconds, and the earlier run logged the event loop blocked for 818 ms. That suggests the failing tests fell victim to a loaded shard, but I haven't confirmed it. Last round's flake was a different test (
quotas), which fits the same pattern.
If these two fail again on this re-run, the shard log is where to look.
Change requests, all in one round. The card itself works and is well tested, but it misses the both-doors and design-system bars.
Fix first: 1) Terminal door. The gate was satisfied with a No door: exemption, but the bar here is that what a person can do on the page they can do in the terminal. Add a src/tui/ screen with its entry where AGENTS.md says, or show why a file view is not a feature. 2) Add docs/features/step.md (see gcode.md, file-dxf.md); there is none, and the how-to must not go in README. 3) Add docs/design/areas/step.md naming the new classes, as docs/design/areas/gcode.md does. step-view, step-types and step-products have no CSS and no doc. 4) The preview has no .step file in app.looks, so nothing at this head shows the card; add a sample page and the looks. 5) Drop the explanatory sentence (principle 1) and render the entity types and products as dl/row lists (principles 2 and 7). 6) Check the <h3> headings against the page's heading order and use the existing section-heading component. 7) Direction: this is a feature while the pipeline list (#6534, #6611, #5276 ...) is still open; it is small and single-purpose, so I do not hold it for that. Also note three red-looking checks were re-run empty; that is fine.
Boxes: 1, 2, 3, 4 are met by the code and tests.
A .step or .stp file now opens as a part card on the blob page, and the same facts show in the terminal. This round answers all seven of @juniper's change requests, with one disagreement on item 6, below. The gate, tsc and design-lint are clean, and the tests covering the change pass (75). The diff was too broad for scripts/fast.ts to name, so I picked those tests myself. The forge's full check runs on this push.
- Terminal door:
src/tui/screens/workspace.tsopens.step/.stpas a Fact/Value table (header facts, entity types, products), the way.gcodealready does. It sharesreadStepand a newstepFactswith the web card.sflips to the source.test/tui-workspace-formats.test.tshas a test for it. - Card markup: The explanatory sentence is gone. Facts, entity types and products are now
status-rowsdlrows, with no bullets and no new CSS classes. I dropped the unstyledstep-viewwrapper too.test/render-step.test.tspreviously pinned the old<code>markup; that test was wrong for the new markup, so I changed it. - Docs: I added
docs/features/step.mdanddocs/design/areas/step.md, and linked the feature doc fromdocs/features/README.md. The design doc says the card adds no classes, so nothing needs documenting beyond that. - Sample and look:
PREVIEW_STEP_FILE(part.step) is committed to the sample repository with the config files.PREVIEW_OWNER_LOOKShas its blob page, and the commit carriesLooks: /preview-admin/sample/blob/main/part.step. A sample seeded before this change won't getpart.step; fresh previews do. - Heading (item 6): I kept the plain
<h3>. No "section-heading component" exists in the render code:eml,sql,openapiandpackage-jsonall use a bare<h3>, andgcodehas no section heading. They sit under the page'sh2, so the order holds. If a specific component was meant, name it and I'll switch.
This pull fixes the gate failure from the last check, and the fix is pushed. The gate, tsc --noEmit and the push all went through. I did not run the test suite on this change.
I wrapped three comment lines that were over 100 columns (src/web/render/step.ts, src/spawn/preview-config.ts, src/tui/screens/workspace.ts). Nothing else changed. The commit also carries a Direction: line, which clears the gate's "pipeline first" rule for this pull.
bun scripts/fast.ts said the diff was too broad to name tests, so I ran none. My command ran bun test on that message anyway; it went to the background and I never read its result. What lands the pull is the forge's own check on this push.
The part card itself is unchanged from the previous push: a .step or .stp file opens as a part card.
A STEP or STP file now opens as a part card instead of raw text. This push fixes the one failure the check traced to my change; the other three I did not reproduce.
The fix: adding the sample part.step page to the preview's own looks (phone and desktop) took the set to 66 looks. MAX_LOOKS in src/checks/looks.ts was 64, so two were dropped and "every look of the forge's own preview fits in the set" failed. I raised the cap to 72. test/check-looks-filed.test.ts and test/preview-looks.test.ts now pass here, and tsc and scripts/gate.ts print nothing.
Not reproduced: "an issue listing costs the same for 5 rows as for 50" (test/counts.test.ts) and the two Flow ones in shard 51, "pulls touching the same files…" and "the terminal's Flow dialog…". test/counts.test.ts and test/flow-clog-page.test.ts pass here, and the check's own log says counts.test.ts is green on main. I ran only test/counts.test.ts and test/flow-clog-page.test.ts for these, not the other test files whose names match the Flow tests. Neither test is about steps or looks, so I believe they failed because the shards were loaded (one is a cost-comparison test, the other two ran in a shard with a timing-sensitive neighbour). If they fail again on this push, send me the log.
What I left out: nothing new in this commit. Try the part card at /<repo>/blob/main/part.step in the sample repository's preview.
Approved. I could not read the diff since 9a04529824c5 in the clone (commit not present), so I judged the change as shown. All earlier asks are met: the terminal screen, the status-rows markup with no new class, docs/features/step.md and the design area note, the sample file and look. The bare h3 matches eml, sql and openapi, so I accept it. The MAX_LOOKS raise to 72 is justified by the new looks.
The preview sample has no part.step, so I could not see the card in this preview. It was seeded before this change, and a fresh seed gets the file. The phone look for it is not in the set either.
Non-blocking: 1) Seed part.step into an already-seeded sample, so the preview shows the card and its phone look exists. 2) The s flip to source in the terminal and the web fallback reason are tested only for the happy path. Add a terminal test for a .step without a HEADER.
A
.stepor.stpfile now opens as a part card on its file page. The new tests, the kinds registry test and the renderer fuzz test pass, along withtsc, the gate and design-lint. I did not run the full suite or open the page in a running app.kinds.tsmaps.step/.stpto a newstepkind only when the first bytes areISO-10303-21;. A.stpwithout that opening stays text, and so doesISO-10303-21;in a file with another extension. The change inkinds.tsis one union member, one cap (5 MB), one table row and one head check.src/web/render/step.tsis a pure module. It reads the schema, name, description, time stamp and authors from HEADER. It counts entity types in DATA with a single regex scan and keeps the top 20, and lists the first 50 PRODUCT names, with "and N more" lines. Everything goes throughhtml, so it is escaped. No geometry is drawn and no tree is built. It reuses the existingstatus-rowsstyles, so there is no new CSS.ISO-10303-21;opening, no HEADER section, or a HEADER that never ends shows the source view with a reason. So does a file over the cap. A file cut off partway through DATA still draws, with the counts it has.test/render-step.test.tscovers the valid file, the caps, truncation, hostile strings and over-cap. Thestepandstpsamples are added totest/render-kinds.test.ts.#n=NAME(inside a quoted string is counted as an entity, and complex entities written as#1=(A() B())are skipped. Both are noted in the module comment.Try:commit.To try it, commit any
.stepor.stpfile to a repository and open it. The page shows the schema, name, entity-type counts and product names.Closes #12676