PR stats parity tests can publish or overwrite real gists
Los mantenedores suelen responder en 1 día
Ya se ha fusionado un pull request relacionado.
- #1603 de @MakerFlyFly — fusionado
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 75/100
Línea de trabajo
Lee tools/pr-management/tests/stats/test_json_parity.py y la rama de publicación en tools/pr-management/src/pr_management/stats/dashboard.py. Ejecuta las pruebas de paridad y comprueba cómo _run() construye los argumentos del panel y cómo _install_stubs() gestiona la autenticación, la publicación y el estado de la sesión. La tarea estará terminada cuando ambas pruebas pasen sin llamadas a gh ni cambios en el estado de la sesión, mientras que los comandos de referencia sigan aceptando los argumentos que admiten.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What's broken
The PR stats JSON parity tests call dashboard.main() with gist publishing enabled.
On a machine where gh is authenticated with the gist scope, running these unit tests can overwrite a real dashboard gist or create a secret gist in the developer's account, even though both tests pass.
Which layer
tools/pr-management/tests/stats/test_json_parity.py: _run() omits --no-publish, and _install_stubs() replaces only fetch functions.
The publication and session-state branch is in tools/pr-management/src/pr_management/stats/dashboard.py.
How to reproduce
Reproduced at upstream dadb315caa8b881fc1d2195bef03223dac25915a in an isolated Linux checkout with CPython 3.12.12 and workspace development dependencies.
Use a disposable checkout and this recording replacement; it makes no network requests and never delegates to real gh.
set -euo pipefail
stub_dir="$(mktemp -d)"
export H09_GH_LOG="$stub_dir/calls.log"
cat > "$stub_dir/gh" <<'SH'
#!/bin/sh
printf 'gh %s\n' "$*" >> "$H09_GH_LOG"
case "${1:-} ${2:-}" in
'auth status') printf "Token scopes: 'gist', 'read:org', 'repo'\n" ;;
'api -X') cat > /dev/null ;;
'gist create') printf '%s\n' 'https://gist.github.com/tester/0123456789abcdef0123456789abcdef' ;;
*) exit 98 ;;
esac
SH
chmod +x "$stub_dir/gh"
PATH="$stub_dir:$PATH" uv run --directory tools/pr-management --project . \
python -m pytest -q tests/stats/test_json_parity.py
cat "$H09_GH_LOG"
With the tracked legacy gist ID and no personal session state, both tests pass while the replacement records two gh auth status and two gist PATCH calls.
Without legacy or personal state, verified in a separate disposable run, the tests create a gist, PATCH it, and store the fake ID in .apache-magpie-local/session-state.json.
Expected vs actual
Expected: fixture-based tests compare JSON without authenticating with GitHub, publishing, or reading/writing gist session state.
Actual: the publication branch remains reachable outside the assertions.
The reviewed fix adds --no-publish to dashboard argv only and makes authentication, publication, and session-state entry points reject unexpected test access with pytest.fail.
The reference entry point rejects that flag, so it must not be added to shared argv unconditionally.
Surface area
One test file, 15 added lines; existing JSON assertions and production behavior are preserved.
Publication-wiring coverage, a stats-wide subprocess guard, tracked legacy-state cleanup, and explicit UTF-8 production HTML reads/writes are independent follow-ups.
Environment
Linux, CPython 3.12.12, pytest 9.1.1, non-root Docker validation with a recording gh replacement.
After the fix, both state scenarios pass with zero gh calls and no state changes; removing the opt-out or forcing any of the four entries ahead of it fails even inside except Exception.
Suggested labels: bug, family:pr-management, capability:stats.
Developed with Codex (GPT-6); the contributor has completed manual code review and approved the patch for upstream submission.
- Lenguaje dominante
- Python
- Estrellas
- 113
- Forks
- 95
- Merge medio
- 11 h 17 min
- PR fusionados (30 d)
- 332
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 apache/magpie
-
agent-guard: the +refspec force spelling bypasses the empty-rebase guardPosiblemente ocupada @liwenjie200543 la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
apache/magpie#1606 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Add a proper Mailing List pageAbiertoenhancement
Dificultad 2/5 1-2 días Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
bug capability:platform family:docs family:setup
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
capability:platform enhancement family:ci family:setup
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
Todos los issues de apache/magpie
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
huggingface/sentence-transformers#4186 ·
Los mantenedores suelen responder en 5 días
-
documentation good first issue
Dificultad 2/5 Medio día Aptitud para principiantes 72/100
sujithputta02/Esapay#13 ·
-
bot-triaged module: correctness (silent) module: mps module: NaNs and Infs triage review
Dificultad 2/5 Medio día Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
README: CI link/badge checkAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
SCIInstitute/SCIRun#2842 ·
Los mantenedores suelen responder en 3 días