Consolidate remaining inline environment filter in test_check_baseline_ratchet.py into ci.isolated_env
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 82/100
調査の方向性
scripts/test_check_baseline_ratchet.pyを読み、特にCompareBaselineSuppressionsTests.test_missing_base_git_ref_warns_offline_when_new_suppressions_existを確認し、近くのテストでci.isolated_env()がどのように使われているかを調べてください。残っているインラインの環境フィルターをこのhelperに置き換え、その後、指定されたunittestとissueに記載されたpre-commitフックを実行してください。両方が成功し、一致するインラインフィルターが残っていなければ完了です。
索引モデルが issue の本文から書いたものです。
説明
What happened
PR #745 (https://github.com/redhat-et/ProtoBot/pull/745, resolving issue #704) consolidated ambient CI environment isolation across repository test files into scripts/ci.py via ci.clean_env() and ci.isolated_env().
The PR description stated:
"The inline dict-comprehension environment filtering across
scripts/test_check_baseline_ratchet.py,scripts/test_check_adr_amendments.py,scripts/test_lint.py, andscripts/test_check_spec_validator.pyhas been replaced withci.clean_env()andci.isolated_env()."
While scripts/test_check_baseline_ratchet.py was partially migrated (deleting the file-level _clean_env and converting several test classes to ci.isolated_env()), one inline dict-comprehension filter was overlooked and remained at lines 791–801 in scripts/test_check_baseline_ratchet.py:
env = {
k: v
for k, v in os.environ.items()
if k
not in {
"CI",
"GITHUB_ACTIONS",
"GITHUB_BASE_REF",
"GITHUB_REPOSITORY",
}
}
with patch.dict(os.environ, env, clear=True):
In review run 47426325898 (https://github.com/redhat-et/ProtoBot/actions/runs/47426325898), the review agent approved the PR without identifying this unconsolidated block. During maintainer review, JohnStrunk flagged this in non-blocking note N1 (https://github.com/redhat-et/ProtoBot/pull/745#pullrequestreview-6197174524):
"One hand-written environment filter remains in a file that this PR says it consolidated... It also omits the event-base variables and
ZIZMOR_NO_ONLINE_AUDITS, so it is not equivalent toci.clean_env(). The divergence that issue #704 describes remains in this file... suggestion: Replace lines 791-802 withwith ci.isolated_env():and delete the localenvdict."
PR #745 merged at commit c3e0704967c54d31b2be5dba090dbec37ee42bc6, leaving this block unmigrated in the repository.
What could go better
Confidence: High. The unconsolidated dictionary comprehension is directly visible in scripts/test_check_baseline_ratchet.py:791-801.
As maintainer JohnStrunk noted, this block does not cause an immediate test failure today because base_git_ref=None is explicitly passed and CI is excluded. However, leaving it in place has clear drawbacks:
- Divergence from repo standards: Issue #704 was filed specifically to eliminate fragmented, inconsistent environment stripping across test suites. Retaining this manual dict comprehension preserves the exact fragmentation #704 aimed to fix.
- Missing CI event-base coverage: The hand-written block only strips
{"CI", "GITHUB_ACTIONS", "GITHUB_BASE_REF", "GITHUB_REPOSITORY"}. It fails to strip event-base variables (GITHUB_BASE_SHA,PUSH_BEFORE_SHA,PULL_REQUEST_BASE_SHA,MERGE_GROUP_BASE_SHA,WORKFLOW_DISPATCH_BASE_SHA) andZIZMOR_NO_ONLINE_AUDITS. If this test case or helper functions withincompare_baseline_suppressionsare updated to exercise comparison bases or run in ambient CI contexts, ambient variables could leak and cause false test failures. - Review agent miss: The review agent failed to verify description-to-diff parity regarding the claim that inline dict comprehensions were replaced in all four files.
Proposed change
In scripts/test_check_baseline_ratchet.py, update test_missing_base_git_ref_warns_offline_when_new_suppressions_exist in CompareBaselineSuppressionsTests (lines 791–802):
Replace:
env = {
k: v
for k, v in os.environ.items()
if k
not in {
"CI",
"GITHUB_ACTIONS",
"GITHUB_BASE_REF",
"GITHUB_REPOSITORY",
}
}
with patch.dict(os.environ, env, clear=True):
diagnostics = checker.compare_baseline_suppressions(
_baseline(_non_ceiling()),
_baseline(),
root,
None,
warnings=warnings,
)
With:
with ci.isolated_env():
diagnostics = checker.compare_baseline_suppressions(
_baseline(_non_ceiling()),
_baseline(),
root,
None,
warnings=warnings,
)
This removes the local env variable and uses ci.isolated_env(), which is already imported in scripts/test_check_baseline_ratchet.py.
Validation criteria
- Run
GITHUB_BASE_SHA=deadbeef PUSH_BEFORE_SHA=feedface CI=true python3 -m unittest scripts.test_check_baseline_ratchet.CompareBaselineSuppressionsTests.test_missing_base_git_ref_warns_offline_when_new_suppressions_exist; the test passes cleanly under ambient CI pollution. - Run
pre-commit run --files scripts/test_check_baseline_ratchet.py; all hooks pass. - Running
grep -n "patch\.dict(os\.environ, env" scripts/test_check_baseline_ratchet.pyreturns 0 matches.
Related issues checked
Searched: test_check_baseline_ratchet isolated_env; CompareBaselineSuppressionsTests clean_env; test_check_baseline_ratchet CI env isolation; ambient CI test environment isolation repo:fullsend-ai/fullsend repo:fullsend-ai/agents repo:redhat-et/ProtoBot
Considered: #704
#704 is closed; it is the original consolidation issue implemented by PR #745, which inadvertently left lines 791-801 in test_check_baseline_ratchet.py unconsolidated.
Generated by retro agent from https://github.com/redhat-et/ProtoBot/pull/745
- 主要言語
- Go
- スター
- 8
- フォーク
- 9
- 平均マージ
- 18時間 17分
- マージ済み PR(30日)
- 187
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
redhat-et/ProtoBot のほかの issue
-
documentation triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
redhat-et/ProtoBot#760 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
documentation triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
redhat-et/ProtoBot#758 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
blocked infra pr-open ready-for-triage risk/low
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
redhat-et/ProtoBot#752 · コメント 3 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug infra ready-for-triage risk/low triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
redhat-et/ProtoBot#750 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug infra ready-for-triage risk/low triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
redhat-et/ProtoBot#749 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
redhat-et/ProtoBot の issue をすべて見る
似ている issue
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
rohitgollarahalli/mcpx#45 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
router-for-me/CLIProxyAPI#8851 ·
メンテナーはふだん 7 日以内に返信
-
Mend: dependency security vulnerability
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
Windows 主机
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Lee-xeo/Claude-Cage#1550 ·
メンテナーはふだん 1 日以内に返信