Repository navigation
fix(test): 手元の build・verify で node-llama-cpp のモデルを読み込まない - #244
Merged
Merged
Conversation
#225 で手元の LLM サーバーを呼ぶテストを MSA_LOCAL_LLM_TESTS=1 の opt-in にしたが、 node-llama-cpp で判断モデルを読み込むものは既定のまま残っていた。 - vp run build-binaries は、host の archive の msa で #171 の decide smoke を毎回流し、 stories260K.gguf を読み込んで推論していた。 - 既定の vp test(verify の test-all)でも、6 ファイル 14 本のテストが node-llama-cpp を import し、うち多くが stories260K.gguf を読み込んで推論していた。 ## 直し方 - @msa/testing に localLlmTests を足し、MSA_LOCAL_LLM_TESTS の判定をここ 1 か所にした。 libs/ai/test/local-llm-support.ts もこれを使う。 - node-llama-cpp を import するテストを it.skipIf(!localLlmTests) にした。読み込みに失敗する ことを確かめるテスト(missing.gguf、404 の download)も node-llama-cpp を import して llama-addon.node を読むので、同じ扱いにした。 - 再発防止として、libs/ai と apps/coding-agent の vitest に setup を足し、opt-in なしでは node-llama-cpp を mock に差し替える。mock は getLlama などで 「gate the test with it.skipIf(!localLlmTests)」と投げるので、付け忘れたテストは モデルを読まずにこの理由で落ちる。setup は node-llama-cpp を解決できる libs/ai/test に置いた (リポジトリ直下からは node-llama-cpp を解決できず、mock の id が合わないため)。 - build-binaries は、MSA_LOCAL_LLM_TESTS が無いと decide smoke を飛ばし、その旨を出す。 msa --version の確認はこれまでどおり手元でも流す。 ## #171 の確認をどこで続けるか CI で続ける。verify.yml の verify ジョブと binary ジョブ、release.yml の build に MSA_LOCAL_LLM_TESTS=1 を付けた。binary ジョブは linux-x64 の archive で decide smoke を流し、 release の smoke ジョブは 3 OS でこれまでどおり smoke-binary-decide を直接流す。CI には 手元の LLM が無いので、node-llama-cpp のテストと smoke を流しても手元の LLM は動かない。 *-local.test.ts は CI でも、Ollama・LM Studio・llama.cpp のサーバーを見つけられず skip になる。 モデルを読み込む手前までの検査を手元に残す案は取らなかった。bun バイナリで判断モデルが 動くことは #214 で読み込み・推論の段で壊れた不具合なので、読み込みの手前では確かめられず、 CI で実際に推論させる方が #171 の目的に合うため。 ## 確かめた結果 この Mac(Ollama と llama-server が動いている)で、環境変数を付けずに `vp run build-binaries darwin-arm64` と `vp run verify` を流し、0.1 秒ごとに lsof で node・msa・bun が開く .gguf・llama-addon.node・libllama・libggml と、11434・8081・1234 番への 接続を記録した。 | 実行 | 直す前 | 直した後 | | --- | --- | --- | | build-binaries | msa が stories260K.gguf と llama-addon.node を開いた | 0 件 | | verify | node が stories260K.gguf を 2 回、llama-addon.node を 7 回開いた | 0 件 | 直した後は Ollama のログの [GIN] 行も増えなかった(53276 行のまま)。build は 「skipping the node-llama-cpp decide smoke test」を出して通った。 node の resolve hook で node-llama-cpp の解決を記録して `vp test run` を全体で流すと、 直す前は 6 ファイルのテストが node-llama-cpp を import し、直した後は 0 件だった。 opt-in を 1 本外すと、そのテストは setup の mock の理由で落ち、node-llama-cpp は import されなかった。 CHANGELOG は msa と各 package の利用者向けで、この変更は利用者から見える挙動を変えないので 項目を足していない(#225 の opt-in 化も同じ扱い)。AGENTS.md・README・libs/testing の README・test.sh のコメントを合わせた。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
手元の
vp run build-binaries・vp run verify・bash test.shは、MSA_LOCAL_LLM_TESTS=1を付けない限り node-llama-cpp を読み込まない。build-binariesは環境変数が無いと、判断モデルの smoke(bun バイナリで判断モデル(node-llama-cpp)を動かす #171)を飛ばす。msa --versionの確認は手元でも続けて流す。it.skipIf(!localLlmTests)にした(@msa/testingのlocalLlmTests)。libs/ai・apps/coding-agentの vitest setup が、opt-in なしでは node-llama-cpp を mock に差し替える。opt-in を付け忘れたテストは、モデルを読まずに理由付きで落ちる。MSA_LOCAL_LLM_TESTS=1を付ける。確かめた結果
手元(Ollama と llama-server が動いている Mac)で、環境変数なしで流した。0.1 秒ごとの lsof で、node・msa・bun が開く
.gguf・llama-addon.node・libllama・libggmlと、11434・8081・1234 番への接続を記録した。vp run build-binaries darwin-arm64stories260K.ggufとllama-addon.nodeを開いたvp run verifystories260K.ggufとllama-addon.nodeを開いた直した後は、Ollama のログの
[GIN]行も増えなかった。node の resolve hook でvp test run全体を見ると、node-llama-cpp の import は 0 件だった。CI 側の確認は、この PR の verify と binary ジョブで、node-llama-cpp のテストと decide smoke が流れていること。