Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "PR #2182(Closes #2179)の OWNER adversarial review(issuecomment-5302595322)で pr-reviewer が確認した gate 側 _normalize_run_attempt の missing-key trust asymmetry を解消する"
change_kind: codeParent Issue
なし(単独 follow-up。起点は PR #2182 のレビューコメント #2182 (comment) と originating Issue #2179)
Parent Goal Ref
- Goal:
tests/ci/test_ci_performance_gate.py::_normalize_run_attemptの「run_attemptキー欠落を attempt 1 として信頼する」挙動を、scripts/ci/collect_e2e_performance_benchmark.py::_classify_run_attemptの是正済みポリシー(キー欠落はlegacy_unverified_run_attemptとして trusted cohort から除外)に統一する - Desired Destination: N/A(単独 follow-up のため親 Issue のスコープなし)
Current Validated Scope
tests/ci/test_ci_performance_gate.pyの gate 側 rerun-attempt 処理を、missing/invalid/trusted の 3 態を明示的に区別する classifier ベースの設計へ責務分離する(trust 判定と collision grouping を同じ戻り値で兼用しない)- provider lane(
_pair_by_workflow_run_id経由)だけでなく gate-ready lane(_gate_ready_post_filter_sample_count経由)にも同じ attempt selection /workflow_run_iddedupe を適用する _cli_run_details_from_pairs()の_normalize_run_attempt(core) or 1fallback を削除し、missing/invalid な attempt からrun_attempt: 1を合成しない- producer-shaped 数値文字列
"1"(GITHUB_RUN_ATTEMPT由来)は引き続き trusted attempt-1 として受理する preservation 契約を維持する(collector とのこの型差異は意図的であり統一しない) - missing record が silent に消えず、
workflow_run_idと除外理由(legacy_unverified_run_attempt等)が evidence errors に残ることを保証する tests/ci/test_ci_performance_gate_rerun_attempt_selection.py(gate-side rerun policy の canonical regression suite)に新規回帰テストを追加するdocs/dev/e2e-performance-benchmark.mdの既知制限の記述を現行仕様に更新する- 上記変更後も
tests/ci/配下の全test_ci_performance_gate*.pyと Ruff が PASS する状態を維持する
Remaining Parent Gaps
なし
Outcome
tests/ci/test_ci_performance_gate.py の gate 側 rerun-attempt 処理が、collector 側 _classify_run_attempt(scripts/ci/collect_e2e_performance_benchmark.py)と同じ trust-state semantics(run_attempt キー欠落は trusted cohort から除外し legacy_unverified_run_attempt として記録する)を持つ状態になり、かつ以下が同時に満たされている。
- trust 判定(missing/invalid/ok の分類)と collision grouping(missing record は既存契約どおり attempt-1 slot として扱う)が責務分離されている
- provider lane だけでなく gate-ready lane にも同じ attempt selection /
workflow_run_iddedupe が適用されている _cli_run_details_from_pairs()が missing/invalid な attempt からrun_attempt: 1を合成しない- producer-shaped 数値文字列
"1"は引き続き trusted attempt-1 として受理される - missing record が silent に消えず、
workflow_run_idと除外理由が evidence errors に残る docs/dev/e2e-performance-benchmark.mdの既知制限の記述が現行仕様に更新されているtests/ci/配下の全test_ci_performance_gate*.pyと Ruff が PASS する
Runtime Verification Applicability
- decision: not_applicable
- reason: 対象コードは
.github/workflows/ci.ymlから CLI として実行される production-callable evidence gate だが、本 Issue の変更は producer(workflow/schema)側ではなく、現行 producer が生成しない missing-key poison input に対する consumer 側 trust rejection ロジックの是正である。検証は pytest による behavioral regression test(_normalize_run_attempt/_select_initial_attempt_baselines/_pair_by_workflow_run_id/_gate_ready_post_filter_sample_count/_cli_run_details_from_pairsの直接呼び出し)で完結し、実際のワークフロー実行・外部通信・I/O は不要。
In Scope
tests/ci/test_ci_performance_gate.py::_normalize_run_attemptの missing-key 挙動を、trust 判定用途ではNone(除外)を返すよう変更する。ただし既存の_detect_run_attempt_identity_collisionsが依存する「missing は collision grouping では attempt-1 slot として扱う」契約は、trust 判定から独立した形で保持する(責務分離、一行修正ではなく classifier ベースの設計変更)_select_initial_attempt_baselines()の戻り値契約を(selected, evidence_errors)のタプルへ変更し、missing record がlegacy_unverified_run_attempt相当の理由でevidence_errorsに記録されるようにする_pair_by_workflow_run_id()を、all_idsの union を selected map の key からではなく raw input のworkflow_run_id集合から構築するよう変更し、core/responsive 双方が missing で除外されたworkflow_run_idも evidence_errors から消えないようにする_cli_run_details_from_pairs()の"run_attempt": _normalize_run_attempt(core) or 1fallback を削除し、missing/invalid な attempt から attempt 1 を合成しないようにする_gate_ready_post_filter_sample_count()の戻り値契約を(count, evidence_errors)のタプルへ変更し、内部で_select_initial_attempt_baselines()による attempt selection /workflow_run_iddedupe を適用する。呼び出し元run_evidence_gate()を新シグネチャに追従させる- explicit integer
1と producer-shaped string"1"を trusted attempt-1 candidate として引き続き受理し、bool/null/0/negative/non-numeric な値は invalid として拒否する既存の型変換ロジックは変更しない(preservation) _normalize_run_attempt()の docstring から、これから変更する旧挙動の記述(「A missing key defaults to 1 and is treated as a TRUSTED attempt-1 candidate」)を削除し、新ポリシーを反映する。_select_initial_attempt_baselines()の docstring から「THIS gate module intentionally still defaults a MISSINGrun_attemptkey to 1 for trusted-cohort eligibility」という記述も同様に是正する- 新規ファイル
tests/ci/test_ci_performance_gate_rerun_attempt_trust_boundary.pyを追加し、以下の新規回帰テストをまとめて置く(本リポジトリの VC 契約規約上、既存ファイルへの新規 test 関数追加は禁止されているため、新規テストは新規ファイルに集約する):- missing record が
legacy_unverified_run_attempt相当の理由で trusted cohort から除外されることを示すテスト - core/responsive 双方 missing でも
workflow_run_idが evidence_errors から消えないことを示すテスト _cli_run_details_from_pairs()が missing/invalid から attempt 1 を合成しないことを示すテスト- gate-ready lane が missing attempt / 重複
workflow_run_id/ attempt 2 以降のみのレコードで sample floor を水増しできないことを示すテスト(4 パターン: missing fails closed、重複 workflow_run_id が水増ししない、attempt 2 以降が代替されない、正規の一意 attempt-1 レコードは sample floor を満たす) .github/workflows/ci.ymlの built-in insufficient-evidence fixture(3 サンプル)が本変更後も sample-count 不足を主理由としてinsufficient_evidenceになり続けることを示すテスト
- missing record が
tests/ci/test_ci_performance_gate_rerun_attempt_selection.pyの既存テストtest_missing_attempt_baseline_colliding_with_explicit_attempt_1_baseline_is_unaffected_by_groupingの挙動(collision grouping 契約)が、責務分離後も壊れないことを確認する(このテスト自体は既存なので変更不要、壊れていれば既存テストの範囲内で修正する)tests/ci/test_ci_performance_gate_paired_critical_path.pyの_baseline()helper、tests/ci/test_ci_performance_gate_comparability_classification.pyとtests/ci/test_ci_performance_gate_fingerprint_validation.py(いずれも_comparable_cohort()経由で run-attempt selection の影響を受ける)、tests/ci/test_ci_performance_gate_post_filter_sample_floor.py(_gate_ready_post_filter_sample_count()の新シグネチャに追従する既存呼び出しの調整)、tests/ci/test_ci_performance_gate_evidence_hard_failure.pyを調査し、新ポリシーで壊れる既存 fixture / 呼び出し箇所があれば是正する(新規 test 関数は追加しない。既存 test 内の fixture 調整のみ)docs/dev/e2e-performance-benchmark.mdの「gate 側はこの collector 側の是正をまだ完全には反映していない」という既知制限の記述を、統一後の正しい挙動に更新する_normalize_run_attempt()はそのまま残し、_detect_run_attempt_identity_collisions()の collision grouping 専用ヘルパーとして維持する(missing→1 の既存挙動を変更しない)。trust 判定側(_select_initial_attempt_baselines())には、missing をNone(trust対象外)として明示的に扱う別のヘルパー関数を新設する。同一関数に両方の意味を持たせない_select_initial_attempt_baselines()が返す per-baseline の除外理由(legacy_unverified_run_attempt等)を、_pair_by_workflow_run_id()および_gate_ready_post_filter_sample_count()のevidence_errorsへマージして伝播させる。両関数のevidence_errorsのreasonフィールドが固定文字列(例:missing_pair_e2e-core)のままにならないようにする.github/workflows/ci.ymlの built-in insufficient-evidence fixture(Allowed Paths 外、変更不可)については、本 Issue の変更後はrun_attempt欠落による除外が新たな真の除外理由になり、サンプル数が 3 から 0 に変わることを許容する。回帰テストは「gate_statusがinsufficient_evidenceのまま維持されること」と「除外理由にrun_attempt起因(legacy_unverified_run_attempt相当)が含まれること」を検証する(「sample-count のみが理由」という主張はしない)
Out of Scope
- collector 側
scripts/ci/collect_e2e_performance_benchmark.py::_classify_run_attemptの再変更(PR fix: e2e performance benchmark の rerun attempt 選択を決定論的にする #2182 fix_delta で既に是正済み) - Issue 実装: 固定SHA benchmark artifact の head_sha 意味論混同を measured_head_sha/workflow_run_head_sha 分離で修正する #2184(固定SHA benchmark artifact の head_sha 意味論混同、P0-4)の scope
_detect_run_attempt_identity_collisionsの collision 検出ロジック自体の再設計(PR fix: e2e performance benchmark の rerun attempt 選択を決定論的にする #2182 P1 で既に対応済み)- CI ワークフロー(
.github/workflows/*.yml)の変更
Acceptance Criteria
- AC1:
_normalize_run_attempt()の型変換ロジック(explicit int1/ producer-shaped string"1"を trusted 候補として受理し、bool/null/0/negative/non-numeric を拒否する)が変更後も保持されている - AC2:
_select_initial_attempt_baselines()が(selected, evidence_errors)のタプルを返し、run_attemptキーが欠落している baseline はselectedに含まれず、legacy_unverified_run_attempt相当の理由でevidence_errorsに記録される - AC3:
_detect_run_attempt_identity_collisions()の既存契約(missing record と explicitrun_attempt: 1record が同一workflow_run_id/jobで内容不一致なら collision として扱う)が、trust 判定の分離後も保持されている - AC4: core/responsive の双方が missing
run_attemptで除外された場合でも、そのworkflow_run_idが_pair_by_workflow_run_id()のevidence_errorsに残る(all_idsが selected map の key ではなく raw input のworkflow_run_id集合から構築される) - AC5:
_cli_run_details_from_pairs()が_normalize_run_attempt(core) or 1フォールバックを持たず、missing/invalid な attempt からrun_attempt: 1を合成しない - AC6:
_gate_ready_post_filter_sample_count()が_select_initial_attempt_baselines()による attempt selection /workflow_run_iddedupe を適用し、missing attempt・重複workflow_run_id・attempt 2 以降のみのレコードが sample floor を水増しできない - AC7:
.github/workflows/ci.ymlの built-in insufficient-evidence fixture(3 サンプル、run_attemptキーなし)が、本変更後もgate_status: insufficient_evidenceを維持する。除外理由が sample-count 不足からrun_attempt起因(legacy_unverified_run_attempt相当)へ変わることは許容され、そのことを示す回帰テストが追加され PASS する - AC8:
_normalize_run_attempt()と_select_initial_attempt_baselines()の docstring から、これから変更する旧挙動を前提とした記述(「A missing key defaults to 1 and is treated as a TRUSTED attempt-1 candidate」「THIS gate module intentionally still defaults a」)が削除・是正されている - AC9:
_select_initial_attempt_baselines()の missing-key 除外理由が_pair_by_workflow_run_id()のevidence_errorsにマージされ、reason にlegacy_unverified_run_attempt(またはそれに相当する識別可能な文字列)が含まれる - AC10:
docs/dev/e2e-performance-benchmark.mdの「まだ完全には反映していない」という既知制限の記述が、統一後の正しい挙動を反映するよう更新されている - AC11:
tests/ci/配下の全test_ci_performance_gate*.py(test_ci_performance_gate_clock_alignment.pyを含む、実際の call graph 調査で無関係と判明したファイルは無変更で良い)が変更後も PASS する。Ruff(uv run --locked ruff check)も成功することを実装者が確認する(VC preflight の実行可能コマンド allowlist に ruff が含まれないため、本 AC の Ruff 部分は本 Issue の Verification Commands では機械実行しない。pr-reviewer / CI の標準 lint gate で別途確認される)
Verification Commands
AC1: producer-shaped string "1" 受理ロジックが保持されていることの確認(変更しない既存コードなので baseline から PASS が期待される)。
# AC1
# baseline-expect: pass
$ rg -qF "value.isdigit()" tests/ci/test_ci_performance_gate.pyAC1: bool 拒否ロジックが保持されていることの確認(変更しない既存コードなので baseline から PASS が期待される)。
# AC1
# baseline-expect: pass
$ rg -qF "isinstance(value, bool)" tests/ci/test_ci_performance_gate.pyAC2: missing-key trust rejection の新規回帰テスト(新規 Allowed Path ファイルのため baseline では FAIL が期待される)。
# AC2
# baseline-expect: fail
$ pytest tests/ci/test_ci_performance_gate_rerun_attempt_trust_boundary.py::test_missing_run_attempt_is_excluded_with_legacy_unverified_reason -vAC3: 既存の collision grouping 契約が責務分離後も保持されていることの確認(既存テスト)。
# AC3
# baseline-expect: pass
$ pytest tests/ci/test_ci_performance_gate_rerun_attempt_selection.py::test_missing_attempt_baseline_colliding_with_explicit_attempt_1_baseline_is_unaffected_by_grouping -vAC4: core/responsive 双方 missing でも workflow_run_id が evidence_errors から消えないことの新規回帰テスト(新規 Allowed Path ファイルのため baseline では FAIL が期待される)。
# AC4
# baseline-expect: fail
$ pytest tests/ci/test_ci_performance_gate_rerun_attempt_trust_boundary.py::test_both_lanes_missing_run_attempt_do_not_disappear_from_evidence_errors -vAC5: or-1 フォールバックが現行コードから削除されていることの静的確認(negative assertion。現時点ではパターンが存在するため FAIL するのが期待される baseline 挙動)。
# AC5
$ ! rg -qF "_normalize_run_attempt(core) or 1" tests/ci/test_ci_performance_gate.pyAC5: cli_run_details が missing/invalid から attempt 1 を合成しないことの新規回帰テスト(新規 Allowed Path ファイルのため baseline では FAIL が期待される)。
# AC5
# baseline-expect: fail
$ pytest tests/ci/test_ci_performance_gate_rerun_attempt_trust_boundary.py::test_cli_run_details_never_synthesizes_missing_attempt_1 -vAC6: gate-ready lane の sample floor 水増し防止の新規回帰テスト(新規 Allowed Path ファイルのため baseline では FAIL が期待される)。
# AC6
# baseline-expect: fail
$ pytest tests/ci/test_ci_performance_gate_rerun_attempt_trust_boundary.py::test_gate_ready_missing_run_attempt_fails_closed tests/ci/test_ci_performance_gate_rerun_attempt_trust_boundary.py::test_gate_ready_duplicate_workflow_run_ids_do_not_inflate_sample_floor tests/ci/test_ci_performance_gate_rerun_attempt_trust_boundary.py::test_gate_ready_attempt_2_never_substitutes_for_missing_attempt_1 tests/ci/test_ci_performance_gate_rerun_attempt_trust_boundary.py::test_gate_ready_unique_explicit_attempt_1_records_meet_sample_floor -vAC7: built-in insufficient-evidence fixture の失敗理由維持を示す新規回帰テスト(新規 Allowed Path ファイルのため baseline では FAIL が期待される)。
# AC7
# baseline-expect: fail
$ pytest tests/ci/test_ci_performance_gate_rerun_attempt_trust_boundary.py::test_builtin_insufficient_evidence_fixture_remains_insufficient_evidence -vAC8: 旧挙動 docstring 記述1件目の削除確認(negative assertion。現時点ではパターンが存在するため FAIL するのが期待される baseline 挙動)。
# AC8
$ ! rg -qF "A missing key defaults to 1 and is treated as a TRUSTED attempt-1 candidate" tests/ci/test_ci_performance_gate.pyAC8: 旧挙動 docstring 記述2件目の削除確認(negative assertion。現時点ではパターンが存在するため FAIL するのが期待される baseline 挙動)。
# AC8
$ ! rg -qF "THIS gate module intentionally still defaults a" tests/ci/test_ci_performance_gate.pyAC9: _select_initial_attempt_baselines() の除外理由が evidence_errors の reason に legacy_unverified_run_attempt 相当として伝播することの新規回帰テスト(新規 Allowed Path ファイルのため baseline では FAIL が期待される)。
# AC9
# baseline-expect: fail
$ pytest tests/ci/test_ci_performance_gate_rerun_attempt_trust_boundary.py::test_evidence_errors_carry_legacy_unverified_run_attempt_reason -vAC10: docs 既知制限記述の是正確認(negative assertion。現時点では旧記述が存在するため FAIL するのが期待される baseline 挙動)。
# AC10
$ ! rg -qF "まだ完全には反映していない" docs/dev/e2e-performance-benchmark.mdAC11: 全体回帰。
# AC11
# baseline-expect: pass
$ pytest tests/ci/ -k test_ci_performance_gate -qAllowed Paths
- tests/ci/test_ci_performance_gate.py
- tests/ci/test_ci_performance_gate_rerun_attempt_trust_boundary.py
- tests/ci/test_ci_performance_gate_rerun_attempt_selection.py
- tests/ci/test_ci_performance_gate_paired_critical_path.py
- tests/ci/test_ci_performance_gate_evidence_hard_failure.py
- tests/ci/test_ci_performance_gate_comparability_classification.py
- tests/ci/test_ci_performance_gate_fingerprint_validation.py
- tests/ci/test_ci_performance_gate_post_filter_sample_floor.py
- docs/dev/e2e-performance-benchmark.md
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合(例:
scripts/ci/collect_e2e_performance_benchmark.py側の再変更が必要と判明した場合) - In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Required Design References
- docs/dev/e2e-performance-benchmark.md
- PR fix: e2e performance benchmark の rerun attempt 選択を決定論的にする #2182 レビューコメント: fix: e2e performance benchmark の rerun attempt 選択を決定論的にする #2182 (comment)
- Issue 実装: e2e performance benchmark の rerun attempt 選択を順序非依存の決定論的ポリシーにする #2179: 実装: e2e performance benchmark の rerun attempt 選択を順序非依存の決定論的ポリシーにする #2179
Scope Delta(任意)
N/A
Notes for Reviewer
- 本 Issue は PR fix: e2e performance benchmark の rerun attempt 選択を決定論的にする #2182(実装: e2e performance benchmark の rerun attempt 選択を順序非依存の決定論的ポリシーにする #2179 Closes 予定)の OWNER adversarial review に対する fix_delta 内で、collector 側
_classify_run_attemptは是正済みだが gate 側_normalize_run_attemptは 実装: e2e performance benchmark の rerun attempt 選択を順序非依存の決定論的ポリシーにする #2179 の Allowed Paths 外だったため意図的に is-known-limitation としてスコープ外にされた部分の follow-up。 - pr-reviewer sub-agent が独立確認済み(PR fix: e2e performance benchmark の rerun attempt 選択を決定論的にする #2182 comment https://github.com/squne121/loop-protocol/pull/2182#issuecomment-5302595322)。OWNER は collector・gate 双方の是正を要求しており、sibling の out-of-scope finding(P0-4、Issue 実装: 固定SHA benchmark artifact の head_sha 意味論混同を measured_head_sha/workflow_run_head_sha 分離で修正する #2184 として既に起票済み)とは異なり、本 gate 側 gap には追跡先 Issue が無かったため本 Issue を新規起票する。
_normalize_run_attemptの「backward compatibility with baselines collected before this field existed」という docstring 記述は、git log -S"run_attempt"で確認した通り事実誤り(ci_runtime_baseline_v1は導入時点の9574ee5c/実装: CI Runtime Baseline を収集し job / step 単位の所要時間を可視化する #895・implement(#895): CI Runtime Baseline 計測ステップと docs/dev/ci-performance.md を追加する #908 から一貫してrun_attemptを含む)。実際の制約はtest_ci_performance_gate_paired_critical_path.py等の satellite fixture helper がrun_attemptを持たないレコードを構築していたことであり、Issue 実装: e2e performance benchmark の rerun attempt 選択を順序非依存の決定論的ポリシーにする #2179 の Allowed Paths がそれらのファイルを含んでいなかったために fix_delta 時点では対応できなかった。- 調査の結果、
run_attemptキーを持たない fixture helper を持つ satellite ファイルはtest_ci_performance_gate_paired_critical_path.py(_baseline()、_pair_by_workflow_run_idに直接渡る)とtest_ci_performance_gate_evidence_hard_failure.py(_arm_fixture()、run_evidence_gate()経由)の 2 ファイルであることを確認済み。test_ci_performance_gate_clock_alignment.pyはrun_attempt選択ロジックを経由しない別関数(_gate_ready_latency_seconds_from_baseline)のみを使用しており、test_ci_performance_gate_comparability_classification.py/test_ci_performance_gate_post_filter_sample_floor.pyは_select_initial_attempt_baselines/_pair_by_workflow_run_idを直接呼び出していないため、実装時点で影響なしと判明する可能性があるが、Allowed Paths には安全側で含めてある。実装者は各ファイルを調査し、実際に変更が不要であれば無変更のままで良い。 - Scope Collision (C1): overlap preflight(
check_issue_overlap.py)がtests/ci/test_ci_performance_gate.py/tests/ci/test_ci_performance_gate_paired_critical_path.pyを Allowed Paths に含む既存 OPEN Issue 実装: e2e performance benchmark の percentile estimator を before/after/provider/gate-ready 全経路で統一する #2180(percentile estimator 統一)を検出した。non_conflict_reason: 実装: e2e performance benchmark の percentile estimator を before/after/provider/gate-ready 全経路で統一する #2180 はstatistics.median()→nearest_rank_v1の percentile 計算関数の統一が対象であり、本 Issue の対象(_normalize_run_attemptの missing-key 除外ポリシー)とは編集対象の関数・行が異なる。ただし同一ファイルへの並行 PR はマージコンフリクトの可能性があるため、実装順序を先着 PR 優先で調整し、後着側は rebase する運用とする。実装: CI: Playwright E2E の responsive matrix を専用 lane へ分離し critical path を短縮する #2119 / 実装: visual diff AI/VLM triage を非ブロッキング助言として分離する #1390 / 実装: playtest-log の JSON Schema / validator の追加 #420 はtests(broad wildcard)由来の false positive overlap であり実質的な衝突ではない。 - dedupe_key:
pr/2182#issuecomment-5302595322-p0-3-gate-side-normalize-run-attempt - source_kind: post_merge_cleanup style follow-up(PR fix: e2e performance benchmark の rerun attempt 選択を決定論的にする #2182 の adversarial review 由来)
- 2026-08-29: OWNER anchor comment(issuecomment-5316911882、verdict: REQUEST_CHANGES、disposition: reframe_in_place、P0×7/P1×3)を受け、issue-refinement-loop の Step 1 investigation(codebase-investigator)で全指摘を実コードと照合した上で本文を reframe した。investigation で判明した OWNER 指摘との差異: (1)
_normalize_run_attempt()の現行 docstring は「baselines collected before this field existed」という誤った記述ではなく、既に「every baseline has always carried this field」という正しい記述を含んでいた(更新対象は別の旧挙動記述)。(2).github/workflows/ci.ymlの built-in insufficient-evidence fixture は、gate_status: completeを期待する fixture ではなく、意図的に 3 サンプル(MIN_COHORT_RUN_COUNT未満)のinsufficient_evidencefixture であることを確認した。そのため P0-7 の該当懸念は「fail 理由が変わらないことを保証する回帰テスト追加」として扱う。
Activity
squne121 commentedon Aug 15, 2026
create-issue transaction partial-failure
Issue: #2187
Failure stage: dedupe-race-detection
Message: dedupe-search failed
Requested:
Completed steps: create
Failure context: command=gh issue list --repo squne121/loop-protocol --state open --search in:title "実装: e2e performance gate 側の _normalize_run_attempt を missing run_attempt 除外ポリシーに統一する" --limit 200 --json number,title,url
output=Post "https://api.github.com/graphql": dial tcp 20.27.177.116:443: connect: network is unreachable
matching_issue_numbers=[]
issue_number=2187
Recovery hint: dedupe-race-detection — automatic recovery is not possible.
Manual action required: inspect open issues with the same title and decide which to close.
gh issue list --repo squne121/loop-protocol --state open --search '<title>'
idempotent re-run: no (requires manual deduplication first)
Please recover deterministically before re-running the create issue transaction.
fix: _normalize_run_attempt の誤ったコメントを是正し #2187 を追跡先として明記する (fix_delta…
fix: e2e performance benchmark の rerun attempt 選択を決定論的にする (#2182)
squne121 commentedon Aug 17, 2026
結論
Issue #2187 の問題設定自体は正しいです。collector は missing
run_attemptをlegacy_unverified_run_attemptとして trusted cohort から除外する一方、gate は現在も missing を attempt 1 に昇格しています。しかし、Issue の AC・Verification Commands・Allowed Paths のまま実装すると、テストを通しながら provenance laundering、silent evidence loss、sample-count inflation を残せます。Issue は OPEN で、GitHub 検索上は #2187 を実装して閉じる PR はまだ確認できず、#2182 が follow-up として参照している状態です。GitHub Actions では
GITHUB_RUN_IDは rerun 後も不変、GITHUB_RUN_ATTEMPTは 1 から開始して rerun ごとに増加します。したがって missing attempt を推測で1に変換する必要はありません。また、JSON Schema で field を optional のまま読み取れることと、trusted consumer が missing を拒否することは両立します。JSON Schema のdefaultも validation 時に欠落値を注入しません。方向性としては「schema parse compatibility と trust eligibility の分離」が正解です。 (GitHub Docs)P0 ブロッカー
P0-1: AC1・AC3・AC7 の Verification Commands が判定を逆転させる
Issue の AC1、AC3、AC7 は、削除されるべき文字列を単に
rg -cで検索しています。ripgrep は match があれば exit 0、match がなければ exit 1 です。つまり現行の不正なコードでは PASS し、正しく修正すると FAIL します。Issue の機械検証契約として致命的です。 (GitHub)現行 VC の意味は次のように反転しています。
状態 | rg -c "禁止文字列" -- | -- 不正な実装が残存 | exit 0=PASS 正しく削除済み | exit 1=FAILIssue に次の preservation AC が必要です。
これを追加しないと、collector 実装のコピーによって全実 CI baseline が trusted cohort から消える可能性があります。
P0-7: Allowed Paths と repository asset inventory が不足・矛盾している
最も重大な欠落は
tests/ci/test_ci_performance_gate_rerun_attempt_selection.pyです。このファイルが gate-side rerun policy の canonical regression suite であり、missing-vs-explicit-attempt-1 collision test と_cli_run_details_from_pairs()の test を既に所有しています。しかし Issue の Allowed Paths にありません。さらに以下の不整合があります。
Issue は「同ディレクトリ内の新規ファイル」への test 追加を許容するよう記述していますが、Allowed Paths は個別ファイル列挙であり、新規ファイルを許可していません。
docs/dev/e2e-performance-benchmark.mdは Required Design Reference ですが、Allowed Paths にありません。現在の文書には「gate はまだ missing を attempt 1 とする」という既知制限が明記されており、実装後は必ず stale になります。Notes は主に paired-critical-path と evidence-hard-failure の二ファイルが影響するとしていますが、comparability、fingerprint、post-filter fixtures も missing
run_attemptの baseline を selector/pairing 経路へ渡しています。.github/workflows/ci.ymlの built-in insufficient-evidence fixture も、修正後に「3件なので不足」ではなく「missing attempt なので untrusted」という別理由で失敗する可能性があります。workflow を変更しない場合でも、意図した sample-floor failure reason を維持するテストが必要です。推奨 Allowed Paths は次です。
.github/workflows/ci.ymlは次のいずれかを Issue 内で明示的に選ぶべきです。narrow scope で Allowed Paths に追加し、built-in fixture に producer-shaped
"run_attempt": "1"を加える。Out of Scope を維持する代わりに、built-in fixture が引き続き「sample count不足」を主理由として fail-close することを別の regression test で保証する。
test_ci_performance_gate_clock_alignment.pyは現在 run-attempt selector を直接経由していないため、実際の call graph 調査で不要なら Allowed Paths から外してよいです。P1 指摘
P1-1:
pytest -k missing_run_attemptは AC の正確な証明にならないpytest の
-kは、function name だけでなく filename・class name などを含む case-insensitive substring expression です。正確な regression test の存在・実行を保証するには node ID を固定すべきです。また、対象 test が存在しなければ pytest は exit 5 です。 (pytest)推奨:
P1-2: Runtime Verification Applicability がない
対象コードは単なる test helper ではなく、
.github/workflows/ci.ymlから CLI として実行される production-callable evidence gate です。一方、現行 producer は常に
run_attemptを出力するため、missing-key poison branch は live workflow を通常実行しても再現しません。したがって推奨契約は次です。.github/workflows/ci.ymlを実際に変更する場合は、少なくとも workflow syntax/static verification を追加し、上記 decision を再評価すべきです。P1-3: 関連 Issue の実装順を契約化すべき
Issue #2180 は現在 OPEN で、
test_ci_performance_gate.py、paired-critical-path test、設計文書を同時に編集対象とします。機能的には独立ですが、同一ファイルへの並行変更になります。先着 PR 優先、後着側 rebase を Notes だけでなく Delivery Rule に明記すべきです。Issue #2184 は
head_shaの別 trust-boundary 問題であり、現状どおり #2187 から分離する判断は妥当です。また、#2187 の create transaction は dedupe-race-detection で partial failure を記録していますが、現在の exact-title search では該当 Issue は #2187 の一件だけです。この operational comment は non-blocking として「manual dedupe recovered」と整理できます。
推奨する Acceptance Criteria 再定義
以下まで拡張すれば、Issue の目的を実際に証明できます。
AC1 — classification
missing / invalid / ok を区別する gate-side classifier が存在する。
AC2 — producer compatibility
integer
1と producer-shaped string"1"を trusted attempt 1 として受理し、bool/null/0/negative/nonnumeric を拒否する。AC3 — missing rejection with diagnostics
missing record は trusted cohort から除外され、
legacy_unverified_run_attemptが structured evidence error に残る。AC4 — no silent disappearance
core/responsive の双方が missing の場合も、その
workflow_run_idと除外理由が evidence errors に残る。AC5 — collision preservation
missing record と explicit attempt 1 record が同一 identity slot で内容不一致なら、従来どおり collision として sample 全体を除外する。
AC6 — no provenance synthesis
_cli_run_details_from_pairs()その他の出力経路が missing record からrun_attempt: 1または policy 名を合成しない。AC7 — provider lane
provider pairing の片側・両側 missing、attempt 2 only、collision がすべて fail-closed かつ diagnostic-preserving である。
AC8 — gate-ready lane
gate-ready cohort にも initial-attempt selection と
workflow_run_iddedupe を適用し、missing/duplicate/later-attempt で sample floor を水増しできない。AC9 — parse/trust separation
optional schema parsing の成功と trusted-cohort rejection が同時に成立する regression test がある。
AC10 — documentation and full regression
既知制限の文書を現行仕様へ更新し、全 gate tests と Ruff が成功する。
推奨 Verification Commands
workflow fixture を変更する場合のみ追加:
最終 disposition
reframe_in_placeが妥当です。新規 Issue への分割は不要です。#2187 の中心目的は維持しつつ、実装開始前に以下を Issue 本文へ反映すべきです。
Verification Commands の反転修正
classifier と collision grouping の責務分離
structured exclusion diagnostics
_cli_run_details_from_pairs()のor 1削除gate-ready lane への attempt selection/dedupe 適用
producer-shaped string
"1"の preservation ACcanonical rerun test file・設計文書を含む Allowed Paths 拡張
exact node ID による behavioral verification
Runtime Verification Applicability の明示
#2155 はこの gate を用いて実 CI データから上位 Issue を close する downstream verification です。したがって #2187 を単なる fixture cleanup として処理せず、close-decision evidence の trust-boundary correction として扱う必要があります。
## 結論Issue #2187 の問題設定自体は正しいです。collector は missing
run_attemptをlegacy_unverified_run_attemptとして trusted cohort から除外する一方、gate は現在も missing を attempt 1 に昇格しています。しかし、Issue の AC・Verification Commands・Allowed Paths のまま実装すると、テストを通しながら provenance laundering、silent evidence loss、sample-count inflation を残せます。Issue は OPEN で、GitHub 検索上は #2187 を実装して閉じる PR はまだ確認できず、#2182 が follow-up として参照している状態です。GitHub Actions では
GITHUB_RUN_IDは rerun 後も不変、GITHUB_RUN_ATTEMPTは 1 から開始して rerun ごとに増加します。したがって missing attempt を推測で1に変換する必要はありません。また、JSON Schema で field を optional のまま読み取れることと、trusted consumer が missing を拒否することは両立します。JSON Schema のdefaultも validation 時に欠落値を注入しません。方向性としては「schema parse compatibility と trust eligibility の分離」が正解です。 ([GitHub Docs]1)P0 ブロッカー
P0-1: AC1・AC3・AC7 の Verification Commands が判定を逆転させる
Issue の AC1、AC3、AC7 は、削除されるべき文字列を単に
rg -cで検索しています。ripgrep は match があれば exit 0、match がなければ exit 1 です。つまり現行の不正なコードでは PASS し、正しく修正すると FAIL します。Issue の機械検証契約として致命的です。 ([GitHub]2)現行 VC の意味は次のように反転しています。
rg -c "禁止文字列"禁止文字列の検証は、少なくとも明示的な negative assertion に置き換える必要があります。
ただし、静的 grep だけで AC を満たすべきではありません。後述する behavioral regression tests を authoritative verification にし、grep は補助確認へ格下げすべきです。
P0-2: missing の trust rejection と collision grouping が同じ関数に結合されている
現在の
_normalize_run_attempt()は missing を1にし、その同じ戻り値を_detect_run_attempt_identity_collisions()と_select_initial_attempt_baselines()が共有しています。単純に missing をNoneへ変更すると、trust eligibility は改善しますが、collision detector から missing record も消えます。既存の専用 regression test は、次のケースを collision とする契約を明示しています。
run_attemptrun_attempt: 1workflow_run_id/ jobこれは collector 側と同じく、missing をtrusted sample としては拒否するが、衝突検出上だけ attempt 1 slot に置くという意味です。設計文書もこの特殊な collision grouping を明記しています。
必要なのは一行修正ではなく、最低でも次の責務分離です。
使い分けは以下で固定すべきです。
status == "ok" and value == 1のみ既存の
test_missing_attempt_baseline_colliding_with_explicit_attempt_1_baseline_is_unaffected_by_groupingは名称を変更してもよいですが、その挙動自体は保持しなければなりません。P0-3: missing record が evidence error を残さず消える
現行
_select_initial_attempt_baselines()は selected dictionary だけを返します。_pair_by_workflow_run_id()は、その selected dictionary の key の union をall_idsにしています。したがって、両 lane の同じworkflow_run_idがともに missingrun_attemptで除外された場合、raw input に存在した ID 自体がall_idsから消え、evidence_errorsに何も残りません。これはコードから直接導ける silent evidence loss です。起点となった OWNER review は、missing record について次の性質を明示的に要求しています。
legacy_unverified_run_attemptを記録現行 Issue の AC2 は「selected cohort に入らない」ことしか要求しておらず、専用 reason の保存を要求していません。これでは record の欠落と trust rejection を区別できません。
推奨する API は次のどちらかです。
または、
さらに
_pair_by_workflow_run_id()は selected map の key ではなく、raw input のworkflow_run_id集合を authority にする必要があります。必要な negative tests は最低でも次の二つです。
production gate の返却 JSON にも、文字列化された
reasonだけでなく、少なくとも次を保存すべきです。{ "before_evidence_errors": [], "after_evidence_errors": [] }P0-4: assessment serialization に第二の
or 1fail-open が残っている_cli_run_details_from_pairs()は現在、次の fallback を持っています。このため
_normalize_run_attempt()を missing→Noneに修正しても、何らかの経路で missing record が pair に到達すると、assessment 出力時に再び verified attempt 1 へ昇格します。Issue の AC はこの call site を対象にしていません。必須修正は以下です。
or 1を削除する。1であることを検証する。run_attempt: 1またはrerun_attempt_selection_policyが生成されないことをテストする。推奨テスト名:
P0-5: gate-ready lane が rerun-attempt policy を完全に迂回している
run_evidence_gate()の provider lane は_pair_by_workflow_run_id()を経由しますが、gate_ready_baselinesは_gate_ready_post_filter_sample_count()へ直接渡されます。この関数は timestamp が揃った record 数を数えるだけで、run-attempt selection もworkflow_run_iddedupe も行いません。その結果、operator supplied fixture において次が可能です。
run_attemptの gate-ready records が sample floor に算入されるworkflow_run_idを 20 回複製して sample count 20 にできるさらに production-callable gate の sufficient-evidence positive fixtures は、provider baselines と gate-ready baselines の双方で
run_attemptを持たないままgate_status: completeを期待しています。fixture を更新しなければ、実装者はテストを通すために別の fail-open を導入する誘因を持ちます。_gate_ready_post_filter_sample_count()は、最低でも次の契約へ変える必要があります。必須 regression tests:
Issue #2187 の Outcome が「gate 側の missing exclusion policy 統一」である以上、provider lane だけ直し、gate-ready lane を残す実装は不合格です。
P0-6: gate と collector の型ポリシーを機械的に同一化すると実 producer を拒否する
collector の
_classify_run_attempt()は構造化 JSON の integer を受け取り、文字列型を invalid とします。一方 gate の実 producer shape は、workflow の環境変数をos.environ["GH_RUN_ATTEMPT"]から JSON に書くため"1"という文字列です。現行 gate はこの数値文字列を意図的に受理し、PR #2182 の再レビューでも collector との差異は intentional/non-blocking と確認されています。したがって「collector と同じポリシーに統一」は、次の意味に限定しなければなりません。
gate 側の推奨 decision table:
1"1"2+null/ bool /0/ negative / nonnumericIssue に次の preservation AC が必要です。
これを追加しないと、collector 実装のコピーによって全実 CI baseline が trusted cohort から消える可能性があります。
P0-7: Allowed Paths と repository asset inventory が不足・矛盾している
最も重大な欠落は
tests/ci/test_ci_performance_gate_rerun_attempt_selection.pyです。このファイルが gate-side rerun policy の canonical regression suite であり、missing-vs-explicit-attempt-1 collision test と_cli_run_details_from_pairs()の test を既に所有しています。しかし Issue の Allowed Paths にありません。さらに以下の不整合があります。
docs/dev/e2e-performance-benchmark.mdは Required Design Reference ですが、Allowed Paths にありません。現在の文書には「gate はまだ missing を attempt 1 とする」という既知制限が明記されており、実装後は必ず stale になります。run_attemptの baseline を selector/pairing 経路へ渡しています。.github/workflows/ci.ymlの built-in insufficient-evidence fixture も、修正後に「3件なので不足」ではなく「missing attempt なので untrusted」という別理由で失敗する可能性があります。workflow を変更しない場合でも、意図した sample-floor failure reason を維持するテストが必要です。推奨 Allowed Paths は次です。
.github/workflows/ci.ymlは次のいずれかを Issue 内で明示的に選ぶべきです。"run_attempt": "1"を加える。test_ci_performance_gate_clock_alignment.pyは現在 run-attempt selector を直接経由していないため、実際の call graph 調査で不要なら Allowed Paths から外してよいです。P1 指摘
P1-1:
[pytest](https://docs.pytest.org/en/stable/how-to/usage.html) -k missing_run_attemptは AC の正確な証明にならないpytest の
-kは、function name だけでなく filename・class name などを含む case-insensitive substring expression です。正確な regression test の存在・実行を保証するには node ID を固定すべきです。また、対象 test が存在しなければ pytest は exit 5 です。 (pytest)推奨:
P1-2: Runtime Verification Applicability がない
対象コードは単なる test helper ではなく、
.github/workflows/ci.ymlから CLI として実行される production-callable evidence gate です。一方、現行 producer は常に
run_attemptを出力するため、missing-key poison branch は live workflow を通常実行しても再現しません。したがって推奨契約は次です。.github/workflows/ci.ymlを実際に変更する場合は、少なくとも workflow syntax/static verification を追加し、上記 decision を再評価すべきです。P1-3: 関連 Issue の実装順を契約化すべき
Issue #2180 は現在 OPEN で、
test_ci_performance_gate.py、paired-critical-path test、設計文書を同時に編集対象とします。機能的には独立ですが、同一ファイルへの並行変更になります。先着 PR 優先、後着側 rebase を Notes だけでなく Delivery Rule に明記すべきです。Issue #2184 は
head_shaの別 trust-boundary 問題であり、現状どおり #2187 から分離する判断は妥当です。また、#2187 の create transaction は dedupe-race-detection で partial failure を記録していますが、現在の exact-title search では該当 Issue は #2187 の一件だけです。この operational comment は non-blocking として「manual dedupe recovered」と整理できます。
推奨する Acceptance Criteria 再定義
以下まで拡張すれば、Issue の目的を実際に証明できます。
AC1 — classification
missing / invalid / ok を区別する gate-side classifier が存在する。
AC2 — producer compatibility
integer
1と producer-shaped string"1"を trusted attempt 1 として受理し、bool/null/0/negative/nonnumeric を拒否する。AC3 — missing rejection with diagnostics
missing record は trusted cohort から除外され、
legacy_unverified_run_attemptが structured evidence error に残る。AC4 — no silent disappearance
core/responsive の双方が missing の場合も、その
workflow_run_idと除外理由が evidence errors に残る。AC5 — collision preservation
missing record と explicit attempt 1 record が同一 identity slot で内容不一致なら、従来どおり collision として sample 全体を除外する。
AC6 — no provenance synthesis
_cli_run_details_from_pairs()その他の出力経路が missing record からrun_attempt: 1または policy 名を合成しない。AC7 — provider lane
provider pairing の片側・両側 missing、attempt 2 only、collision がすべて fail-closed かつ diagnostic-preserving である。
AC8 — gate-ready lane
gate-ready cohort にも initial-attempt selection と
workflow_run_iddedupe を適用し、missing/duplicate/later-attempt で sample floor を水増しできない。AC9 — parse/trust separation
optional schema parsing の成功と trusted-cohort rejection が同時に成立する regression test がある。
AC10 — documentation and full regression
既知制限の文書を現行仕様へ更新し、全 gate tests と Ruff が成功する。
推奨 Verification Commands
uv run --locked pytest \ tests/ci/test_ci_performance_gate.py \ tests/ci/test_ci_performance_gate_*.py \ -quv run --locked ruff check \ tests/ci/test_ci_performance_gate.py \ tests/ci/test_ci_performance_gate_*.pyworkflow fixture を変更する場合のみ追加:
uv run --locked python3 -c \ 'import yaml; yaml.safe_load(open(".github/workflows/ci.yml")); print("workflow_yaml_ok")'最終 disposition
reframe_in_placeが妥当です。新規 Issue への分割は不要です。#2187 の中心目的は維持しつつ、実装開始前に以下を Issue 本文へ反映すべきです。
_cli_run_details_from_pairs()のor 1削除"1"の preservation AC#2155 はこの gate を用いて実 CI データから上位 Issue を close する downstream verification です。したがって #2187 を単なる fixture cleanup として処理せず、close-decision evidence の trust-boundary correction として扱う必要があります。
squne121 commentedon Aug 28, 2026
root-owned entry router audit
route: invoke_impl_review_loop
reason: fresh_review_go_live_equality
squne121 commentedon Aug 28, 2026
implement-issue: 実装完了 (2026-08-29)
.claude/worktrees/issue-2187-run-attempt-trust-boundaryworktree-issue-2187-run-attempt-trust-boundary26a1a396335e1ecd0b9de48fd02b575172cb73bcpytest tests/ci/ -k test_ci_performance_gate -q→ 52 passed, 3 skipped(既存の Runtime Verification Applicability SKIP)ruff check tests/ci/test_ci_performance_gate*.py→ All checks passedtests/ci/test_ci_performance_gate_rerun_attempt_trust_boundary.py)は追加前 collect error(baseline-expect: fail 相当)→ 追加後 PASSfix: gate-ready evidence_errors の欠落と missing/invalid/collision 分類の不完全…
squne121 commentedon Aug 28, 2026
fix_delta 完了報告(OWNER REQUEST_CHANGES on PR #2383, issuecomment-5458167419)
PR #2383 の head を
8f4d4a29a38be5ad0706698ea5e32cd0d3c4f3f5に更新しました。詳細は PR コメント(https://github.com/squne121/loop-protocol/pull/2383#issuecomment-5458288317)を参照してください。サマリ:
run_evidence_gate()production path で_gate_ready_post_filter_sample_count()のevidence_errorsが捨てられていた問題を修正し、gate_ready_evidence_errorsとして production result に構造化して残すようにしました。_select_initial_attempt_baselines()の missing/invalid/attempt2以降のみ/collision 分類が不完全だった点を_classify_run_attempt_trusted()classifier で補完し、silent exclusion を固定していた既存回帰テスト2件を反転しました。.github/workflows/ci.ymlの実フィクスチャ自体は Out of Scope のため変更なし)。_dedupe_by_workflow_run_id()の evidence_errors 破棄経路が count-only exploratory path であることを docstring で明記。tests/ci/test_ci_performance_gate*.py全PASS(67 passed, 7 skipped fortests/ci/全体)、Ruff PASS。Issue #2187 の AC1〜AC11 Verification Commands も再実行し全て PASS を確認済みです。fix: e2e performance gate 側の _normalize_run_attempt を missing run_att…