test(api): kimi-code spec inherits queued one-shot fetch responses, so shuffled order changes results
Los mantenedores suelen responder en 3 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 77/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- typescript
- Área
- testing
Línea de trabajo
Empieza con src/api/providers/__tests__/kimi-code.spec.ts, centrándote en las pruebas de reintento 401 alrededor de las líneas 181 y 204 y en la prueba «does not force-refresh on non-401 OAuth failures». Lee src/test-utils/reset.ts para ver qué restablece clearAllMocks() y luego ejecuta el comando de Vitest para mezclar el orden indicado en el issue con la semilla 100. El trabajo está terminado cuando la spec pasa en orden aleatorio y la prueba que no es 401 no puede consumir una respuesta encolada por una prueba anterior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2k
- Forks
- 301
- Merge medio
- 3 d 14 h
- PR fusionados (30 d)
- 103
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Zoo-Code-Org/Zoo-Code
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Zoo-Code-Org/Zoo-Code#2773 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Zoo-Code-Org/Zoo-Code#2717 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
fix(scripts): stryker-diff.mjs spawns the extensionless .bin shim and cannot run on WindowsPosiblemente ocupada @easonLiangWorldedtech la tomó hace 15 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Zoo-Code-Org/Zoo-Code#2514 ·
Los mantenedores suelen responder en 3 días
-
[BUG] search_files hides matching text on long linesPosiblemente ocupada @DananjayaNadun la tomó hace 9 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Zoo-Code-Org/Zoo-Code#2496 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Zoo-Code-Org/Zoo-Code#2493 ·
Los mantenedores suelen responder en 3 días
Todos los issues de Zoo-Code-Org/Zoo-Code
Issues similares
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
EPPIcenter/sampledb3#162 ·
-
Particle-1 modelAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
tashfeenahmed/freellmapi#2169 ·
Los mantenedores suelen responder en 1 día
-
via-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
🎙️ task - feat(mechanic): pave git.pull.close, a close of a superseded pull with its why on recordAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ehmpathy/rhachet-roles-ehmpathy#1576 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
vercel-labs/ui#1563 ·
Los mantenedores suelen responder en 1 día