Skip to content

test+ci(chatcore): semanticCache HIT fixture (15/15 mutate) + 350min budget headroom for auth/accountFallback batches - #4225

Merged
diegosouzapw merged 1 commit into
release/v3.8.29from
test/qg-semantic-cache-hit
Jun 19, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.29from
test/qg-semantic-cache-hit

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

O quê

Fecha o último chatCore leaf que faltava no Stryker mutate: semanticCache.ts. Com isso, 15/15 leaves do chatCore/ passam a ser mutados na noturna.

Por quê estava de fora

O semanticCache.ts foi excluído do mutate no #4222 porque o bloco de cache-HIT (o grosso da lógica) não tinha teste — só os caminhos guard-false / cache-MISS eram exercitados, então a maioria dos mutantes do HIT sobreviveria (sem clean kill).

Como o fixture funciona (sem mock.module)

mock.module não está disponível sob o tap-runner do Stryker. O teste então semeia o cache real via setCachedResponse (o store em-memória que getCachedResponse checa primeiro) sob a assinatura exata que checkSemanticCache reconstrói (generateSignature com os mesmos model/messages/temperature/top_p/apiKeyId). Isso dispara o branch de HIT ponta-a-ponta.

3 testes de HIT novos:

  • não-streaming → application/json, body = JSON do cached, headers X-OmniRoute-Cache: HIT + Cache-Hit: true, e os side-effects (persistAttemptLogs com status:200/cacheSource:"semantic", logConvertedResponse(cached), log.debug).
  • streaming (stream:true) → text/event-stream, body SSE com frames data: + terminador [DONE].
  • sem usage → cachedUsage resolve undefined → cachedCost = 0 → header responseCost no sentinel zero.

Matam os mutantes do bloco HIT (status / "semantic" / "HIT" / os ternários stream+content-type / o fallback de custo / as chamadas de side-effect).

Mudanças

  • tests/unit/chatcore-semantic-cache.test.ts — +3 testes de HIT (os 5 guard/miss originais permanecem). 8/8 verde local.
  • stryker.conf.json — semanticCache.ts → mutate (30→31), chatcore-semantic-cache.test.ts → tap.testFiles (137→138), comentário _mutate_godfiles_excluded_comment atualizado (15/15).
  • .github/workflows/nightly-mutation.yml — semanticCache.ts → batch i (3 arquivos); comentário do header atualizado.

Notas

  • Config/test-only — zero código de produção. Mutation testing segue advisory (noturna, continue-on-error).
  • Run step do workflow injection-safe intacto (BATCH_MUTATE env → --mutate "$BATCH_MUTATE").
  • União de todos os batches do matrix == conjunto mutate do conf (verificado).

QG v2 Fase 9 T5 — Fase 3 follow-up. Encerra a re-habilitação do mutation testing pela via unit-testável: mutate 6→31, 9 batches, 15/15 chatCore leaves + todos os combo leaves.

🤖 Generated with Claude Code

…tate (15/15 leaves)

The last chatCore leaf, semanticCache.ts, was excluded from Stryker `mutate`
because its cache-HIT block (the bulk of the logic) had no covering test — only
the guard-false / cache-MISS paths were exercised, so its mutants would survive.

chatcore-semantic-cache now seeds the real cache via setCachedResponse (the
in-memory store getCachedResponse checks first — no mock.module, which is
unavailable under the Stryker tap-runner) under the exact signature
checkSemanticCache rebuilds. Three HIT tests then run the HIT branch end-to-end:
non-streaming JSON, streaming SSE (text/event-stream + [DONE]), and a no-usage
body (cost falls back to 0). They assert the cache headers, the response body
per stream/content-type branch, and the persistAttemptLogs / logConvertedResponse
/ log.debug side effects — killing the HIT-block mutants.

Wired: semanticCache.ts -> stryker.conf.json `mutate` + nightly batch i, and
chatcore-semantic-cache.test.ts -> tap.testFiles. ALL 15/15 chatCore leaves are
now mutated. Config/test-only; mutation testing stays advisory (nightly).

QG v2 Fase 9 T5 Fase 3 follow-up.
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw
diegosouzapw merged commit 90c4224 into release/v3.8.29 Jun 19, 2026
4 checks passed
@diegosouzapw diegosouzapw changed the title test(chatcore): semanticCache HIT-path fixture + wire into stryker mutate (15/15 leaves) test+ci(chatcore): semanticCache HIT fixture (15/15 mutate) + 350min budget headroom for auth/accountFallback batches Jun 19, 2026
@diegosouzapw

Copy link
Copy Markdown
Collaborator Author

Adendo: budget headroom para os 2 batches grandes (a/b)

Diagnóstico das runs do nightly-mutation: nenhuma jamais completou — todas cancelled. A causa não é concurrency (não há esse bloco), é o timeout-minutes: 180. Inspeção da run 27740840644:

  • batch c (2 módulos) → SUCCESS em ~2h, mutation.json com killedBy 100% populado (atribuição por-teste funciona).
  • batch a (auth) e batch b (accountFallback) → cancelled exatamente em 3h00 = bateram o cap de 180min.

Um cold run que nunca completa nunca escreve stryker-incremental.json → esses 2 batches ficam presos para sempre.

Fix (commit 2a3eca2c0): timeout-minutes por-batch via ${{ matrix.batch.timeout || 180 }}; a/b sobem para 350min (teto do runner é 360) para o 1º cold run completar e semear o incremental; as noturnas seguintes a 180min só re-testam mutantes alterados e cabem. Batches pequenos mantêm 180min. Run step segue injection-safe.

Run de validação forçada agora (27801579662) na config completa (31 módulos, 15/15 chatCore).

diegosouzapw added a commit that referenced this pull request Jun 19, 2026
…) + extend to c/d/g/h (#4258)

Restore cold-seed timeout headroom in nightly-mutation (per-batch timeout: a/b/c/d=350, g/h=240, rest=180). A cold Stryker run must complete once to seed stryker-incremental.json; a job cancelled at the cap never seeds. Integrated into release/v3.8.29.
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…tate (15/15 leaves) (cheaper-inference#4225)

Integrated into release/v3.8.29 (semanticCache HIT-path fixture + stryker 15/15 chatCore leaves).
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…rence#4225 squash) + extend to c/d/g/h (cheaper-inference#4258)

Restore cold-seed timeout headroom in nightly-mutation (per-batch timeout: a/b/c/d=350, g/h=240, rest=180). A cold Stryker run must complete once to seed stryker-incremental.json; a job cancelled at the cap never seeds. Integrated into release/v3.8.29.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant