test(api): kimi-code spec inherits queued one-shot fetch responses, so shuffled order changes results
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 77/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- testing
Direzione di ricerca
Inizia da src/api/providers/__tests__/kimi-code.spec.ts, concentrandoti sui test di retry 401 intorno alle righe 181 e 204 e sul test «does not force-refresh on non-401 OAuth failures». Leggi src/test-utils/reset.ts per vedere cosa reimposta clearAllMocks(), quindi esegui il comando Vitest per mescolare l’ordine indicato nell’issue con seed 100. Il lavoro è completato quando la spec passa in ordine casuale e il test non-401 non può consumare una risposta accodata da un test precedente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Symptom
src/api/providers/__tests__/kimi-code.spec.ts is order dependent. Under --sequence.shuffle at seed 100 the test "does not force-refresh on non-401 OAuth failures" resolves instead of rejecting. It passes in declaration order, which is what CI runs.
Measured
- Fails at abort-signal head
2f0d1d878518and also at the previous head780688ab2f67with this round's edits reverted, and it fails when that spec is run alone under the same seed. - Passes in declaration order at both heads.
- Repro:
cd src && npx vitest run api/providers/__tests__/kimi-code.spec.ts --sequence.shuffle --seed 100
Cause
The suite's beforeEach calls clearAllMocks() from src/test-utils/reset.ts, which is vi.clearAllMocks(). That clears mock.calls, instances and results but keeps implementations, so a response queued with mockResolvedValueOnce by an earlier test - here the 401-retry tests around lines 181 and 204, which queue globalThis.fetch responses - is still in the queue when the next test starts. Under shuffle the 500-path test can therefore consume a queued 401-body response from the previous test and take the refresh branch it is supposed to prove does not happen.
export function clearAllMocks(): void {
vi.clearAllMocks()
}
Expected
The suite must not depend on execution order. Either reset the once-queues between tests - mockReset() on the mocks that receive queued-once responses, or a helper in test-utils/reset.ts that also drops queued implementations - or give each test its own fetch stub in the test body instead of inheriting a queue. A test that asserts a refresh did not happen should not be able to inherit the response a previous test queued.
Why it matters
The abort-signal series adds tests that queue one-shot fetch responses around OAuth refresh. Every added test increases the chance that a shuffle exposes this, and CI moving to randomised order would turn it into a permanent flake.
- Lingua principale
- TypeScript
- Stelle
- 2k
- Fork
- 301
- Merge medio
- 3g 14h
- PR unite (30g)
- 103
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Zoo-Code-Org/Zoo-Code
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Zoo-Code-Org/Zoo-Code#2773 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Zoo-Code-Org/Zoo-Code#2717 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
fix(scripts): stryker-diff.mjs spawns the extensionless .bin shim and cannot run on WindowsForse già presa @easonLiangWorldedtech l’ha presa 15 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Zoo-Code-Org/Zoo-Code#2514 ·
I maintainer di solito rispondono entro 3 giorni
-
[BUG] search_files hides matching text on long linesForse già presa @DananjayaNadun l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Zoo-Code-Org/Zoo-Code#2496 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Zoo-Code-Org/Zoo-Code#2493 ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di Zoo-Code-Org/Zoo-Code
Issue simili
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
EPPIcenter/sampledb3#162 ·
-
Particle-1 modelAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
tashfeenahmed/freellmapi#2169 ·
I maintainer di solito rispondono entro 1 giorno
-
via-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno
-
🎙️ task - feat(mechanic): pave git.pull.close, a close of a superseded pull with its why on recordAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ehmpathy/rhachet-roles-ehmpathy#1576 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
vercel-labs/ui#1563 ·
I maintainer di solito rispondono entro 1 giorno