From e0dde90cd807634a6af6a51d68515f3c6fe07839 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Nov 2026 19:29:28 +0000 Subject: [PATCH 1/2] Repro: tsci export -f glb cannot load a relative stepUrl A cadModel with stepUrl "./libraries/cap.step" loads with `tsci build --glbs`, but `tsci export -f glb` reports "Failed to load STEP from ./libraries/cap.step" (404) and writes the GLB without the model (cli#5654). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PiJ1d34GaQJAWypDADnioN --- .../export-glb-relative-step-model.test.ts | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 tests/cli/export/export-glb-relative-step-model.test.ts diff --git a/tests/cli/export/export-glb-relative-step-model.test.ts b/tests/cli/export/export-glb-relative-step-model.test.ts new file mode 100644 index 000000000..72f063e78 --- /dev/null +++ b/tests/cli/export/export-glb-relative-step-model.test.ts @@ -0,0 +1,47 @@ +import { expect, test } from "bun:test" +import { copyFile, mkdir, writeFile } from "node:fs/promises" +import path from "node:path" +import { getCliTestFixture } from "../../fixtures/get-cli-test-fixture" + +// cli#5654: `tsci build --glbs` loads a cadModel with a relative stepUrl, but +// `tsci export -f glb` passes the relative path straight to the GLB converter, +// which cannot fetch it. +const circuitCode = ` +export default () => ( + + + +)` + +test( + "export glb loads a cadModel with a relative stepUrl", + async () => { + const { tmpDir, runCommand } = await getCliTestFixture() + await mkdir(path.join(tmpDir, "libraries")) + await copyFile( + path.join(import.meta.dir, "../assets/SW_Push_1P1T_NO_CK_KMR2.step"), + path.join(tmpDir, "libraries/cap.step"), + ) + await writeFile(path.join(tmpDir, "index.tsx"), circuitCode) + + const { stderr } = await runCommand( + "tsci export index.tsx -f glb -o export.glb", + ) + + expect( + [...stderr.matchAll(/Failed to load STEP from [^:]+/g)].map( + ([message]) => message, + ), + ).toMatchInlineSnapshot(` + [ + "Failed to load STEP from ./libraries/cap.step", + ] + `) + }, + { timeout: 60000 }, +) From fcee0366d6cc9b5fa120fde3edd367b86809f224 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 19 Nov 2026 20:14:48 +0000 Subject: [PATCH 2/2] Repro: snapshot the exported GLB Renders the GLB from `tsci export -f glb` to a PNG snapshot. The relative STEP model fails to load, so the part shows as a placeholder box. The model file is renamed to model.step, since the asset is a push button. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PiJ1d34GaQJAWypDADnioN --- .../export-glb-relative-step-model.snap.png | Bin 0 -> 3441 bytes .../export-glb-relative-step-model.test.ts | 24 ++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 tests/cli/export/__snapshots__/export-glb-relative-step-model.snap.png diff --git a/tests/cli/export/__snapshots__/export-glb-relative-step-model.snap.png b/tests/cli/export/__snapshots__/export-glb-relative-step-model.snap.png new file mode 100644 index 0000000000000000000000000000000000000000..81e498d22b35346663a1a48a39a8bba8dbea9afe GIT binary patch literal 3441 zcmd5;`&Uy}7Cs>gR3zxqRs{pLwAvY`q8)h{jDT1Wtq6jMAW2-GIVTLz^q-B<|V+#l*0nsEbIzkd5QMo221m>Ll4fDg?wX#TP5gSQsBiYmfi$d# zDcv5RUL5>#c3W+Cm*MohO!Tv6OaN*A&z{kng1Ktbob^B$0c@9#n|sAFH_&m7HzTqg z2b>$Ee#V>>RI8zhYHdl_Av6a4HE5qk}M_fW~+F=1@af*lmp?ERaFt}wf z(_nOwM=(IkB^wEsvy5zRmD+COBNZtKFEKO&bicq}3?e@wp2=w4)f9j5G~O#se^yEX)^gvLp=2o= zB-gnKTdFAg!Ix7Je-(+;9{@ayv&T}WUIVE5qQ5-rrsRTJRpbE{UFwR9t>)gJ{hdX2 zSxfQSslS2Q7KN1go*7Cqv@XeUC%>!`sWMm5N?9E-1@-FB<=M00!@2fpnRVinlB%Xl zYj8m#?yY;NT(x^)4`l+}8H(IHATBNt&ae4Hs1B7s!peu<7$5f63nJebFfTKmd~0@& z)Uek$Io!hv0NcOt@|V`|^tXH8Jd)*LrvqggAK>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MiQp*xW8|Glq~#)*bKTboKfnbE5xhsQal$^dH_kk-&p6>4920scdhOHuqQs1= zX{AV-`ML^KSWM+SGr%$wC#IwzE+&pCM!^zKWTUFwUL0}})iAlbo>aFNo&O=kC(SJR zo=7LvN_fjcCFM6X>Mdz0;(eSxBa9V!sB2^k3?0o$a8~%xWK(fh6@?3GN6;rC>4!PkB@^t5W;Xf`k-jDl zS7Y9IS~wS)DpC@0_!F$lg;s)8wlFRtmDnP=3sRY%sYNP{?wt2gvsswHNRk zggV^1-X1R-pfQHp4`sU57}&Z^G>)~NbW2O z%7WoW!$V<=)w5Q_Z1j|u&>?g9)E36>Qk8l&=Mw5n^Wa${lr8=Y_`rQAtgNuZ;-*j& z0P{Z7rHJ$s!us^y1TS|Z;&Un`LZbn*4j%7{U5`-8Vm}b7x^lOn^1hx_1qTmTIgWm; z)*#R5AV5_qIJmRN>PcI>noy)Dur?7!BJg_akr@Qm9ziDmVgT64IHoXI%cLlm6p-^d zEHY{5@y5umnqF5>mIymS82Z_8xv74D3^pLbK6(kMYOgVu00f9IoY;w6kKpC)$c!U4 zBXccYz7O#yN7uthJKDkK1|&Vx#MrGKnOq6JM&H5m@l4`SAlA8v^97s;;oz3UrSCgS zz|n4?`nF0(K1@py1f#JGn(ZR=ISK+m#~oyLex~{`EkUpWbO;GA%SidD4TvWin3oYp z>q)FsCv7k=#~~GLaT7u}0P{*@elK<|UIomF$SfIX^zW)+F97rB$hv* zp1AZk`KM*VQ4}}M9jH3(W zu!v785U&~!dWV{&2f2(`2ML7J;S9iNV6y=&JUZ_WV99j>f2Ze{F3kyB1tj5$yngr! zfQ^4!qnkerXw{wgr(tg3%-{&T9q}OVyG)L~0C3#$!{m-Ypex$s{}j&b|BEN@b>UES V#_{dz!iG_}m@i^?HSMH*|6h3rZTJ8H literal 0 HcmV?d00001 diff --git a/tests/cli/export/export-glb-relative-step-model.test.ts b/tests/cli/export/export-glb-relative-step-model.test.ts index 72f063e78..d1a89ce89 100644 --- a/tests/cli/export/export-glb-relative-step-model.test.ts +++ b/tests/cli/export/export-glb-relative-step-model.test.ts @@ -1,11 +1,12 @@ import { expect, test } from "bun:test" -import { copyFile, mkdir, writeFile } from "node:fs/promises" +import { copyFile, mkdir, readFile, writeFile } from "node:fs/promises" import path from "node:path" +import { renderGLTFToPNGFromGLB } from "poppygl" import { getCliTestFixture } from "../../fixtures/get-cli-test-fixture" // cli#5654: `tsci build --glbs` loads a cadModel with a relative stepUrl, but // `tsci export -f glb` passes the relative path straight to the GLB converter, -// which cannot fetch it. +// which cannot fetch it, so the part renders as a placeholder box. const circuitCode = ` export default () => ( @@ -13,11 +14,20 @@ export default () => ( name="C1" capacitance="100nF" footprint="0402" - cadModel={{ stepUrl: "./libraries/cap.step" }} + cadModel={{ stepUrl: "./libraries/model.step" }} /> )` +/** Fixed camera above the 10 mm board, looking at its center. */ +const GLB_SNAPSHOT_CAMERA = { + camPos: [9, 15, -10] as [number, number, number], + lookAt: [0, 0, 0] as [number, number, number], + fov: 50, + width: 480, + height: 320, +} + test( "export glb loads a cadModel with a relative stepUrl", async () => { @@ -25,7 +35,7 @@ test( await mkdir(path.join(tmpDir, "libraries")) await copyFile( path.join(import.meta.dir, "../assets/SW_Push_1P1T_NO_CK_KMR2.step"), - path.join(tmpDir, "libraries/cap.step"), + path.join(tmpDir, "libraries/model.step"), ) await writeFile(path.join(tmpDir, "index.tsx"), circuitCode) @@ -39,9 +49,13 @@ test( ), ).toMatchInlineSnapshot(` [ - "Failed to load STEP from ./libraries/cap.step", + "Failed to load STEP from ./libraries/model.step", ] `) + const glb = await readFile(path.join(tmpDir, "export.glb")) + await expect( + renderGLTFToPNGFromGLB(glb, GLB_SNAPSHOT_CAMERA), + ).toMatchPngSnapshot(import.meta.path) }, { timeout: 60000 }, )