Skip to content

実装: CI: machine-readable lane-impact classifier を導入し非適用 heavy test lane を fail-closed で省略する #2120

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "変更内容と無関係な python_unit / integration test の全量実行を避け、required check 名と fail-closed semantics を維持したまま PR CI の平均待ち時間を短縮する"
change_kind: ci-policy-and-tooling

Parent Issue

none

(Depends on #2119: 先行してPRのE2E check topologyをprovider + aggregate構造へ移行する。詳細は Outcome を参照)

Parent Goal Ref

  • Goal: 変更内容と無関係な python_unit / integration test の全量実行を避け、required check 名と fail-closed semantics を維持したまま PR CI の平均待ち時間を短縮する。
  • Desired Destination: N/A(単独改善のため親 Issue の Desired Destination なし)。

Current Validated Scope

Remaining Parent Gaps

なし(単独改善のため親 Issue の残存ギャップなし)。

Outcome

canonical machine-readable ci-lane-impact-policy/v1 と deterministic classifier を導入する。classifier は trusted base SHA / head SHA の diff から各lane を required / not_applicable / unknown のいずれかに分類する。unknown は必ず required 相当に fail-safe escalation する。heavy provider job のみ applicability に応じて省略し、required status check 名である aggregate job は常に実行する。成果物は .github/ci/ci-lane-impact-policy.json、scripts/ci/ci_lane_impact.py、更新された .github/workflows/ci.yml、それらを含む Draft PR。完了条件は全ACのVC PASSとPR作成。Depends on #2119(先行してPRのE2E check topologyをprovider + aggregate構造へ移行する)。

In Scope

  • machine-readable lane policyの追加。
  • Markdown decision matrixをmachine policyのgenerated projectionまたはparity-validated documentに変更する。
  • base/head SHA、rename/deleteを含むchanged-path representation、policy version、changed-path digestを持つ CI_LANE_IMPACT_DECISION_V1 artifactを追加する。
  • python_unitとintegration/E2Eのheavy provider job executionをapplicabilityで制御する。
  • python-test / e2e aggregate jobsはcheck名を維持して if: always() で実行する。
  • explicit not_applicableと、unexpected skipped / cancelled / missingを区別する。
  • global invalidatorを定義する。
  • unmapped path / unknown path / policy parse failureはfull executionへescalationする。
  • shadow modeでclassifier decisionを記録しつつfull CIを継続し、decision/evidence parityを検証した後にskip enforcementを有効化する。

Initial Policy Invariants

  • .github/workflows/**、test-runner config、package/lockfile、lane policy自身の変更はbroad/full executionとする。
  • product runtime changeはintegration/E2Eを省略しない。
  • Python/control-plane changeはpython_unitを省略しない。
  • unknown/unmapped pathを「影響なし」と推測しない。
  • renameはold pathとnew pathのunionで分類する。
  • deletionも変更として分類する。
  • classifier自身が失敗した場合はheavy testsを省略しない。
  • PR bodyの自己申告をapplicability authorityに使用しない。

Out of Scope

  • workflow-level paths / paths-ignoreによるrequired workflowの省略。
  • arbitrary dependency graph inference。
  • dynamic importを完全解析できるという主張。
  • visual-impact-policy / trusted-consumer authorityの置換。
  • test failureを理由とした自動quarantine。
  • test coverageの削減。
  • build / typecheckのような30秒未満の既存fast checksの省略最適化。

Acceptance Criteria

  • AC1: ci-lane-impact-policy/v1がcanonical machine-readable SSOTとなり、Markdown matrixとのdriftをCIが検出する。
  • AC2: decision artifactがbase SHA / head SHA / changed-path digest / policy digest / per-lane decision / reason codeを保持する。
  • AC3: unknown property、unknown path class、malformed policy、classifier failureはheavy laneのnot_applicableを生成できない。
  • AC4: .github/workflows/ci.yml変更fixtureは全heavy lane requiredになる。
  • AC5: src/**/*.ts(x)のみのfixtureはintegration required、python_unit not_applicableになる。
  • AC6: Python/control-plane-only fixtureはpython_unit required、integration not_applicableになる。
  • AC7: PR #2105相当のchanged-path fixtureがintegration/E2E not_applicableと判定される。
  • AC8: unknown path fixtureはfull executionへescalationする。
  • AC9: cross-domain rename fixtureはold/newの双方を評価して必要laneのunionを取る。
  • AC10: provider jobがnot_applicableの場合でもaggregate python-test / e2e checkはsuccess conclusionとmachine-readable reasonを発行する。
  • AC11: providerが本来requiredなのにskipped/missing/cancelledの場合、aggregateはfailureになる。
  • AC12: ci-verdict-summaryがnot_applicableとabnormal skipを区別する。
  • AC13: workflow全体にon.pull_request.paths / paths-ignoreを追加しない。
  • AC14: shadow mode 20 PR以上でdecision artifactと実際のfull-run evidenceを収集し、false-negative lane skipが0件であることを確認してからenforcementを有効化する。
  • AC15: enforcement後の同一change-class cohortでP50 critical-path改善を計測し、P95 correctness/flakiness regressionがない。
  • AC16: existing visual-impact-policy / trusted consumer / artifact provenanceを弱化しない。

Verification Commands

Fixture matrixには最低限以下を含める: python-control-plane-only, product-src-only, workflow-change, package-or-lockfile-change, unknown-path, rename-python-to-product, deleted-global-invalidator, mixed-python-and-product

# AC1
# AC2
$ uv run --locked pytest scripts/ci/tests/test_ci_lane_impact_policy.py -q

# AC3
# AC4
# AC5
# AC6
# AC7
# AC8
# AC9
$ uv run --locked pytest scripts/ci/tests/test_ci_lane_impact_classifier.py -q

# AC10
# AC11
# AC12
$ uv run --locked pytest .claude/skills/pr-review-judge/scripts/tests/test_ci_verdict_summary_v2.py -q

# AC13
$ actionlint .github/workflows/ci.yml

# AC14
# AC15
# AC16
$ pnpm test

# AC13
$ pnpm typecheck

Allowed Paths

  • .github/workflows/ci.yml
  • .github/ci/ci-lane-impact-policy.json
  • .github/ci/ci-lane-impact-policy.schema.json
  • scripts/ci/ci_lane_impact.py
  • scripts/ci/tests/test_ci_lane_impact_policy.py
  • scripts/ci/tests/test_ci_lane_impact_classifier.py
  • .claude/skills/ci-test-performance/SKILL.md
  • .claude/skills/ci-test-performance/references/decision-matrix.md
  • docs/dev/test-lane-policy.md
  • .claude/skills/pr-review-judge/scripts/ci_verdict_summary_v2.py
  • .claude/skills/pr-review-judge/scripts/tests/test_ci_verdict_summary_v2.py

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • safe-skipを証明できないpath classをnot_applicableにする必要が生じた場合。
  • aggregate required check名を変更しないと実装できない場合。
  • top-level workflow path filteringが必要になる場合。
  • candidate PRの自己申告をauthorityとして利用する必要が生じた場合。
  • visual trusted-consumerのtrust boundaryを弱める必要が生じた場合。
  • shadow modeでpredicted not_applicable laneにcorrectness failureが観測された場合。
  • current branch/ruleset required-check topologyとaggregate designが両立しない場合。

Required Skills

  • ci-test-performance
  • GitHub Actions
  • Python

Required Design References

  • .claude/skills/ci-test-performance/SKILL.md
  • .claude/skills/ci-test-performance/references/decision-matrix.md
  • .github/ci/python-test-plan.json
  • .github/workflows/ci.yml
  • docs/dev/test-lane-policy.md

Scope Delta(任意)

N/A

Runtime Verification Applicability

decision: immediate
execution_environment: "GitHub Actions"
applicable_acs: [AC10, AC11, AC12, AC14, AC15, AC16]
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

    agent/implementerenhancementphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions