test(distill): mock LLM 按 path 区分槽位探测与蒸馏调用

根因:19afe3b 引入 probeLLMSlots(GET /props 探本地 2B 槽位),而 mock LLM 的
handler 不检查 path、对任何请求都 calls++ ⇒ 断言「B 触发后恰好 base+1 次 LLM 调用」
被 flush 前后的两次探测撑成 base+3,TestCommitConflictGate_E2E 恒 FAIL。

修法:mock 对 /props 返回 {"total_slots":1} 且不计数 —— 探测不是「蒸馏 LLM 调用」。
不放松断言(判据本身是对的,是 mock 口径错了)。

验证:TestCommitConflictGate_E2E PASS;该包 go test 全绿。
This commit is contained in:
xiaoyi
2026-09-22 09:57:58 +08:00
parent 7c0affde65
commit a7d6625aeb
@@ -166,6 +166,14 @@ type mockLLM struct {
func newMockLLM() *mockLLM {
m := &mockLLM{}
m.server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// 2026-09-22 修:槽位探测(probeLLMSlots,GET /props)不是"蒸馏 LLM 调用",
// 不能计入 calls —— 否则 A/B 批次断言(期望 base+1)会被 flush 前后的
// 两次探测撑成 base+3。根因:5e2cc63 引入并发槽位探测后,本 mock 未按 path 区分。
if r.URL.Path == "/props" {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]any{"total_slots": 1})
return
}
atomic.AddInt32(&m.calls, 1)
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]any{