Skip to content

実装: CI reliability assessment(failure/flaky rate)の versioned schema と raw-attempt 基準の validator を新設する(Issue B) #2170

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#2119"
goal_ref: "CI reliability(workflow failure rate / Playwright flaky rate / terminal failure rate)の versioned schema と raw-attempt 基準の validator を新設し、#2155 が親 #2119 AC10 を実データで検証できるようにする"
change_kind: feature

Parent Issue

#2119

Parent Goal Ref

Scope Split History

本 Issue は #2159(e2e performance benchmark の fixed-SHA cohort・paired critical path・cross-run collector・immutable manifest 再設計)に対する OWNER 敵対的レビュー(issuecomment-5293380230)が推奨した Issue 分割(Issue A = #2159、Issue B = 本 Issue)の Issue B にあたる。#2159 の AC9 は当初「validator に failure/flaky rate 検証を追加する」または「親 #2119 の AC10 記述を改訂する」という未決定の二者択一だったが、後者は #2159 自身の Stop Conditions と矛盾するため #2159 からは削除し、reliability 契約そのものを本 Issue で独立して定義する。

Current Validated Scope

Remaining Parent Gaps

Blocks

#2155(#2155 は #2159 と本 Issue の close 後に実データ検証を再開する。#2155 の Allowed Paths は「なし」のまま変更しない)

Background

OWNER レビュー(issuecomment-5293380230)で指摘された、reliability 関連の主要な欠陥は以下の通り(P0-1, P0-8)。

  • 親 実装: CI: Playwright E2E の responsive matrix を専用 lane へ分離し critical path を短縮する #2119 の AC10「P95 failure/flaky rate」は、P95 が修飾する対象(latency か failure rate か flaky rate か)、failure の観測単位(workflow / job / Playwright test)、flaky の分母(logical test 数 / test invocation 数 / run 数)、Playwright retry と GitHub Actions workflow rerun の区別、cancelled/timed_out/infrastructure failure の扱い、before が 0 件 failure の場合の統計規則、非劣性 margin、必要 sample 数のいずれも未定義。
  • Playwright の標準用語では、flaky は「最初に失敗し retry で成功」、failed は「全 retry 後も失敗」。GitHub Actions の workflow rerun は Playwright retry とは別物であり、flaky test として混同してはならない。
  • 20 run では低頻度 failure の非悪化を強く証明できない(0 failures / 20 runs でも Clopper–Pearson 両側 95% exact interval の上限は約 16.8%)。sample 数を power analysis で決めるか、AC10 を記述的観測に弱める必要がある。
  • (run_id, run_attempt) の dedupe だけでは rerun 水増しを防げない。reliability の独立 sample 単位は workflow_run_id にすべきで、かつ reliability は attempt 1 の terminal outcome を採用し、rerun は「介入」として別記録する必要がある(successful-run latency とは異なるサンプリング規則)。

Outcome

CI_TEST_RELIABILITY_ASSESSMENT_V1(versioned schema)と、raw attempt データから workflow failure rate / Playwright flaky test rate / Playwright terminal failure rate を計算し、事前宣言した非劣性 margin・confidence level・sample size rule に基づいて non-inferiority 判定を行う validator を新設した状態。既存 CI_TEST_PERFORMANCE_ASSESSMENT_V2 の schema・validator は変更しない(別 schema として追加)。

In Scope

  • schemas/ci_test_reliability_assessment_v1.schema.json を新設し、以下を含む CI_TEST_RELIABILITY_ASSESSMENT_V1 を定義する:
    • reliability_metrics.workflow_failure_rate(分子: terminal failure workflow run 数、分母: eligible unique workflow_run_id 数)
    • reliability_metrics.playwright_flaky_test_rate(分子: 初回失敗・retry で成功した logical test 数、分母: 実行された logical test 数)
    • reliability_metrics.playwright_terminal_failure_rate(分子: 全 retry 後も失敗した logical test 数、分母: 実行された logical test 数)
    • sample_identity(key: workflow_run_id、required_run_attempt: 1、rerun は record するが独立 sample として数えない)
    • confidence_level / non_inferiority_margin / sample_count_rule(power-derived であることを明示し、20 固定を既定にしない)
  • schemas/catalog.yaml に新 schema を登録する。
  • .claude/skills/ci-test-performance/scripts/ に reliability validator(validate_ci_reliability_assessment_v1.py 等)を新設し、raw attempt データから 3 指標を再計算し、自己申告値との一致を検証する。
  • cancelled / timed_out / infrastructure failure を terminal failure と区別する分類ロジックを実装する。
  • before が 0 failure の場合を含む non-inferiority 判定に Clopper–Pearson exact interval(または同等の厳密区間推定)を使用する。
  • fixtures/ に positive/negative fixture(有効な reliability assessment、分母不正、retry と rerun の混同、cancelled/timed_out の誤分類等)を追加する。
  • docs/dev/ci-test-reliability-assessment.md に reliability_metrics の用語定義・分母・retry semantics・非劣性判定方式を記述する。

Out of Scope

Acceptance Criteria

  • AC1: schemas/ci_test_reliability_assessment_v1.schema.json が reliability_metrics.workflow_failure_rate / playwright_flaky_test_rate / playwright_terminal_failure_rate の分子・分母を明示的なフィールドとして定義している。
  • AC2: schema が sample_identity.key: workflow_run_id と required_run_attempt: 1 を持ち、rerun attempt を追加 sample として数えない規約を明示している。
  • AC3: schema が confidence_level / non_inferiority_margin / sample_count_rule(power-derived であることの明示)を必須フィールドとして持つ。
  • AC4: schemas/catalog.yaml に ci_test_reliability_assessment_v1 が登録されている。
  • AC5: reliability validator が raw attempt データ(run_details[] 相当)から 3 指標を再計算し、assessment 記載の自己申告値との一致を検証する。
  • AC6: validator が Playwright flaky(初回失敗・retry で成功)と GitHub Actions workflow rerun を明確に区別し、rerun を flaky test として誤集計しない。
  • AC7: validator が cancelled / timed_out / infrastructure failure を terminal failure と区別して分類する。
  • AC8: validator が before 側 0 failure のケースを含め、Clopper–Pearson exact interval(または同等の厳密区間推定)で non-inferiority 判定を行う。
  • AC9: fixtures/ に positive fixture 1件以上、negative fixture(分母不正・retry/rerun 混同・cancelled 誤分類の 3 種以上)が存在し、validator がそれぞれ期待通り accept/reject する。
  • AC10: docs/dev/ci-test-reliability-assessment.md が reliability_metrics の用語・分母・retry semantics・非劣性判定方式を記述している。

Verification Commands

# AC1
# baseline-expect: fail
$ rg -n "workflow_failure_rate" schemas/ci_test_reliability_assessment_v1.schema.json

# AC2
# baseline-expect: fail
$ rg -n "workflow_run_id" schemas/ci_test_reliability_assessment_v1.schema.json

# AC3
# baseline-expect: fail
$ rg -n "non_inferiority_margin" schemas/ci_test_reliability_assessment_v1.schema.json

# AC4
$ rg -n "ci_test_reliability_assessment_v1" schemas/catalog.yaml

# AC5
$ uv run --locked pytest .claude/skills/ci-test-performance/scripts/tests/test_validate_ci_reliability_assessment_v1.py -k "recomputed_from_raw_attempts" -q

# AC6
$ uv run --locked pytest .claude/skills/ci-test-performance/scripts/tests/test_validate_ci_reliability_assessment_v1.py -k "rerun_not_counted_as_flaky" -q

# AC7
$ uv run --locked pytest .claude/skills/ci-test-performance/scripts/tests/test_validate_ci_reliability_assessment_v1.py -k "cancelled_timed_out_classification" -q

# AC8
$ uv run --locked pytest .claude/skills/ci-test-performance/scripts/tests/test_validate_ci_reliability_assessment_v1.py -k "clopper_pearson_zero_failure" -q

# AC9
$ uv run --locked pytest .claude/skills/ci-test-performance/scripts/tests/test_validate_ci_reliability_assessment_v1.py -q

# AC10
# baseline-expect: fail
$ test -f docs/dev/ci-test-reliability-assessment.md

Allowed Paths

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • .github/workflows/ci.yml への producer 配線(raw attempt データ収集経路の実装)が必要と判明した場合(別途 follow-up とし、本 Issue のスコープを拡張しない)
  • 親 実装: CI: Playwright E2E の responsive matrix を専用 lane へ分離し critical path を短縮する #2119 の AC10 本文改訂が必要と判明した場合(別途 follow-up Issue とし、本 Issue のスコープを拡張しない)
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

  • ci-test-performance

Required Design References

  • docs/dev/test-lane-policy.md
  • docs/dev/runtime-verification-policy.md
  • .claude/skills/ci-test-performance/scripts/validate_ci_performance_assessment_v2.py
  • schemas/ci_test_performance_assessment_v2.schema.json

Runtime Verification Applicability

decision: immediate
applicable_acs:
  - AC1
  - AC2
  - AC3
  - AC4
  - AC5
  - AC6
  - AC7
  - AC8
  - AC9
  - AC10
execution_environment:
  cli_tools:
    - python3
    - uv
    - rg
  auth_required: false
  network_required: false
skip_conditions:
  - "本 Issue は fixture ベースで検証可能であり、実 GitHub Actions run history への依存がないため SKIP 条件は原則発生しない"
fallback_policy:
  fallback_success_is_pass: false
  notes: "fallback 経由の成功を PASS に変換しない"
artifact_requirements:
  - "pytest output"
  - "schemas/ci_test_reliability_assessment_v1.schema.json への fixture validation 結果"

Scope Delta(該当時のみ記載)

Delivery Rule

1 Issue = 1 PR を原則とする。

Source

Activity

  1. squne121 commented on Aug 14, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: approved

    修正内容の要約

    1. Runtime Verification Applicability: decision: immediate に対応する <!-- runtime-verification: true --> タグを全 AC(1-10) に付与。
    2. 新規 Allowed Path(schemas/ci_test_reliability_assessment_v1.schema.json、docs/dev/ci-test-reliability-assessment.md)を対象とする rg / test -f VC(AC1, AC2, AC3, AC10)に # baseline-expect: fail 注釈を付与(run_refinement_preflight.py の deterministic repair 診断と一致)。
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations: []
    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: blocked
        gate_result: missing_go
        latest_comment_url: ""
        generated_at: ""
        body_sha256: ""
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "label mutation not attempted by issue-refinement-loop"
      auto_fixes:
        result: auto_fixed
        required:
          - kind: known_marker_fix
            executor: implementation-worker
            result: applied
            evidence:
              before: "sha256:79228c4753909bb49986bba0935e530e8e155cc28c244f2f686beada3a51a72d"
              after: "sha256:6307e89bc1c22a492e550439a00b95764cde1ece499a7cd150b8b37bd94c2c4d"
              comment_url: ""
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-08-14T13:20:06Z"
      checked_body_sha256: "sha256:6307e89bc1c22a492e550439a00b95764cde1ece499a7cd150b8b37bd94c2c4d"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
  2. squne121 commented on Aug 14, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了

  3. squne121 commented on Aug 14, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-08-15T00:00:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2175"
      head_sha: "1d85a3e2a5f9af24640179b1140b187373905786"
      issue_number: 2170
      termination_reason: approved
      merge_ready: true
      iteration: 1
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations: []
  4. squne121 commented on Aug 14, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-08-15T00:00:00Z、OWNER敵対的レビュー対応)

    今回の修正内容

    • P0-1: 非劣性検定を単一比率チェックから Newcombe/Wilson hybrid-score による二標本比較(risk difference, one-sided)へ全面書き換え。before/after 両方の required_sample_count 充足を必須化。レビュー指摘の false-PASS シナリオ(before=1/1, after=20/20, margin=0.01)が inconclusive になることを実関数呼び出しで確認。
    • P0-2: workflow_run_id(run_attempt=1)および (workflow_run_id, run_attempt) の重複を hard-reject(silent dedupe ではない)。
    • P1: expected_status フィールド追加、attempt_number 順序性検証、two-sided/one-sided Clopper-Pearson の混同を修正し sidedness/effect_measure フィールドを追加。
    • 回帰テスト33件(レビュー指定の5件を含む)追加、全PASS。CI 21/21 green。
    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2175"
      head_sha: "9875d204dad41775c1df83bc0d126fb51f4e65c1"
      issue_number: 2170
      termination_reason: approved
      merge_ready: true
      iteration: 2
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    phase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions