PR stats parity tests can publish or overwrite real gists
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 75/100
調査の方向性
tools/pr-management/tests/stats/test_json_parity.py と tools/pr-management/src/pr_management/stats/dashboard.py の公開分岐を読みます。パリティテストを実行し、_run() がダッシュボードの引数をどのように構築するか、また _install_stubs() が認証、公開、セッション状態をどのように処理するかを確認します。両方のテストが gh の呼び出しやセッション状態の変更なしに成功し、参照コマンドが引き続きサポート対象の引数を受け付ければ完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 113
- フォーク
- 95
- 平均マージ
- 10時間 48分
- マージ済み PR(30日)
- 348
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/magpie のほかの issue
-
agent-guard: the +refspec force spelling bypasses the empty-rebase guard対応中かも @liwenjie200543 が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
apache/magpie#1606 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜2日 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
Marketplace install fails with GitHub Copilot対応中かも @opwvhk が今日担当しました。 オープンbug
難易度 3/5 半日 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
-
Explore Claude Code mods across the skill families対応中かも @Kaap10 が 7 日前に担当しました。 オープンcapability:platform enhancement family:ci family:docs family:issue family:pairing family:pr-management family:release-management family:security family:setup family:tools family:utilities substrate:framework-dev
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
apache/magpie#1497 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
[Bug]: LangGraph Store sync put bypasses namespace validation対応中かも @ktz03 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
volcengine/OpenViking#6050 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: Streamed /v1/chat/completions sends unredacted agent error text (keys) in the final chunk対応中かも @rodricksz4h5 が今日担当しました。 オープンarea/streaming comp/gateway P2 type/security
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NousResearch/hermes-agent#138245 ·
メンテナーはふだん 1 日以内に返信
-
[oblt-aw][autodoc] Update user onboarding guide for mandatory trigger CODEOWNERS step対応中かも @github-actions が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
correction metadata
難易度 2/5 1時間未満 初心者へのやさしさ 68/100
acl-org/acl-anthology#10378 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
cloudtrail_multi_region_enabled_logging_management_events fails when the advanced event selector has a custom name対応中かも @12YYCCYY16 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
prowler-cloud/prowler#13033 ·
メンテナーはふだん 1 日以内に返信