Repository navigation
Studio: make the mmproj fallback import resolvable under node's type stripping - #9181
danielhanchen wants to merge 1 commit into
Conversation
…stripping tests/queued-model-capabilities.test.ts imports image-input-support.ts directly, and that file imports ./mmproj-fallback without an extension. Node's --experimental-strip-types does not do extension resolution, so the whole test file dies with ERR_MODULE_NOT_FOUND rather than failing an assertion. The import only became reachable from a node test when getImageInputUnavailableReason was added to that test's imports, which is why it surfaced now. 46 imports under src/ already carry an explicit .ts for the same reason.
|
Closing this one as subsumed, and I want to be clear that it is not a rejection on substance: your fix is correct and it is the fix that is landing. Four of us arrived at this independently, and #9181, #9192, #9200 and #9220 all carry the same change, byte for byte: -import { isTextOnlyMmprojFallback } from "./mmproj-fallback";
+import { isTextOnlyMmprojFallback } from "./mmproj-fallback.ts";Your diagnosis was right too. I reproduced it on a clean The reason the vehicle is #9220 rather than this PR is only scope. One thing worth recording for the future, since it argues mildly against the fix we are both shipping. Thanks for catching it and for the clean reproduction. Please reopen if you think the scope argument is wrong. |
npm testis red onmainright now.tests/queued-model-capabilities.test.tsdoes not fail an assertion, it dies on module resolution, so the whole file's 4 tests never run.The file it cannot find is there. The problem is the extension:
image-input-support.tsimports./mmproj-fallbackwith none, and Node's--experimental-strip-typesdoes not do extension resolution, so it looks for a file called exactlymmproj-fallbackand gives up.That import has been extensionless for a while without anyone noticing, because nothing reached it from a Node test. It became reachable when
getImageInputUnavailableReasonwas added totests/queued-model-capabilities.test.ts's imports in #9173, which is why it surfaces only now.Reproduced on a clean checkout of
mainat077593612with nothing else applied:npm testreports✖ tests/queued-model-capabilities.test.ts, and running that file alone gives theERR_MODULE_NOT_FOUNDabove.tests 4, pass 4, fail 0.The fix is the extension. There are already 46 imports under
src/carrying an explicit.tsfor exactly this reason, so this follows what is there rather than introducing a new convention. The alternative, making the test import the module dynamically the waytests/delete-chat-files-preference.test.tsdoes, would work too but changes a test to accommodate a source file rather than the other way round.No new test is needed here:
tests/queued-model-capabilities.test.tsis itself the guard. It is red without this change and green with it, which is how I verified the fix rather than assuming it.Found while resolving #9058 against
main. It is not that PR's, so it is not being fixed inside it.