Skip to content

実装: retro_live_verification のproducer/resolver source_set_digest契約バグを修復する - #1781

Merged
squne121 merged 5 commits into
mainfrom
worktree-issue-1415-digest-fix
Jul 26, 2026
Merged

squne121 merged 5 commits into
mainfrom
worktree-issue-1415-digest-fix

Conversation

@squne121

@squne121 squne121 commented Jul 26, 2026 •

Copy link
Copy Markdown
Owner

retro_live_verification: producer/resolver source_set_digest契約バグを修復する

Summary

Issue #1415のpost-merge live closure実行中に発見した実装回帰を修復する。agent_retro_index/v1のproducer(retro-index-builder.mjs)とCHATGPT_RETRO_CONTEXT_V1 markerのresolver(chatgpt-retro-context-marker-helper.mjs)が、refs.retro_index.source_set_digestという同一フィールドに対して数学的に両立不能な2つの検証を行っていたバグを修復した。

Current repo reality / contract drift(現状と契約との乖離)

Scope Delta

scripts/agent-logs/update-retro-index.mjs(producer拡張のため必要)をpr-review-judgeの独立gateで未列挙と指摘され、Issue #1415のAllowed PathsをScope Delta経由で拡張して解消済み。

Acceptance Criteria matrix(受け入れ基準対応表)

指摘 修復内容 commit
resolverの二重検証バグ payload.refs.retro_index.source_set_digestはretro indexコメント自身の埋め込みdigestとの一致のみを検証するよう修正。marker引用run_reports+retro_index自身からの再計算・比較(意味論的に誤り)は削除 ab9ce2ba
producerが親Issue自身をスキャンしない collectSourceComments()が親Issue自身のコメントと--additional-pull-number指定PRもソースとしてスキャンするよう拡張(既存checklist子Issueスキャンはadditive維持) 9d010a11
v3 readbackのfalse-green retro_live_verification/v3のdual-target manifest生成時、投稿前のreadbackを無条件pass固定からstatus: pending(canonical_comment_count/duplicate_countはnull、digest_revalidationはpending)へ変更。実際の投稿後readbackで埋める設計に修正 0d7e4d8e
回帰テスト buildRetroIndex()実出力を使ったround-trip integration test(親Issue自身ケース)+改ざんrun report/retro indexでのfail-closed negative tests fa30bfbc

Verification Commands results(検証コマンド実行結果)

$ pnpm typecheck   → pass
$ pnpm lint        → pass
$ pnpm test        → pass (1817/1817、既存1814+新規3)
$ pnpm build       → pass

Runtime Verification Applicability

decision: immediate
github_api_required: true
applicable_acs: [resolve-live, agent_retro_index, chatgpt_retro_context_marker]
execution_environment: github_cli_authenticated_live_session
skip_conditions:
  allowed: false
fallback_policy:
  allowed: false
reason: >-
  live GitHub API実行を要する検証はunit test(実producer出力を使ったround-trip test含む)で
  ロジックの正しさを検証済み。実際のlive再検証はマージ後にIssue #1415側で
  既存comment(run report/retro index/marker)へのCAS付き修正投稿として行う。

Schema Change Applicability

- decision: schema_change
existing_schema_modified:
  - retro_live_verification/v3: dual-target manifestの`readback`フィールドをadditive変更(`status`enum追加、`canonical_comment_count`/`duplicate_count`をnullable化)。v2は無変更
migration_required: false
backward_compatibility: v2既存契約・retro_live_verification/v2の既存fixtureは無変更(回帰テストで確認)

Schema Consumer Inventory

Before(変更前)

retro_live_verification/v3のdual-target manifestは、生成時点(投稿前)でreadback.canonical_comment_count: 1/digest_revalidation: pass/duplicate_count: 0を無条件に自己申告していた。

After(変更後)

生成時点はreadback.status: pending、値はnull/pending。実際の投稿後readback処理で埋める。

Consumer ファイル 更新有無 備考
scripts/generate-retro-live-verification.mjs 更新あり v3 dual-target manifest生成時のreadback初期値をpending化
scripts/agent-logs/lib/chatgpt-retro-context-marker-helper.mjs 更新あり resolve-liveのsource_set_digest検証ロジック修正
scripts/agent-logs/update-retro-index.mjs 更新あり collectSourceComments()が親Issue自身+追加PRもスキャン

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
v2既存契約は非破壊 Yes - pnpm test(1817/1817 pass) -
resolver修正はproducerの実出力で検証済み Yes - round-trip integration test -
改ざんrun report/retro indexはfail-closed Yes - negative tests -

Backward compatibility / migration decision(後方互換性・移行方針)

retro_live_verification/v2は無変更。v3 dual-target manifestのreadbackフィールドのみadditive変更(新規statusフィールド追加、既存フィールドはnullable化のみで型自体は維持)。

CI Test Performance Decision(CIテスト性能判断)

既存テストファイルへの追加のみ。新規CI lane・新規workflow jobは追加していない。

Checks

  • pnpm typecheck pass
  • pnpm lint pass
  • pnpm test pass(1817/1817)
  • pnpm build pass
  • Allowed Paths内ファイルのみ変更(6ファイル。scripts/agent-logs/update-retro-index.mjsはAllowed Paths拡張後に適合)
  • v2既存fixture/argument-freeデフォルトの回帰なし

Notes

Refs #1415(本PRはIssueをcloseしない)

squne121 added 4 commits July 26, 2026 10:25
chatgpt-retro-context-marker-helper.mjsのresolve-liveロジックが、marker.refs.retro_index.source_set_digest
という同一フィールドに対し(1)retro indexコメント自身の埋め込みdigestとの一致 と (2)marker引用の
run_reports+retro_index自身から再計算した値との一致、という両立不能な2つの検証を行っていた。
producer(retro-index-builder.mjs)はcollectSourceComments()が発見した集合からdigestを計算するため、
両者が一致するのはproducerの発見集合がmarker引用集合と偶然一致する場合のみだった。
(2)の再計算チェックを削除し、各run_reportの独立digest検証とretro indexコメント自身の自己整合性検証のみを残す。
…ソースとしてスキャンする

collectSourceComments()は#1153のchecklist記載子Issueとそこから発見されるPRのコメントのみを
スキャン対象にしており、parent issue自身に投稿されたrun reportをsource_comment_set_digestの
計算対象に含められなかった。parent issue自身のコメントスキャンを追加(additive)し、
--additional-pull-number(multiple)オプションでchecklist経由で発見できないPR targetも
明示的にスキャン対象へ追加できるようにする。オプション未指定時はv2既存挙動を完全維持する。
buildDualTargetManifest()は投稿前の生成時点で無条件にreadback.canonical_comment_count=1/
digest_revalidation=pass/duplicate_count=0を自己申告しており、schema自体もconstでこれを
強制していた。schemaにstatus(pending/verified/failed)を追加しcanonical_comment_count/
duplicate_countをnullable、digest_revalidationをpending|pass|failのenumに変更。
generatorは生成時点でstatus:pendingを出力する(既存v2 schemaのreadback概念は無変更、
v3 dual-target schemaのみadditive変更)。実際の投稿後readback結果は
post-retro-live-verification.mjsのdual-target CLI結果(readback_verified等)が
別途保持しており、そちらが呼び出し元にとっての正本となる。
…sを追加する

buildRetroIndex()の実出力(fixtureでなく実producer関数)をmarker resolverへ渡し、
parent issue自身を対象とするケースでstatus解決が成功することを検証する統合テストを追加。
併せて、run report/retro indexそれぞれの改ざん(偽digest宣言)がfail-closedになる
negative testを追加する。
@github-actions

github-actions Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #1781 closed).

@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.

PR Review 判定

独立再検証の結果、PR #1781(head aaaff61ae9a1b54f3119d875a0118c72da6214c0)を APPROVE とする。

  • Allowed Paths gate: status: ok(Issue #1415拡張後、変更ファイル6件すべて適合)
  • CI: 全required checks green
  • Mergeability: MERGEABLE / CLEAN
  • resolverの二重検証バグ除去、producerの親Issue自身スキャン対応、v3 readback false-green修正、いずれも実装・テストで確認済み
LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "aaaff61ae9a1b54f3119d875a0118c72da6214c0"
  merge_ready: true
  mergeability:
    mergeable: "MERGEABLE"
    merge_state_status: "CLEAN"
  blockers: []
  required_auto_actions: []
  allowed_paths_gate:
    status: "ok"
    violations: []

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.

1 participant