Repository navigation
fix(instrument-bundler): bundle files with upper-case extensions - #1806
dyk1454683243-sudo wants to merge 2 commits into
Conversation
BUNDLER_FILE_EXT_REGEX accepts any case, but extractInputFileExtension returned the match unchanged, so inferLoader's exhaustive match threw on values like ".PNG". Lower-case the extracted extension so every consumer sees a BundlerInputFileExtension. Co-Authored-By: Grok 4.7
gdevenyi
left a comment
There was a problem hiding this comment.
Thank you for this fix. The diagnosis is correct, and I confirmed that the bundle() repro from #1798 fails on main and passes with your change.
The maintainers accept case-insensitive extension handling in the bundler. Upper-case module declarations in runtime/v1/env.d.ts will come in a separate follow-up, so you do not need to add them here.
One item before this can merge:
- Please add an end-to-end test in
testing/src/specs/playground.spec.ts. The instrument-repositories spec cannot carry a fixture, but the playground spec can. It already loads multi-file instruments from a share link withgeneratePlaygroundURL({ files: [...] })(see the test at around line 135). Use anindex.tsthat imports./stim.PNGand astim.PNGfile whosecontentis base64-encoded PNG data (the playground decodes asset files ineditorFileToInput). Then assert that the preview renders the instrument. This goes through the same path that crashed in #1798, and the repository requires an e2e test for every change.
If you hand this to Claude Code, Fable 5 is the right size — the change is in the instrument pipeline, where we use the strongest model.
Reviewed at commit b6f4077.
…ase PNG The preview loads index.ts plus a base64 stim.PNG through the same editor-to-bundler path that crashed on upper-case extensions. Co-Authored-By: Grok 4.7
|
Added the playground end-to-end test |
Instrument files whose extensions are upper case, such as
IMG_0001.JPGorstim.PNG, crash every tool that reads them withPattern matching error: no pattern matches value ".PNG".BUNDLER_FILE_EXT_REGEXis case-insensitive, so those files are accepted as inputs.extractInputFileExtensionreturned the match in its original case while typed as the lower-caseBundlerInputFileExtensionunion, andinferLoader's exhaustive match then threw. That path is shared bybundle(), the instrument-bundler CLI,serve-instrument,InstrumentReposService.readInstrumentInputs, and the playground'sinferFileType.extractInputFileExtensionnow lower-cases the matched extension, so the value really is aBundlerInputFileExtensionand every consumer treats.PNGlike.png.Tests:
packages/instrument-bundler/src/__tests__/utils.test.tsassertsextractInputFileExtension('a.PNG')is.pngand thatinferLoader('IMG_0001.JPG')isdataurl. The instrument-repositories Playwright spec cannot carry a fixture asset: importing a repository clones from GitHub, which the test environment deliberately does not do.Fixes #1798
Co-Authored-By: Grok 4.7