Repository navigation
fix: e2e performance benchmark の rerun attempt 選択を決定論的にする - #2182
Conversation
collector (`scripts/ci/collect_e2e_performance_benchmark.py`) と production performance gate (`tests/ci/test_ci_performance_gate.py`) の両方の `_dedupe_by_workflow_run_id` / `_pair_by_workflow_run_id` を、 `dict.setdefault()` の first-seen-wins および dict 内包表記の実質 last-seen-wins(いずれも入力配列の並び順に依存)から、単一の明示的な `initial_attempt_only_v1` ポリシー(run_attempt == 1 の成功レコードのみを 候補とし、attempt 1 が失敗/欠落しているサンプルは後続 attempt へ フォールバックせず除外する)へ置き換える。選択した run_attempt と ポリシー識別子を manifest の RunRecord(後方互換 optional field)に記録し、 run_attempt を live attempt-specific jobs API と突き合わせて trusted binding する。artifact 一覧取得を全ページ走査するよう pagination を追加し、 run_attempt の型不正・0/負値・(workflow_run_id, job, run_attempt) 衝突を fail-closed で検出する回帰テストを新設した。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2182/ The preview will be removed when this PR is closed. |
impl-review-loop Step 4 PR Review VerdictMergeability: mergeable=MERGEABLE, merge_state_status=CLEAN, isDraft=true Evidence Check:
Blockers: なし Non-blockers (Warnings):
verdict: APPROVE
reviewed_head_sha: "c51a190cec723a93545f77b7d85f0d8f5092efc6"
blockers: []
warnings:
- "PR body lacks literal '## 受け入れ条件の達成状況' per-AC checklist section (aggregate prose confirmation used instead); independently reverified all AC1-AC10 VCs pass so this is hygiene-only, not a merge blocker." |
impl-review-loop Step 4 PR Review Verdict (stale-head re-review)Reviewed head SHA: Mergeability: mergeable=MERGEABLE, merge_state_status=BLOCKED, isDraft=true Evidence Check:
Blockers: なし Non-blockers (Warnings):
verdict: APPROVE
reviewed_head_sha: "9aa6d2cf034bc475b9411475e25fccd20ba13f4d"
blockers: []
warnings:
- "allowed_paths_gate advisory: contract_source_kind/source_id_missing (non-blocking)"
- "allowed_paths_gate advisory: expected_contract_fingerprint_missing (non-blocking)" |
敵対的レビュー結果verdict: REQUEST_CHANGES
reviewed_head_sha: 9aa6d2cf034bc475b9411475e25fccd20ba13f4d
merge_ready: false
blocking_findings:
P0: 4
P1: 1最終確認時点で、PR #2182 は上記 head SHA の Draft PR です。PR本文では AC1〜AC10 と各テストの成功が申告され、PRコメント上でも ただし、テストが実GitHub APIのページング意味論を再現しておらず、追加された P0-1: artifact pagination が実API上でページを飛ばす現実装は、artifact一覧の最初のリクエストだけ query parameter なしで取得し、その後のページを GitHub Actions Artifacts API は、 たとえば
既存テストは「1ページ目に少数件、2ページ目に残り」というスタブを返すため、GitHub APIのページ番号とページサイズの関係を再現していません。 必須修正最初から最後まで同じページサイズを使ってください。 GET .../artifacts?per_page=100&page=1
GET .../artifacts?per_page=100&page=2
...さらに以下を fail-closed にする必要があります。
最低限、総数130件について target artifact を位置30、31、50、100、101、130へ置くパラメタライズドテストが必要です。 P0-2:
|
…り fail-closed 化する (fix_delta iteration 1) Issue #2179 / PR #2182 の OWNER adversarial review REQUEST_CHANGES (issuecomment-5302446086, reviewed_head_sha 9aa6d2c) を反映した fix_delta。 - P0-1: artifact pagination の page size を 1 ページ目から一貫して per_page=100 にし、total_count 未達での空ページ・重複 artifact ID・ total_count 途中変化を fail-closed で検出する。 - P0-2: live-binding の trusted identity タプルを (workflow_run_id, run_attempt, job_name, workflow_run_head_sha, job_conclusion, artifact_id, artifact_name, artifact_digest) に拡張し、 attempt 2 の artifact を attempt 1 と偽る relabeling を拒否する。 - P0-3: run_attempt が完全に欠落したレコードを collector 側で trusted cohort から除外し(legacy_unverified_run_attempt)、run_attempt: 1 を 合成しない。gate 側は Allowed Paths 外の satellite テストへの影響を 避けるため、この項目は意図的に対象外とし docs に明記した。 - P1: identity 衝突検出を (workflow_run_id, job, run_attempt) の 全フィールド byte-for-byte 比較に変更し、min() による黙った解決を廃止 (collector・gate 双方に適用)。 - schema hygiene: rerun_attempt_selection_policy を enum 制約に絞る。 P0-4(.github/workflows/ci.yml の head_sha 意味論)は #2179 の Allowed Paths 外のため対象外とし、follow-up Issue #2184 に分離した。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
fix_delta iteration 1: OWNER adversarial review 対応(reviewed_head_sha
|
impl-review-loop Step 4 PR Review Verdict (fix_delta iteration 1 re-review)Reviewed head SHA: Evidence Check:
Blockers:
Non-blockers (Warnings):
verdict: REQUEST_CHANGES
reviewed_head_sha: "a9cbc201e94517723ddc55ef552f1e5bdefd5729"
blockers:
- "P0-3 gate-side asymmetry unresolved: tests/ci/test_ci_performance_gate.py::_normalize_run_attempt still trusts a missing run_attempt as attempt-1, unlike the collector's fixed exclusion. No follow-up Issue or explicit OWNER acknowledgment exists for this gap (unlike P0-4/#2184)."
warnings:
- "PR body lacks literal per-AC checklist section (hygiene-only)."
- "gate-side numeric-string run_attempt acceptance vs collector's strict int-only is intentional and non-blocking." |
… iteration 2) pr-reviewer REQUEST_CHANGES (issuecomment-5302595322) の指摘どおり、 `_normalize_run_attempt` の docstring が「run_attempt フィールド追加前の baseline との後方互換性」という事実誤認コメントを含んでいた。 `ci_runtime_baseline_v1` は導入コミット 9574ee5 から常に run_attempt を 含んでいるため誤り。 missing run_attempt を trusted attempt-1 として扱う既知の制限は、 このゲートモジュール自身の Allowed Paths 境界(satellite fixture files である tests/ci/test_ci_performance_gate_paired_critical_path.py 等が scope 外)によるものであり、その完全統一のための追跡先として follow-up Issue #2187 を明記した。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
fix_delta iteration 2: pr-reviewer REQUEST_CHANGES 対応(reviewed_head_sha
|
impl-review-loop Step 4 PR Review Verdict (fix_delta iteration 2 re-review)Reviewed head SHA: Evidence Check:
Blockers: なし verdict: APPROVE
reviewed_head_sha: "0de7dc54b67d10414e1d407af80882c188fc6e9a"
blockers: []
warnings: [] |
Summary
squne121/loop-protocol#2172、実装: e2e performance benchmark の fixed-SHA cohort・paired critical path・cross-run collector・immutable manifest を再設計する(Issue A) #2159 をクローズ済み)で実装した e2e performance benchmark 測定器の rerun-attempt 選択ロジックを、OWNER adversarial review(issuecomment-5295659213 P1-1)の指摘どおり決定論的に修正する。scripts/ci/collect_e2e_performance_benchmark.py::_dedupe_by_workflow_run_idとtests/ci/test_ci_performance_gate.py::_dedupe_by_workflow_run_id/_pair_by_workflow_run_idの両方を、dict.setdefault()の first-seen-wins および dict 内包表記の実質 last-seen-wins(いずれも入力配列の並び順に依存する挙動)から、単一の明示的なinitial_attempt_only_v1ポリシー(run_attempt == 1の成功レコードのみを候補とし、attempt 1 が失敗/欠落しているサンプルはそのまま cohort から除外する。他の attempt へフォールバックしない)へ置き換えた。run_attemptの値と選択ポリシー識別子(rerun_attempt_selection_policy: "initial_attempt_only_v1")を manifest のRunRecord(後方互換 optional field)に記録し、run_attemptを live attempt-specific jobs API(GET .../actions/runs/{run_id}/attempts/{attempt_number}/jobs)と突き合わせる trusted binding を追加した。total_countに基づき page 2 以降を走査)し、run_attemptの型不正(null / 文字列 / 0 / 負値)と(workflow_run_id, job, run_attempt)衝突を fail-closed で検出する回帰テストを新設した。Checks
以下の検証コマンドを実行し、いずれも成功したことを確認した。
uv run --locked pytest scripts/ci/tests/e2e_performance_benchmark/— 49 件成功uv run --locked pytest tests/ci/test_ci_performance_gate.py tests/ci/test_ci_performance_gate_rerun_attempt_selection.py— 40 件成功、3 件 SKIP(実 GitHub API / 実 20-run cohort 依存分は環境上 SKIP、fabricated PASS ではない)uv run --locked pytest tests/ci/フルディレクトリ — 44 件成功、7 件 SKIP(既存 satellite テストに退行なし)uv run ruff check— 全チェック成功pnpm typecheck— 成功pnpm lint— 成功pnpm test— 112 ファイル・1872 件のテストが成功pnpm build— 成功uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py— 24 件成功::test_name単位)をすべて実行し、PASS を確認済み_normalize_run_attemptの docstring 是正・PR body 更新・follow-up Issue 実装: e2e performance gate 側の _normalize_run_attempt を missing run_attempt 除外ポリシーに統一する #2187 明記のみ、ロジック変更なし)でも同一検証コマンドを再実行し、全件成功を確認済み(pnpm testは 112 ファイル・1872 件成功。並列環境下でtests/retro-live-verification.test.tsの一部がタイムアウトする既知の flaky が発生することがあるが、本 PR の変更ファイル対象外かつ単体実行で 148/148 PASS を確認済み)Schema Change Applicability
schemas/e2e_performance_benchmark_manifest_v1.schema.jsonのRunRecord(unevaluatedProperties: false)に、後方互換な OPTIONAL field としてrun_attempt(integer >= 1)とrerun_attempt_selection_policy(string)を追加した。既存の必須フィールド(required配列)は変更していない。Schema Consumer Inventory
before
{ "RunRecord": { "required": ["workflow_run_id", "job", "head_sha", "artifact_id", "artifact_digest", "conclusion", "workflow_digest", "workflow_sha"], "unevaluatedProperties": false, "properties": { "workflow_run_id": "integer >= 1", "...": "既存フィールドのみ" } } }after
{ "RunRecord": { "required": ["workflow_run_id", "job", "head_sha", "artifact_id", "artifact_digest", "conclusion", "workflow_digest", "workflow_sha"], "unevaluatedProperties": false, "properties": { "workflow_run_id": "integer >= 1", "...": "既存フィールド", "run_attempt": "integer >= 1 (optional, 後方互換)", "rerun_attempt_selection_policy": "string (optional, 後方互換)" } } }scripts/ci/collect_e2e_performance_benchmark.py_collect_armが全RunRecordにrun_attempt/rerun_attempt_selection_policyを出力するよう変更(本 PR)。tests/ci/test_ci_performance_gate.py_cli_run_details_from_pairsがrun_attempt: 1ハードコードから実際の選択結果を伝播する実装へ変更(本 PR)。.claude/skills/ci-test-performance/scripts/validate_ci_performance_assessment_v2.pyCI_TEST_PERFORMANCE_ASSESSMENT_V2はe2e_performance_benchmark_manifest_v1を直接消費しない別スキーマであり、追加フィールドの影響を受けない。schemas/ci_test_reliability_assessment_v1.schema.json(#2170)Safety Claim Matrix
N/A(reason: 変更対象は
scripts/ci/・tests/ci/・schemas/・docs/dev/のみで、SAFETY_SENSITIVE_PATH_PATTERNS(transport / permission / sandbox / auth / mcp /.claude/skills//.github/workflows/)のいずれにも該当しない。CI performance gate のロジック変更であり、実行権限・sandbox・secret 境界には影響しない)Known Limitations / Follow-up Issues(既知の制限事項・follow-up Issue)
.github/workflows/ci.ymlの head_sha 意味論混同(P0-4)。Issue 実装: e2e performance benchmark の rerun attempt 選択を順序非依存の決定論的ポリシーにする #2179 の Allowed Paths 外(.github/workflows/**を含まない)のため本 PR では対応せず、follow-up Issue に分離済み。tests/ci/test_ci_performance_gate.py::_normalize_run_attemptは、run_attempt欠落レコードを collector 側と同じく trusted cohort から除外する厳格化を意図的に適用していない(P0-3 の gate 側非対称性、pr-reviewer REQUEST_CHANGES issuecomment-5302595322 で指摘)。gate 側で同じ厳格化を行うとtests/ci/test_ci_performance_gate_paired_critical_path.py等、Issue 実装: e2e performance benchmark の rerun attempt 選択を順序非依存の決定論的ポリシーにする #2179 の Allowed Paths 外にある satellite fixture(run_attemptを一切設定していない)が壊れるため。この非対称性は_normalize_run_attemptの docstring に明記済み(本 fix_delta iteration 2 で追記)。follow-up Issue 実装: e2e performance gate 側の _normalize_run_attempt を missing run_attempt 除外ポリシーに統一する #2187 で satellite fixture ファイルへ Allowed Paths を拡張したうえで統一する。Notes
decision: not_applicable(純粋な静的変更。pytest ユニット/回帰テストとrgによる doc grep のみで検証完結)contract_snapshot_source: none(実装: implementation-worker.toml と open_pr.py の legacy artifact hard gate を除去する #1851 policy)。live Issue 本文(Outcome / AC / Allowed Paths / VC / Stop Conditions)を正本として実装した。scripts/ci/collect_e2e_performance_benchmark.py、scripts/ci/tests/e2e_performance_benchmark/(新規ファイル追加)、docs/dev/e2e-performance-benchmark.md、schemas/e2e_performance_benchmark_manifest_v1.schema.json、tests/ci/test_ci_performance_gate.py、tests/ci/test_ci_performance_gate_rerun_attempt_selection.py(新規ファイル)の範囲内で完結。scripts/ci/tests/e2e_performance_benchmark/test_collect_e2e_performance_benchmark.pyの34件、tests/ci/test_ci_performance_gate.pyおよびその 5 つの satellite ファイルの既存テスト)は無改変で全件 PASS を確認(AC10)。gate 側の実運用ベースライン形状(run_attemptが bash 環境変数由来の文字列"1"であるtest_v2_producer_shaped_baseline_from_ci_yml_is_admitted_to_cohort)との後方互換性を維持するため、gate 側_normalize_run_attemptは数値文字列を受理する(collector 側は構造化 JSON 入力のため厳密な int 型のみを受理し、独立実装として意図的に差異がある)。