Skip to content

feat: cloud_pilot_success_result/v1 の checker/schema/negative fixture を実装する - #1371

Merged
squne121 merged 7 commits into
mainfrom
worktree-issue-1364-cloud-pilot-success-result
Jul 7, 2026
Merged

squne121 merged 7 commits into
mainfrom
worktree-issue-1364-cloud-pilot-success-result

Conversation

@squne121

@squne121 squne121 commented Jul 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

ADR 0005(hybrid_reference_from_agent_run_report)が follow_up_issue_ref として予約していた
cloud_pilot_success_result/v1 の JSON Schema・checker・negative fixture を実装した。
schema validation(Ajv 2020-12、unevaluatedProperties: false による closed shape)と
semantic checker(digest 再計算 / marker 制約 / gate evidence field-level 照合 /
forbidden field 再帰 scan)を単一ファイル(scripts/check-cloud-pilot-success-result.mjs)内で
責務分離して実装した。正例 3 件・負例 26 件、計 29 fixture を追加し、各負例 fixture 名と
stable error code を Vitest it.each テーブルで 1:1 対応させた(AC20)。

Issue #1364 への OWNER 敵対的レビュー(8 blocker)にすべて対応している:

  1. success_contract_checker(実装: cloud_pilot_success_contract_v1 の checker/schema/negative fixtureを実装する #1326) が OPEN のため、正例は decision_ready: false /
    evidence_mode: fixture_only を明示し adopt_cloud / cloud_adoption_allowed_now: true を
    含まない(AC11)。実装: cloud_pilot_success_contract_v1 の checker/schema/negative fixtureを実装する #1326 gate_ref が open のまま real target として提示された場合は
    fail-closed(AC12)
  2. schema は closed shape 検証のみ、digest / marker / gate / forbidden scan は semantic
    checker 側の責務として分離した(AC13)
  3. digest canonicalization の positive equivalence(key 順入替・NFC/NFD)と negative
    mismatch(optional null vs absent・timestamp offset・number exponent・digest input に
    marker を含める)の両方を fixture で検証する(AC14, AC15)
  4. comment payload は JSON code fence のみ許可し、YAML は fail-closed(AC16)
  5. outer/digest marker の exactly-one 制約・fenced block 数・marker injection 耐性を
    検証する(AC17)
  6. duplicate marker comment / stale digest / target 種別不一致を fixture で検証する
    (AC18。GitHub API 呼び出しは Out of Scope のため、upsert_probe という declarative
    simulation field で表現している)
  7. forbidden field 再帰 scanner は dotted key / camelCase / nested / array 内 / 文字列内
    raw trace-id / all-zero trace-id / raw trace-id な public_correlation_id を検出する
    (AC19)
  8. VC の各 fixture 名・error code・期待 exit を明記し、Vitest it.each で 1:1 対応させた
    (AC20)

Checks

  • pnpm typecheck: PASS
  • pnpm lint: PASS
  • pnpm test: PASS(93 files / 1463 tests、新規 tests/cloud-pilot-success-result-check.test.ts の
    36 tests を含む)
  • pnpm build: PASS
  • AC1: test -f docs/schemas/cloud-pilot-success-result.schema.json PASS
  • AC2: test -f scripts/check-cloud-pilot-success-result.mjs PASS
  • AC3: test -d tests/fixtures/cloud-pilot-success-result PASS
  • AC4-AC20: pnpm run cloud-pilot-success-result:check を fixtures ディレクトリ全体に対して実行し、
    正例 3 件が PASS、負例 26 件が期待した error code で FAIL することを確認済み
    (node scripts/check-cloud-pilot-success-result.mjs の実行結果を目視確認)

受け入れ条件の達成状況

全 20 件の Acceptance Criteria が PASS している(詳細な検証コマンドと fixture 対応は上記
## Checks および Issue #1364 本文の ## Verification Commands を参照)。

AC 状態 検証根拠
AC1 PASS test -f docs/schemas/cloud-pilot-success-result.schema.json
AC2 PASS test -f scripts/check-cloud-pilot-success-result.mjs
AC3 PASS test -d tests/fixtures/cloud-pilot-success-result
AC4 PASS fixture valid-fixture-only.md が checker で exit 0
AC5 PASS fixture invalid-missing-required-key.md が error schema.required で非 0 exit
AC6 PASS fixture invalid-gate-ref-evidence-mismatch.md が error gate_ref.evidence_mismatch で非 0 exit
AC7 PASS fixture invalid-target-marker-mismatch.md が error target.marker_mismatch で非 0 exit
AC8 PASS fixture invalid-digest-canonicalization.md が error digest.mismatch で非 0 exit
AC9 PASS fixture invalid-forbidden-field-tracestate.md が error forbidden_field で非 0 exit
AC10 PASS tests/cloud-pilot-success-result-check.test.ts が AC4-AC9 を全て Vitest で検証し pnpm test PASS
AC11 PASS 正例 fixture が evidence_mode: fixture_only を明示、負例 invalid-adoption-ready-field-injected.md が evidence_mode.violation で fail
AC12 PASS fixture invalid-gate-1326-open-real-target.md が error gate_ref.not_completed で非 0 exit
AC13 PASS fixture invalid-unevaluated-property.md が error schema.unevaluated_property で非 0 exit
AC14 PASS fixture valid-key-order-permuted.md / valid-unicode-nfc-nfd-equivalent.md が digest 一致で exit 0
AC15 PASS fixture 4 件(invalid-optional-null-vs-absent.md 等)が error digest.mismatch で非 0 exit
AC16 PASS fixture invalid-yaml-payload-rejected.md が error payload.non_json_rejected で非 0 exit
AC17 PASS fixture 3 件(invalid-outer-marker-duplicate.md 等)が error marker.constraint_violation で非 0 exit
AC18 PASS fixture 3 件(invalid-duplicate-marker-comment.md 等)が対応 error code で非 0 exit
AC19 PASS fixture 7 件(forbidden field 各パターン)が forbidden_field / trace_id.raw_forbidden で非 0 exit
AC20 PASS tests/cloud-pilot-success-result-check.test.ts の it.each テーブルが全負例 fixture と error code を 1:1 対応させ pnpm test PASS

Allowed Paths 遵守

Issue #1364 の ## Allowed Paths に定義された 5 エントリのみを変更しており、Allowed Paths 外の
変更はない。

  • docs/schemas/cloud-pilot-success-result.schema.json — 新規追加(Allowed Paths 一致)
  • scripts/check-cloud-pilot-success-result.mjs — 新規追加(Allowed Paths 一致)
  • tests/cloud-pilot-success-result-check.test.ts — 新規追加(Allowed Paths 一致)
  • tests/fixtures/cloud-pilot-success-result/**(29 fixture ファイル) — 新規追加(Allowed Paths
    tests/fixtures/cloud-pilot-success-result/** に一致)
  • package.json — cloud-pilot-success-result:check script エントリ追加(Allowed Paths 一致)

scripts/lib への helper file 分離は行っておらず(Issue の Stop Condition 該当を回避するため
checker を単一ファイルに閉じている)、ADR 0005 本文・docs/schemas/agent-run-report.schema.json
本体など Out of Scope 対象への変更もない。

Schema Change Applicability

  • decision: schema_change
  • 理由: 新規スキーマ追加のため

新規 JSON Schema(docs/schemas/cloud-pilot-success-result.schema.json)を追加した。
既存 consumer は存在しない(ADR 0005 で reserved path として予約されていたのみ)ため
後方互換性の破壊はないが、schema governance の consumer inventory 記録対象として扱う。

Schema Consumer Inventory

before(変更前)

docs/schemas/cloud-pilot-success-result.schema.json は存在せず、consumer も存在しなかった
(ADR 0005 の reserved path のみ)。

after(変更後)

cloud_pilot_success_result/v1 payload schema を新規追加し、以下の consumer が参照する。

Consumer ファイル 更新有無 備考
scripts/check-cloud-pilot-success-result.mjs 新規追加 Ajv 2020-12 で schema を compile し closed shape を検証する
tests/cloud-pilot-success-result-check.test.ts 新規追加 正例 3 件・負例 26 件の fixture を通じて schema + semantic checker を検証する
package.json(cloud-pilot-success-result:check script) 新規追加 checker の実行 entry point

Safety Claim Matrix

N/A — reason: 本 PR は safety-sensitive path(transport / permission / sandbox / auth / mcp /
.claude/skills/** / .github/workflows/**)を変更していない。純粋な schema / checker /
fixture / test の追加であり、既存の認可境界・実行環境・CI workflow には影響しない。

Notes

CI_TEST_PERFORMANCE_DECISION_V1:
  schema: CI_TEST_PERFORMANCE_DECISION_V1
  issue_number: 1364
  pr_number: null
  decision_scope: ci_change
  changed_paths:
    - docs/schemas/cloud-pilot-success-result.schema.json
    - scripts/check-cloud-pilot-success-result.mjs
    - tests/cloud-pilot-success-result-check.test.ts
    - tests/fixtures/cloud-pilot-success-result/**
    - package.json
  lane_classification:
    fast_static:
      applicable: true
      evidence: ["pnpm typecheck PASS", "pnpm lint PASS"]
      required_commands: ["pnpm typecheck", "pnpm lint"]
    python_unit:
      applicable: false
      evidence: []
      required_commands: []
    contract_artifact:
      applicable: true
      evidence: ["new JSON Schema + checker + 29 fixtures under tests/fixtures/"]
      required_commands: ["pnpm run cloud-pilot-success-result:check"]
    integration:
      applicable: true
      evidence: ["pnpm test PASS (93 files / 1463 tests)", "pnpm build PASS"]
      required_commands: ["pnpm test", "pnpm build"]
  baseline_inputs:
    ci_runtime_baseline_v1_available: false
    run_count: 0
    p50_p95_ready: false
  artifact_consistency:
    ci_test_selection_v1_checked: false
    missing_pytest_args: []
  risk_flags: []
  reviewer_gate:
    approve_allowed: true
    required_evidence:
      - TEST_VERDICT_MACHINE
      - CI_CHECK_RUN_SCOPED
  follow_up_required: []

… を実装する (#1364)

ADR 0005 (hybrid_reference_from_agent_run_report) が follow_up_issue_ref として
予約した cloud_pilot_success_result/v1 の schema / checker / negative fixture を
実装する。schema validation (Ajv 2020-12, unevaluatedProperties:false) と
semantic checker (digest 再計算 / marker 制約 / gate evidence field-level 照合 /
forbidden field 再帰 scan) を責務分離し、#1364 への OWNER 敵対的レビューが
指摘した 8 blocker (false-green 防止 / schema-semantic 分離 / digest
canonicalization negative-equivalence fixture / YAML fail-closed / marker
exactly-one 制約 / duplicate-stale-mismatch fixture / forbidden field 網羅性 /
VC 診断性) にすべて対応する。正例 3 件・負例 26 件、合計 29 fixture を
tests/fixtures/cloud-pilot-success-result/ に追加し、各負例 fixture 名と
stable error code を it.each で 1:1 対応させた。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

github-actions Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #1371 closed).

…_delta)

PR Body Japanese Check (Check Japanese Content workflow) が29件の fixture ファイルで
FAIL していたため、各 fixture のヘッダ見出しとマーカー行の直前に日本語の説明文を追加した。
checker (scripts/check-cloud-pilot-success-result.mjs) が参照する JSON payload / marker
行 / digest 値はバイト単位で変更していない。

Co-Authored-By: Claude Sonnet 5 <[email protected]>

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, merge_state_status=BEHIND (衝突ではなく base 追従待ちのため blocker 化しない)

Evidence Check

  • AC coverage: Issue #1364 の AC1-AC20 に対応する fixture 名・error code が PR diff / test file と 1:1 一致 (invalid-.md 26件・valid-.md 3件、計29 fixture)。tests/cloud-pilot-success-result-check.test.ts の invalidFixtureTable を確認し、Issue VC セクション記載の fixture名/error code と完全一致を確認した。AC20 の it.each 1:1 対応も実装済み。
  • Allowed Paths: gh api pulls/1371/files --paginate で 33 changed files (すべて added/modified、rename なし) を再取得し、docs/schemas/cloud-pilot-success-result.schema.json / scripts/check-cloud-pilot-success-result.mjs / tests/cloud-pilot-success-result-check.test.ts / tests/fixtures/cloud-pilot-success-result/** / package.json の Allowed Paths 内に全件収まることを review_subagent が独自に再計算した (status: ok)。
  • CI Verification: ci_verdict_summary.py --expected-head-sha 06131cd で status: all_pass (typecheck/lint/test/build/e2e/python-test/actionlint/PR Body Japanese Check 含む全 required checks が head 一致で SUCCESS)。
  • Contract fingerprint: Issue #1364 の現在の body を gh api repos//issues/1364 で取得し sha256 を再計算した結果 b7b9b5a9a175df28dd269c4fd67da23b6074d82e2422be3fb2931f11607b5fee となり、issue-contract-review go コメント (#1364 (comment)) の body_sha256 と完全一致 (stale ではない)。
  • Schema Consumer Inventory: schema_change 判定・consumer 一覧 (checker / test / package.json script)・非破壊 (既存 consumer なし) の記載を確認した。
  • Safety Claim Matrix: N/A 判定 (safety-sensitive path 不変更) は changed files と整合している。
  • 検証コマンド結果: AC1-AC3 は test -f/test -d の個別結果を明記、AC4-AC20 は pnpm test (CI test job SUCCESS、新規 36 tests 含む) で担保されている。

Blockers

  • なし

Non-blockers

  • PR 本文に「## 受け入れ条件の達成状況」(AC1-AC20 個別 [x]+根拠) と「## Allowed Paths 遵守」の専用セクションが無く、「## Checks」に集約されている (同 repo の直近 PR #1359 は両セクションを個別に持つ慣例があるため hygiene 差分として記録。内容自体は他セクションで代替されており blocker 化はしない)。
  • mergeStateStatus: BEHIND のため main への追従が必要。

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "06131cd151a79e442efc52c478f673471217ff79"
merge_ready: false
mergeability:
  mergeable: MERGEABLE
  merge_state_status: BEHIND
blockers: []
required_auto_actions:
  - kind: update_branch
    executor: implementation-worker
    skill: implement-issue.update_branch
    blocking_merge_ready: true
    mechanical: true
    expected_head_sha: "06131cd151a79e442efc52c478f673471217ff79"
  - kind: update_pr_body_hygiene
    executor: implementation-worker
    skill: open-pr.update_pr
    blocking_merge_ready: true
    mechanical: true
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
  changed_files_source: github_pull_request_files_api_with_previous_filename
  changed_files:
    - docs/schemas/cloud-pilot-success-result.schema.json
    - package.json
    - scripts/check-cloud-pilot-success-result.mjs
    - tests/cloud-pilot-success-result-check.test.ts
    - tests/fixtures/cloud-pilot-success-result/invalid-adoption-ready-field-injected.md
    - tests/fixtures/cloud-pilot-success-result/invalid-all-zero-trace-id.md
    - tests/fixtures/cloud-pilot-success-result/invalid-digest-canonicalization.md
    - tests/fixtures/cloud-pilot-success-result/invalid-digest-input-includes-marker.md
    - tests/fixtures/cloud-pilot-success-result/invalid-duplicate-marker-comment.md
    - tests/fixtures/cloud-pilot-success-result/invalid-fenced-block-count.md
    - tests/fixtures/cloud-pilot-success-result/invalid-forbidden-array-span-links.md
    - tests/fixtures/cloud-pilot-success-result/invalid-forbidden-camelcase.md
    - tests/fixtures/cloud-pilot-success-result/invalid-forbidden-dotted-key.md
    - tests/fixtures/cloud-pilot-success-result/invalid-forbidden-field-tracestate.md
    - tests/fixtures/cloud-pilot-success-result/invalid-forbidden-nested.md
    - tests/fixtures/cloud-pilot-success-result/invalid-gate-1326-open-real-target.md
    - tests/fixtures/cloud-pilot-success-result/invalid-gate-ref-evidence-mismatch.md
    - tests/fixtures/cloud-pilot-success-result/invalid-marker-injection-in-payload.md
    - tests/fixtures/cloud-pilot-success-result/invalid-missing-required-key.md
    - tests/fixtures/cloud-pilot-success-result/invalid-number-exponent.md
    - tests/fixtures/cloud-pilot-success-result/invalid-optional-null-vs-absent.md
    - tests/fixtures/cloud-pilot-success-result/invalid-outer-marker-duplicate.md
    - tests/fixtures/cloud-pilot-success-result/invalid-public-correlation-id-is-raw-trace-id.md
    - tests/fixtures/cloud-pilot-success-result/invalid-raw-trace-id-in-string.md
    - tests/fixtures/cloud-pilot-success-result/invalid-stale-digest.md
    - tests/fixtures/cloud-pilot-success-result/invalid-target-kind-mismatch.md
    - tests/fixtures/cloud-pilot-success-result/invalid-target-marker-mismatch.md
    - tests/fixtures/cloud-pilot-success-result/invalid-timestamp-offset-drift.md
    - tests/fixtures/cloud-pilot-success-result/invalid-unevaluated-property.md
    - tests/fixtures/cloud-pilot-success-result/invalid-yaml-payload-rejected.md
    - tests/fixtures/cloud-pilot-success-result/valid-fixture-only.md
    - tests/fixtures/cloud-pilot-success-result/valid-key-order-permuted.md
    - tests/fixtures/cloud-pilot-success-result/valid-unicode-nfc-nfd-equivalent.md
allowed_paths_gate_source: review_subagent

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, merge_state_status=CLEAN (update_branch 実行済み、main 追従完了)

Evidence Check

  • AC coverage: 前回レビュー(head 06131cd)からコーディング内容は不変であることを独立確認済み。git diff --name-status -M で merge-base(origin/main tip 043ab5f)から現 head(846b607)までの変更を再取得した結果、AC実装対象の33ファイル(schema/checker/test/29 fixture/package.json)は前回と完全一致。PR本文の「## 受け入れ条件の達成状況」表でAC1-AC20全件PASS+根拠(fixture名/error code)が記載されていることを確認した。
  • Allowed Paths: git diff --name-status -M 043ab5f...846b607 の33変更ファイルすべてがIssue #1364 Allowed Paths内(docs/schemas/cloud-pilot-success-result.schema.json / scripts/check-cloud-pilot-success-result.mjs / tests/cloud-pilot-success-result-check.test.ts / tests/fixtures/cloud-pilot-success-result/** / package.json)に収まることをreview_subagentが再計算した(status: ok)。rename/copyなし。base側(main由来)の.claude/skills/gemini-cli-headless-delegation・src/main.ts等の変更はmerge-base差分にのみ現れ、PR自体の変更ファイル集合には含まれないことを確認済み。
  • CI Verification: ci_verdict_summary.py --expected-head-sha 846b607 で status: all_pass。typecheck/lint/test/build/e2e/python-test/actionlint/node-backed-hook-tests/check-hook-integrity/deploy-pr/validate-generated-artifact/PR Body Japanese Check 含む全required checksがhead一致でSUCCESS。
  • Contract fingerprint: gh api repos//issues/1364 の現 body(末尾改行除去)のsha256を独立再計算した結果 b7b9b5a9a175df28dd269c4fd67da23b6074d82e2422be3fb2931f11607b5fee となり、issue-contract-review goコメント(issuecomment-4903404513, generated_at 2026-07-07T11:44:39Z)のbody_sha256と完全一致(staleではない)。issue #1364 のupdatedAtがgoコメント生成時刻と同一であることも確認し、go後の本文編集がないことを確認した。
  • Schema Consumer Inventory: schema_change判定・consumer一覧(checker/test/package.json script)・非破壊(既存consumerなし)の記載を確認した(前回から不変)。
  • Safety Claim Matrix: N/A判定(safety-sensitive path不変更)はchanged filesと整合している(前回から不変)。
  • PR body hygiene: 「## 受け入れ条件の達成状況」(AC1-AC20個別状況+根拠)と「## Allowed Paths遵守」の専用セクションが追加され、前回指摘したhygiene差分は解消済み。
  • 検証コマンド結果: AC1-AC3はtest -f/test -dの個別結果を明記、AC4-AC20はpnpm test(CI test job SUCCESS、新規36 tests含む)で担保されている。

Blockers

  • なし

Non-blockers

  • なし

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "846b60798e8471bd99c875219a898bb51d1dcb99"
merge_ready: true
mergeability:
  mergeable: MERGEABLE
  merge_state_status: CLEAN
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
  changed_files_source: git_diff_name_status_find_renames_z
  changed_files:
    - docs/schemas/cloud-pilot-success-result.schema.json
    - package.json
    - scripts/check-cloud-pilot-success-result.mjs
    - tests/cloud-pilot-success-result-check.test.ts
    - tests/fixtures/cloud-pilot-success-result/invalid-adoption-ready-field-injected.md
    - tests/fixtures/cloud-pilot-success-result/invalid-all-zero-trace-id.md
    - tests/fixtures/cloud-pilot-success-result/invalid-digest-canonicalization.md
    - tests/fixtures/cloud-pilot-success-result/invalid-digest-input-includes-marker.md
    - tests/fixtures/cloud-pilot-success-result/invalid-duplicate-marker-comment.md
    - tests/fixtures/cloud-pilot-success-result/invalid-fenced-block-count.md
    - tests/fixtures/cloud-pilot-success-result/invalid-forbidden-array-span-links.md
    - tests/fixtures/cloud-pilot-success-result/invalid-forbidden-camelcase.md
    - tests/fixtures/cloud-pilot-success-result/invalid-forbidden-dotted-key.md
    - tests/fixtures/cloud-pilot-success-result/invalid-forbidden-field-tracestate.md
    - tests/fixtures/cloud-pilot-success-result/invalid-forbidden-nested.md
    - tests/fixtures/cloud-pilot-success-result/invalid-gate-1326-open-real-target.md
    - tests/fixtures/cloud-pilot-success-result/invalid-gate-ref-evidence-mismatch.md
    - tests/fixtures/cloud-pilot-success-result/invalid-marker-injection-in-payload.md
    - tests/fixtures/cloud-pilot-success-result/invalid-missing-required-key.md
    - tests/fixtures/cloud-pilot-success-result/invalid-number-exponent.md
    - tests/fixtures/cloud-pilot-success-result/invalid-optional-null-vs-absent.md
    - tests/fixtures/cloud-pilot-success-result/invalid-outer-marker-duplicate.md
    - tests/fixtures/cloud-pilot-success-result/invalid-public-correlation-id-is-raw-trace-id.md
    - tests/fixtures/cloud-pilot-success-result/invalid-raw-trace-id-in-string.md
    - tests/fixtures/cloud-pilot-success-result/invalid-stale-digest.md
    - tests/fixtures/cloud-pilot-success-result/invalid-target-kind-mismatch.md
    - tests/fixtures/cloud-pilot-success-result/invalid-target-marker-mismatch.md
    - tests/fixtures/cloud-pilot-success-result/invalid-timestamp-offset-drift.md
    - tests/fixtures/cloud-pilot-success-result/invalid-unevaluated-property.md
    - tests/fixtures/cloud-pilot-success-result/invalid-yaml-payload-rejected.md
    - tests/fixtures/cloud-pilot-success-result/valid-fixture-only.md
    - tests/fixtures/cloud-pilot-success-result/valid-key-order-permuted.md
    - tests/fixtures/cloud-pilot-success-result/valid-unicode-nfc-nfd-equivalent.md
allowed_paths_gate_source: review_subagent

@squne121

squne121 commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

判定

REQUEST_CHANGES / merge block。
PR #1371 は cloud_pilot_success_result/v1 の schema / checker / fixtures / Vitest を追加しており、PR 自体は draft/open、head は 846b607...、変更は 33 files / +2753 lines です。既存レビューと CI は良好ですが、Issue #1364 と ADR 0005 が要求している fail-closed の水準にはまだ届いていません。特に、現在の checker は「#1326 が open のままでも adoption-ready に見える artifact」を受理できる構造です。

PR #1359 / ADR 0005 は、result 本体を standalone の public-safe GitHub comment/artifact に置き、agent_run_report/v1 には github_comment / observation_projection_digest の opaque reference だけを持たせる設計を固定しています。今回の PR はその follow-up 実装ですが、ADR 側では cloud_adoption_allowed_now: false が #1326 と follow-up checker 完了まで維持される前提です。

良い点

実装の方向性は合っています。JSON Schema 2020-12、Ajv 2020、semantic checker 分離、JSON-only への scope narrowing、fixture 名と stable error code の it.each 対応は、Issue #1364 の設計意図に沿っています。

ただし、現状のテストは「既存 fixture が期待どおり fail/pass する」ことを確認しているだけで、fresh digest を再計算した悪性 payload に対する fail-closed 性を保証していません。ここが本レビューの主眼です。


Blocker 1: decision_ready: true で adoption-ready bypass が可能

ADR 0005 は cloud_adoption_allowed_now: false を明記し、#1326 と follow-up checker が完了するまで adoption-ready ではないとしています。#1326 自体も現在 open です。

しかし schema は decision: adopt_cloud と cloud_adoption_allowed_now を許可しています。 さらに checker の checkEvidenceMode は decision_ready !== true の場合だけ adopt_cloud / cloud_adoption_allowed_now: true を拒否します。つまり、payload 側で decision_ready: true を立てると、この guard は無効化されます。

加えて success_contract_checker の gate は、presented_as_real_target === true のときだけ state="completed" / checker_result="pass" を要求します。presented_as_real_target: false のまま decision_ready: true / adopt_cloud にできるため、#1326 open を横抜けできます。

修正要求:

fixture_only と real adoption-ready を semantic checker で完全に分離してください。

// 意図レベル
if (payload.evidence_mode === "fixture_only") {
  require(payload.decision_ready === false)
  require(payload.decision === "pending_fixture_only")
  forbid(payload.cloud_adoption_allowed_now === true)
}

if (
  payload.decision_ready === true ||
  payload.evidence_mode === "real_pilot_verified" ||
  payload.decision === "adopt_cloud" ||
  payload.cloud_adoption_allowed_now === true
) {
  requireAllGateRefsExactIssueIds()
  requireAllGateRefsCompletedAndPass()
  require(success_contract_checker.issue === "#1326")
  require(success_contract_checker.state === "completed")
  require(success_contract_checker.checker_result === "pass")
}

この bypass 用の negative fixture は、既存 positive fixture を mutation し、digest を再計算したうえで fail させる必要があります。既存の「古い digest だから fail」型では不十分です。


Blocker 2: gate_refs の issue identity が固定されていない

ADR の gate_refs_schema は、session_recording_smoke = #246、latitude_real_pilot_decision = #1220、latitude_distribution_gate = #1261、success_contract_checker = #1326 を固定しています。

現在の schema は各 gate の issue を ^#[1-9][0-9]*$ という pattern でしか縛っていません。 checker も gate の field value は検査しますが、issue 番号そのものを #246 / #1220 / #1261 / #1326 に照合していません。

これは false-green です。例えば session_recording_smoke.issue: "#9999" でも verdict: "pass" なら通る構造です。

修正要求:

schema 側で const にするか、semantic checker で明示的に固定してください。

"session_recording_smoke": {
  "properties": {
    "issue": { "const": "#246" }
  }
}

同様に #1220 / #1261 / #1326 も固定してください。gate identity drift 用の negative fixture を追加してください。


Blocker 3: outer marker と payload の binding が不完全

ADR の marker contract は repo / target / parent_issue / result_id を target fields とし、upsert policy でも同じ match fields を使う設計です。

checker は extraction で markerRepo / markerTarget / markerParentIssue / markerResultId を取得していますが、validation pipeline で使っているのは markerTarget だけです。

さらに checkTargetKindMismatch は outer marker の target=issue:1153 と payload の target.kind / target.number だけを比較し、payload の target.marker_value とは比較していません。 schema 側も target.marker_value は pattern のみで、kind / number との一致までは見ません。

修正要求:

checkMarkerBinding を追加してください。

必須照合:

  • outer.repo は期待 repo pattern に一致し、必要なら squne121/loop-protocol に固定
  • outer.parent_issue=1153 と payload.parent_issue === "#1153" が一致
  • outer.result_id と payload.result_id が一致
  • outer.target と payload.target.marker_value が一致
  • payload.target.marker_value と payload.target.kind:number が一致

これらは digest 再計算前に semantic error として出すべきです。


Blocker 4: canonicalization profile の字句制約を実装できていない

ADR の digest policy は repo 独自 profile です。timestamp_format: rfc3339_utc_z と number_format: json_integer_or_decimal_no_exponent を要求しています。

しかし schema の generated_at は fractional seconds と +09:00 のような offset を許可しています。 metrics は単なる JSON number で、exponent 表記の字句を拒否できません。 checker は JSON.parse 後に JSON.stringify して digest を計算しているため、元 JSON に 1e3 と書かれていたか 1000 と書かれていたかは消えます。

これは実装上かなり重要です。RFC 8785 / JCS でも ECMAScript JSON.stringify() は 1e+30 のような指数表記を出し得る例が示されています。ADR の「no exponent」profile を守るなら、JSON.stringify だけに依存してはいけません。([RFC エディター]1) なお JCS は Unicode 正規化を行わず文字列を “as is” で保持する仕様なので、NFC を含む ADR 0005 profile は JCS そのものではなく、repo 独自 canonicalization として扱うべきです。([RFC エディター]1)

修正要求:

  • generated_at は ^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$ 程度に狭める
  • fractional seconds / +00:00 / +09:00 は semantic error にする
  • JSON parse 前の raw JSON text に対して numeric token scanner を走らせ、e / E を含む number token を拒否する
  • 「fresh digest を再計算した +00:00 timestamp」「fresh digest を再計算した exponent number」を negative fixture にする

Blocker 5: upsert_probe が ADR の upsert policy を十分に表現していない

ADR の GitHub comment upsert policy は pagination-aware、repo / target / parent_issue / result_id exact match、0件 create、1件 update、複数件 fail、stale digest fail、actor restriction を要求しています。 GitHub REST API 上も、PR comments は issue comments として扱われ、list は pagination を持ち、update は comment_id 指定です。([GitHub Docs]2) ([GitHub Docs]2) ([GitHub Docs]2)

現在の upsert_probe schema は existing_comment_match_count の型すら固定しておらず、checker は 0/1/それ以外だけを見ています。 digest_freshness: "stale" も、digest mismatch 時の error code を digest.stale に変えるだけで、digest が一致していれば stale として fail しません。

修正要求:

upsert_probe を declarative simulation として使う方針自体はよいですが、ADR の policy field を表現してください。

最低限:

{
  "existing_comment_match_count": { "type": "integer", "minimum": 0 },
  "digest_freshness": { "enum": ["current", "stale"] },
  "page_budget_exhausted": { "type": "boolean" },
  "matched_author_allowed": { "type": "boolean" },
  "match_fields_verified": { "type": "boolean" }
}

semantic check:

  • existing_comment_match_count > 1 は fail
  • digest_freshness !== "current" は digest が一致していても fail
  • page_budget_exhausted === true は fail
  • matched_author_allowed !== true は fail
  • match_fields_verified !== true は fail

Blocker 6: diagnostic_context が open object で、public-safe projection が blocklist 依存になっている

top-level は unevaluatedProperties: false ですが、diagnostic_context は type: object のみで内部 shape が閉じていません。 JSON Schema では、properties に載っていない追加 property はデフォルトで許可され、拒否するには該当 object schema 内で additionalProperties: false 等を明示する必要があります。(JSON Schema)

現在の再帰 scanner は ADR の forbidden key 群と raw trace-id 風 string を検出する設計ですが、open object + blocklist 方式では、未列挙の telemetry field や vendor 固有 field がそのまま public-safe projection に残る可能性があります。OpenTelemetry span は Span Context、Attributes、Events、Links、Status を持ち、Span Context には Trace State や Baggage も関与し、Attributes には user ID のような値も入り得ます。([OpenTelemetry]4) ([OpenTelemetry]4)

W3C Trace Context では trace-id は 16-byte / 32 hex で、all-zero は invalid です。現在の raw trace-id 検出は方向性として正しいですが、ADR は public_correlation_id の format validation も要求しています。([W3C]5)

修正要求:

  • diagnostic_context は原則禁止、または allowlist の closed object にする
  • public_correlation_id は raw trace-id でないことだけでなく、repo 固有の prefix / digest / length など positive format を定義する
  • blocklist scanner は残してよいが、public-safe projection は allowlist-first にする

Blocker 7: checker の default no-file behavior が fail-open

pnpm run cloud-pilot-success-result:check は default で tests/fixtures/cloud-pilot-success-result/*.md を対象にします。 しかし default target でファイルが見つからず、かつ CI !== "true" の場合は skipped と出して exit 0 します。

contract checker の entrypoint としては fail-open です。fixtures directory が消えた、glob が壊れた、cwd/ref がずれた、という状態で pass 扱いになります。

修正要求:

default target でも file count 0 は exit 1 にしてください。どうしても許可したいなら --allow-empty の明示 option を作り、通常 script では使わない設計にしてください。


Blocker 8: テストが fixture snapshot に偏り、攻撃的 mutation を覆っていない

現行テストは 3 positive fixtures と 26 negative fixtures を it.each で検査し、negative は「期待 code が errors に含まれる」ことを見ています。 canonicalization primitive test も key order / NFC / null-vs-absent / digest prefix に留まっています。

これでは、payload を悪性に mutation して digest を再計算したケースを落とせません。

追加必須テスト:

  • fixture_only + decision_ready:true + adopt_cloud + cloud_adoption_allowed_now:true + #1326 open が fresh digest でも fail
  • gate issue identity drift: #246 → #9999 が fresh digest でも fail
  • outer parent_issue と payload parent_issue mismatch が fail
  • outer result_id と payload result_id mismatch が fail
  • payload target.marker_value と kind/number mismatch が fail
  • upsert_probe.digest_freshness:"stale" が digest 一致でも fail
  • generated_at:"2026-07-06T12:00:00+00:00" が fresh digest でも fail
  • exponent numeric token が fresh digest でも fail
  • diagnostic_context の未知 nested object が fail または allowlist 外で fail

Non-blockers

  • JSON-only に狭めた判断は妥当です。YAML alias / anchor / tag / implicit timestamp を受けると digest canonicalization と衝突しやすいため、初期実装で JSON-only は正しいです。
  • 単一ファイル checker も、Issue 実装: cloud_pilot_success_result/v1 の checker/schema/negative fixture を実装する #1364 の Allowed Paths / Stop Condition を考えると許容です。
  • unevaluatedProperties: false の top-level 採用はよいです。ただし nested object まで閉じて初めて closed shape と言えます。

最小修正セット

  1. checkDecisionReadiness を追加し、fixture-only と real adoption-ready を明確に分離する。
  2. gate issue refs を schema const または semantic checker で固定する。
  3. checkMarkerBinding で repo / target / parent_issue / result_id を全照合する。
  4. raw JSON lexical scanner を入れ、timestamp UTC-Z と no-exponent number を enforcement する。
  5. upsert_probe を ADR の upsert policy に合わせて型付き・fail-closed にする。
  6. diagnostic_context を closed allowlist にする。
  7. default no-file skip を exit 1 にする。
  8. fresh-digest mutation negative tests を追加する。

この PR は「実装量」は十分ですが、現状では false-green を潰す checker ではなく、用意された fixture だけに強い checker です。ADR 0005 / Issue #1364 の目的は前者なので、上記 Blocker は merge 前に潰すべきです。

squne121 and others added 2 commits July 7, 2026 22:52
…fix_delta iteration 2)

PR #1371 への人間OWNERレビュー(REQUEST_CHANGES)で指摘された8件のBlockerに対応する。

- Blocker 1: evidence_mode="fixture_only" は decision_ready=false /
  decision="pending_fixture_only" / cloud_adoption_allowed_now!=true を厳格に要求し、
  decision_ready/evidence_mode/decision/cloud_adoption_allowed_now/
  presented_as_real_target のいずれかが adoption-ready を示す場合は
  success_contract_checker(#1326) の state=completed かつ checker_result=pass を
  無条件に要求するようにした(isAdoptionReadySignal)。
- Blocker 2: gate_refs の4ゲートの issue フィールドを schema の const で固定し、
  drift した issue 番号を schema.invalid(gate_ref.identity_mismatch)として拒否する。
- Blocker 3: 新規 checkMarkerBinding で outer marker の repo/parent_issue/result_id/
  target と payload の対応フィールドを全照合し、payload.target.marker_value 自体が
  kind:number と一致することも検証する。
- Blocker 4: generated_at の pattern を厳格な UTC 表記のみに狭め、raw JSON text に
  対する numeric exponent token scanner を追加して JSON.parse 後の正規化で消える
  指数表記を fresh digest でも拒否する。
- Blocker 5: upsert_probe の各フィールドを型付けし、
  existing_comment_match_count>1 / digest_freshness!=="current" /
  page_budget_exhausted=true / matched_author_allowed!=true /
  match_fields_verified!=true をそれぞれ fail-closed にした。
- Blocker 6: diagnostic_context を additionalProperties:false の closed empty
  object にし、public_correlation_id に positive format pattern を追加した。
- Blocker 7: デフォルト no-file 時の fail-open skip を廃止し、明示的な
  --allow-empty オプションがない限り exit 1 にした。
- Blocker 8: 上記8件それぞれについて、fresh digest 再計算済みの negative fixture
  9本を追加し、既存 valid fixture の diagnostic_context 依存を
  safety.blocked_reasons へ移した。

45 vitest tests pass (36 既存 + 9 新規), pnpm typecheck/lint/test/build 全 green。

Co-Authored-By: Claude Sonnet 5 <[email protected]>

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

impl-review-loop 再レビュー結果(head e50e3ca)

OWNER の8件の Blocker(#1371 (comment) )はすべて解消を確認しました。fresh digest 再計算が要求された5件の negative fixture(invalid-fixture-only-adoption-ready-bypass, invalid-gate-identity-drift, invalid-upsert-probe-stale-freshness-fresh-digest, invalid-numeric-exponent-fresh-digest, invalid-generated-at-utc-offset)について、checker と同一の canonicalization(NFC正規化・lexical key sort・JSON直列化・sha256)を独立実装して digest を再計算し、fixture内埋め込み digest と完全一致することを確認しました(stale digest の使い回しなし)。

CI は head e50e3ca6e3a999005df8455ee8b5e52b0e0fd348 で全 green、mergeStateStatus: CLEAN、mergeable: MERGEABLE。Allowed Paths(39変更ファイル全て Issue #1364 の5エントリに一致、rename無し)を独立確認済みです。

LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "e50e3ca6e3a999005df8455ee8b5e52b0e0fd348"
  merge_ready: true
  mergeability:
    mergeable: MERGEABLE
    merge_state_status: CLEAN
  blockers: []
  required_auto_actions: []
  auto_fix_applied: []
  follow_up_issue_requests: []
  allowed_paths_gate:
    status: ok
    changed_files_source: git_diff_name_status_find_renames_z
    changed_files:
      - docs/schemas/cloud-pilot-success-result.schema.json
      - package.json
      - scripts/check-cloud-pilot-success-result.mjs
      - tests/cloud-pilot-success-result-check.test.ts
      - tests/fixtures/cloud-pilot-success-result/**
  allowed_paths_gate_source: review_subagent

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

impl-review-loop 最終レビュー結果(head 54a330d)

前回 APPROVE(head e50e3ca、#1371 (review) )以降、main の先行により update_branch を2回実行しましたが、PR 本体のコード内容(checker/schema/test/29 fixtures/package.json)は byte-identical であることを git diff origin/main...54a330d9 および git diff e50e3ca6...54a330d9 で確認しました(追加されたのは main への merge commit のみ)。OWNER の8 Blocker解消は前回レビューで確認済みのまま変化ありません。

CI は head 54a330d90050a10e7799d4c5bfd996a47f48921b で全 green、mergeStateStatus: CLEAN、mergeable: MERGEABLE。

LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "54a330d90050a10e7799d4c5bfd996a47f48921b"
  merge_ready: true
  mergeability:
    mergeable: MERGEABLE
    merge_state_status: CLEAN
  blockers: []
  required_auto_actions: []
  auto_fix_applied: []
  follow_up_issue_requests: []
  allowed_paths_gate:
    status: ok
    producer_role: review_subagent
    note: "PR content byte-identical to prior APPROVE (pullrequestreview-4645963101); only merge commits added since e50e3ca6"

@squne121
squne121 marked this pull request as ready for review July 7, 2026 21:42
@squne121
squne121 merged commit 32821d0 into main Jul 7, 2026
22 checks passed
@squne121
squne121 deleted the worktree-issue-1364-cloud-pilot-success-result branch July 7, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

実装: cloud_pilot_success_result/v1 の checker/schema/negative fixture を実装する

1 participant