Race in gateway/apps tests: scanner.New called concurrently from parallel tests
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
Línea de trabajo
Lee internal/gateway/apps/ai_secrets_test.go, especialmente secretsFixture, y comprueba cómo obtienen un scanner las pruebas paralelas. El issue sugiere compartir un scanner por paquete con sync.OnceValues; verifica que Scanner admita el uso concurrente tal como se describe. Ejecuta go test -race ./internal/gateway/apps varias veces y confirma que la race ya no aparece.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
go test -race ./internal/gateway/apps fails now and then with DATA RACE in tests that have nothing in common, such as TestExplainOfAHealthyAppIsRefused, TestTemplateListCarriesMaxSharing and TestNonMemberCannotCreate. Locally it failed 2 of 7 runs. CI has been green, so it may only show up under load.
The race is two goroutines writing viper's global config:
Write at ... by goroutine 61:
github.com/spf13/viper.(*Viper).SetConfigType() [email protected]/viper.go:2189
github.com/zricethezav/gitleaks/v8/detect.NewDetectorDefaultConfig() detect.go:136
github.com/nebari-dev/javo/internal/ai/redact/scanner.New() scanner.go:32
.../gateway/apps_test.secretsFixture() ai_secrets_test.go:22
.../gateway/apps_test.TestInjectedLogTextChangesNothing() ai_injection_test.go:20
Previous write ... by goroutine 62:
... same path via TestExplainBundleIsShownOnlyToTheOwner() ai_secrets_test.go:58
scanner.New says "Call it once at start-up: the rules are parsed through viper's global instance" (internal/ai/redact/scanner/scanner.go:29-30). The gateway does call it once. The test helper secretsFixture (internal/gateway/apps/ai_secrets_test.go:20) calls it for every test, and those tests run with t.Parallel(), so two of them can parse gitleaks' rules at the same time. When the race detector fires, it fails whichever tests are running then, which is why the failing names vary.
Production is not affected. The fix is in the tests: build one scanner per package (for example with sync.OnceValues in the test file) and share it, since Scanner already guards its detector with a mutex. Making New itself safe to call concurrently would also work, but it would hide the "once at start-up" contract instead of keeping it.
- Lenguaje dominante
- Go
- Estrellas
- 5
- Forks
- 0
- Merge medio
- 21 h 13 min
- PR fusionados (30 d)
- 53
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin 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 nebari-dev/tapas
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
nebari-dev/tapas#124 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nebari-dev/tapas#121 ·
Los mantenedores suelen responder en 1 día
-
Suggest saving a memory when a chat message holds something worth rememberingPosiblemente ocupada @jbouder la tomó hoy. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
nebari-dev/tapas#137 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 54/100
nebari-dev/tapas#136 ·
Los mantenedores suelen responder en 1 día
-
type: enhancement 💅🏼
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
nebari-dev/tapas#133 ·
Los mantenedores suelen responder en 1 día
Todos los issues de nebari-dev/tapas
Issues similares
-
--auto-tier: hashing, dedup, resume validation and DVC/git reads still update atime on LinuxAbiertoarea: pipeline priority: low type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
prime-radiant-inc/evener#8335 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
-
ui: OnTextKey on SearchField never sees keys (it does not reach the inner input)Posiblemente ocupada @szluyu99 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100