Skip to content

実装: node-backed-hook-tests に test_external_manifest_publish.py の実行 step を追加し既知の宣言・実行不一致を解消する #1725

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "CI runtime baseline 判定境界修正(旧 #1538)のうち、node-backed-hook-tests job の宣言専用 secondary_coverage が実行実態と乖離する既知の false-green instance(test_external_manifest_publish.py)を解消する。"
change_kind: workflow

Parent Issue

なし

Parent Goal Ref

Current Validated Scope

  • .github/ci/python-test-plan.json の secondary_coverage.dedicated_lanes(provider_job: node-backed-hook-tests)は tests/session_recording/codex/test_hook_adapter.py / tests/session_recording/codex/test_initial_branch_create_lane.py / tests/session_recording/codex/test_external_manifest_publish.py の3ファイルを宣言している。
  • .github/workflows/ci.yml の node-backed-hook-tests job の実 step は、固定2 nodeid(test_generate_session_manifest_from_hook.py の2テスト)、test_hook_adapter.py(serial + xdist の2 step)、test_initial_branch_create_lane.py、node --test test_session_manifest_debounce.mjs のみを実行しており、test_external_manifest_publish.py を実行する step が存在しない(repo 実態確認済み)。
  • "Generate node-backed hook selection artifact" step(.github/workflows/ci.yml 1663行)は既に存在するが、その collect-only 対象(1666-1671行台・1697-1702行台の pytest_args)に test_external_manifest_publish.py は含まれていない。step 名そのものの存在有無を確認する rg だけでは「対象ファイルに含まれているか」を判定できないため、旧 AC3 の VC(baseline-expect: fail)は review-issue 実行時に unexpectedly pass することが確認された。
  • 同 step 内の Python block(1717-1795行台)は session_recording_prefixes タプル(1735-1738行、現在 test_hook_adapter.py / test_initial_branch_create_lane.py の2エントリで実在する識別子であることをリポジトリ実態で確認済み)で collect-only nodeid を「fixed hook wrapper」と「session recording」に分類し、exactly_expected_two(fixed_hook_wrapper が厳密に2件であることを要求)・matches_expected_nodeids・session_recording_nodeids_present の3 invariant を fail-close で検証している。test_external_manifest_publish.py を単純に collect-only 対象へ追加するだけでは、このファイルは session_recording_prefixes のどのエントリにも前方一致しないため fixed_hook_wrapper_nodeids 側に分類され、exactly_expected_two(3件になり2件期待に反する)と matches_expected_nodeids を破壊する。session_recording_prefixes タプルへ "tests/session_recording/codex/test_external_manifest_publish.py" を追加することが本 Issue の変更に必須である。
  • tests/session_recording/codex/test_external_manifest_publish.py は node subprocess(scripts/session-recording/codex-hook-adapter.mjs 等)を実際に起動する Node-backed test であり、Node/pnpm セットアップを行わない python-test job では実行できない。node-backed-hook-tests job で実行する以外の選択肢はない。
  • tests/session_recording/codex/test_external_manifest_publish.py::test_stop_and_subagentstop_hooks_write_external_manifest_with_empty_repo_delta は現状 uv run --locked pytest -q tests/session_recording/codex/test_external_manifest_publish.py -p no:xdist 実行時に FAIL する(codex-hook-adapter.mjs の scope-rollup capture skip 診断 eligibility_missing が stderr に出力されるため)。この pre-existing failure の解消は Issue test: external manifest publish の Stop/SubagentStop stderr 契約と scope-rollup 環境分離を修正する #1828 が担い、本 Issue は test: external manifest publish の Stop/SubagentStop stderr 契約と scope-rollup 環境分離を修正する #1828 に依存する(GitHub native blockedBy 設定済み)。
  • generate_ci_test_selection_artifact.py は secondary_coverage.dedicated_lanes を「別 job が実際に実行するファイル」の宣言として信頼し、provider job 側の実 artifact/collected nodeid を検証せずに cross_job_covered_test_files として扱う(スクリプト docstring に明記された既知の設計)。このため、現状は宣言のみが存在し実行が伴わない false-green 経路が成立している。

Remaining Parent Gaps

Outcome

node-backed-hook-tests job が tests/session_recording/codex/test_external_manifest_publish.py に関する現在の既知の false-green instance を解消し、同ファイルを実際に実行する専用 step・session_recording_prefixes への追加による invariant 整合・collect-only artifact への包含のすべてを満たした状態にする。宣言専用 coverage の一般的な false-green 経路そのもの(他ファイルへの再発防止・provider artifact 照合の仕組み)は本 Issue では扱わない。当該一般解を担っていた #1762 は not_planned で close 済みであり、必要になった場合は具体的 instance ベースの新規 Issue として都度対応する。

In Scope

  • .github/workflows/ci.yml の node-backed-hook-tests job に、test_hook_adapter.py / test_initial_branch_create_lane.py と同じ timed-step パターン(measurements.jsonl への計測記録、set +e / exit $_s を含む)で tests/session_recording/codex/test_external_manifest_publish.py -p no:xdist を実行する専用 step を追加する
  • "Generate node-backed hook selection artifact" step の collect-only 対象(pytest --collect-only の対象ファイル一覧、および generate_ci_test_selection_artifact.py へ渡す pytest_args)へ test_external_manifest_publish.py を追加する
  • 同 step 内の session_recording_prefixes タプルへ "tests/session_recording/codex/test_external_manifest_publish.py" を追加し、exactly_expected_two / matches_expected_nodeids / session_recording_nodeids_present の既存 invariant が引き続き成立することを保証する
  • docs/dev/test-lane-policy.md の node-backed-hook-tests 実行対象記述を現行実態(固定2 nodeid + test_hook_adapter.py + test_initial_branch_create_lane.py + test_external_manifest_publish.py + test_session_manifest_debounce.mjs)に更新する
  • .claude/skills/ci-test-performance/SKILL.md の Operative Status セクションの同記述を同様に更新する

Out of Scope

Acceptance Criteria

  • AC1: .github/workflows/ci.yml の node-backed-hook-tests job に tests/session_recording/codex/test_external_manifest_publish.py を実行する専用 step が存在する
  • AC2: 追加した step が test_hook_adapter.py / test_initial_branch_create_lane.py と同じ timed measurement pattern(measurements.jsonl 追記、set +e / exit $_s)に従う
  • AC3: "Generate node-backed hook selection artifact" step の pytest --collect-only 対象と generate_ci_test_selection_artifact.py への pytest_args の両方に test_external_manifest_publish.py が含まれる
  • AC4: 同 step 内の session_recording_prefixes タプルに tests/session_recording/codex/test_external_manifest_publish.py が追加されており、exactly_expected_two / matches_expected_nodeids / session_recording_nodeids_present の3 invariant がすべて成立する(job success で証明)
  • AC5: docs/dev/test-lane-policy.md が node-backed-hook-tests の実行対象として test_external_manifest_publish.py を明記する
  • AC6: .claude/skills/ci-test-performance/SKILL.md が同ファイルを明記する
  • AC7: 追加対象ファイルがローカルで実際に実行でき PASS する(前提: Issue test: external manifest publish の Stop/SubagentStop stderr 契約と scope-rollup 環境分離を修正する #1828 がマージ済みであること)

Verification Commands

# AC1
# baseline-expect: fail
$ rg -c "test_external_manifest_publish.py" .github/workflows/ci.yml

# AC2
# baseline-expect: fail
$ rg -n "node_backed_hook_tests_external_manifest_publish_ac" .github/workflows/ci.yml

# AC3
# baseline-expect: fail
$ rg -U -P "Generate node-backed hook selection artifact[\s\S]{0,2000}test_external_manifest_publish\.py" -c .github/workflows/ci.yml

# AC4
# baseline-expect: fail
$ rg -U -P "test_external_manifest_publish\.py\",\s*\n\s*\)" -c .github/workflows/ci.yml

# AC5
# baseline-expect: fail
$ rg -n "test_external_manifest_publish" docs/dev/test-lane-policy.md

# AC6
# baseline-expect: fail
$ rg -n "test_external_manifest_publish" .claude/skills/ci-test-performance/SKILL.md

# AC7
# baseline-expect: fail
$ uv run --locked pytest -q tests/session_recording/codex/test_external_manifest_publish.py -p no:xdist

Allowed Paths

  • .github/workflows/ci.yml
  • docs/dev/test-lane-policy.md
  • .claude/skills/ci-test-performance/SKILL.md

Stop Conditions

Required Skills

  • ci-test-performance
  • GitHub Actions workflow YAML

Required Design References

  • docs/dev/test-lane-policy.md
  • .claude/skills/ci-test-performance/SKILL.md#Operative Status(現行実装状態)
  • docs/dev/ci-performance.md

Scope Delta(該当時のみ記載)

N/A

Runtime Verification Applicability

本 Issue の変更対象は CI workflow 設定・docs のみで、ゲームの実行時動作(game runtime behavior)には影響しません。追加する CI step 自体の正しさは、本 PR に対する CI ワークフロー実行そのもの(job success/failure)が証跡になります。

decision: not_applicable
reason: "CI workflow configuration and docs changes only. No game runtime behavior changed. The correctness of the added CI step is evidenced by the PR's own CI workflow run (job success/failure), not by game runtime verification."

Delivery Rule

  • 1 Issue = 1 PR
  • dedicated worktree を使用する。
  • Draft PR を既定とする。

Notes for Reviewer

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Jul 25, 2026
  2. added a commit that references this issue on Jul 27, 2026
  3. squne121 commented on Jul 27, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES — 現在の Issue 契約のまま実装してはいけません。

    test_external_manifest_publish.py が CI で実行されていないという問題認識は正しいです。しかし、記載された変更をそのまま適用すると node-backed-hook-tests の既存 invariant が壊れ、CI が確実に失敗します。また、修正できるのは既知の一件だけであり、宣言だけで cross-job coverage を成立させる一般的な false-green 経路は残ります。

    Issue #1725 自体には現在コメントがありません。

    P0-1. 記載どおり collect-only 対象を追加すると既存チェックが失敗する

    現在の workflow は、collect-only で取得した nodeid を次の二種類に分類しています。

    • 固定された hook wrapper の2 nodeid
    • session_recording_prefixes に一致する session-recording テスト

    しかし session_recording_prefixes に登録されているのは現在、次の2ファイルだけです。

    • test_hook_adapter.py
    • test_initial_branch_create_lane.py

    Issue #1725 は test_external_manifest_publish.py を collect-only コマンドと args.pytest_args に追加することだけを要求しています。

    この状態で追加すると、test_external_manifest_publish.py の全 nodeid は session-recording ではなく、誤って fixed_hook_wrapper_nodeids に分類されます。その結果、次の両方が失敗します。

    • exactly_expected_two
    • matches_expected_nodeids

    workflow はこれらを hard failure にしているため、実装後の CI は green になりません。

    必要な修正

    Issue の In Scope、AC、Verification Commands に以下を追加する必要があります。

    1. session_recording_prefixes へ3本目を追加する。
    2. できれば prefix 判定を廃止し、nodeid.split("::", 1)[0] から得たファイル集合を、期待する3ファイルの集合と完全一致比較する。
    3. 各ファイルについて nodeid が1件以上あることを個別に確認する。
    4. 固定 wrapper が引き続き「正確に2 nodeid」であることを独立に確認する。

    例えば必要な invariant は次です。

    expected_session_recording_files = {
        "tests/session_recording/codex/test_hook_adapter.py",
        "tests/session_recording/codex/test_initial_branch_create_lane.py",
        "tests/session_recording/codex/test_external_manifest_publish.py",
    }
    
    observed_session_recording_files = {
        nodeid.split("::", 1)[0]
        for nodeid in session_recording_nodeids
    }
    
    if observed_session_recording_files != expected_session_recording_files:
        raise SystemExit(
            "node-backed session-recording file set mismatch: "
            f"expected={sorted(expected_session_recording_files)} "
            f"observed={sorted(observed_session_recording_files)}"
        )

    現在の session_recording_nodeids_present: len(...) > 0 では、3ファイル中1ファイルしか collect されていなくても成功します。これは本 Issue が修正しようとしている問題と同型の false-green です。

    P0-2. 「false-green 経路を解消する」という Outcome は過大主張

    現在の generator は provider job の実行結果を一切参照せず、plan に path が書かれているだけで cross_job_covered_test_files に分類します。

    さらに uncovered_changed_test_files の計算でも、secondary coverage に宣言された path は実行証拠なしで除外されます。

    これは偶発的な実装漏れではありません。既存テストも「plan-only の dedicated lane 宣言だけで changed test を covered と扱う」挙動を正常系として固定しています。

    したがって #1725 が解消するのは、次の一件だけです。

    test_external_manifest_publish.py が宣言されているのに実行されていない、現在既知の不一致

    一般的な宣言専用 false-green は残ります。その一般解は既に Issue #1762 として起票されており、provider artifact、head SHA、実 collected files/nodeids、欠落・stale・重複 provider の拒否まで扱う予定です。

    Issue の表現を次のように変更すべきです。

    • タイトル: 「既知の宣言・実行不一致を修正する」
    • Outcome: 「test_external_manifest_publish.py に関する現在の false-green instance を解消する」
    • Remaining Gaps: 「一般的な宣言専用 coverage 経路は 実装: 全test inventoryとcross-job証跡をfail-close化する #1762 が解消する」
    • depends_on / blocks: #1762

    P0-3. Verification Commands が意味論を検証していない

    現在の検証は主に rg です。これでは以下を検出できません。

    • ファイル名がコメントにだけ追加された
    • collect-only にだけ追加され、実 pytest step に追加されていない
    • 間違った job に追加された
    • continue-on-error: true が設定された
    • measurement は記録するが最後に exit $_s していない
    • 3ファイル中1ファイルだけ collect されている
    • 実行対象、collect対象、plan宣言が不一致
    • 同じテストが別 lane と重複実行されている

    また、pytest --collect-only はテストを実行せず、収集するだけです。したがって collect-only artifact を「実行証拠」と呼んではいけません。([pytest公式ドキュメント]1)

    証拠は明確に分離すべきです。

    • selection evidence: collect-only で file/nodeid が選択された
    • execution evidence: 通常の pytest step が終了コード0で完了した
    • workflow evidence: 対象 job が skip されず、対象 head に対して success になった

    pytest はテストが一件も collect されなかった場合に exit code 5 を返しますが、それだけでは「期待する3ファイル全部が存在した」ことまでは証明できません。([pytest公式ドキュメント]2)

    最低限、AC に次を追加すべきです。

    AC3a: execution target set が plan の node-backed dedicated lane paths と一致する
    AC3b: collect-only target set が同じ3ファイルと一致する
    AC3c: collected file set が同じ3ファイルと完全一致する
    AC3d: 各ファイルの collected nodeid count が1以上である
    AC3e: 固定 wrapper nodeid set は従来どおり正確に2件である
    AC3f: execution step は pytest の終了コードをそのまま step failure に反映する
    

    P1-1. PR #1824 と編集対象が衝突している

    PR #1824 は現在 open draft で、python-test topology を変更しています。変更対象には #1725 の Allowed Paths である以下の全ファイルが含まれています。

    • .github/workflows/ci.yml
    • docs/dev/test-lane-policy.md
    • .claude/skills/ci-test-performance/SKILL.md

    PR #1824 自身も overlap preflight で #1725 との衝突を明記しています。

    したがって、#1725 は少なくとも次のどちらかを明記しなければなりません。

    今から旧 main 前提で実装すると、docs と workflow の topology 記述を再び古い状態へ戻す危険があります。

    P1-2. Runtime Verification を not_applicable にしてはいけない

    この変更にはゲーム runtime は関係ありませんが、GitHub Actions runtime の検証は本質的に必要です。Issue 自身も「PR の CI 実行が証跡」と記載しており、not_applicable と矛盾しています。

    判定は次のように分けるべきです。

    game_runtime:
      decision: not_applicable
    
    workflow_runtime:
      decision: immediate
      execution_environment: github_actions_pull_request
      required_job: node-backed-hook-tests

    さらに GitHub では skipped job が success と報告され、required check をブロックしない場合があります。単なる check 名の green ではなく、対象 job が実際に completed/success であり、skip されていないことを確認する必要があります。([GitHub Docs]3)

    PR workflow では GITHUB_SHA が PR head ではなく merge commit を指すため、証跡には少なくとも次を区別して保存すべきです。

    • github.event.pull_request.head.sha
    • github.sha
    • run_id
    • run_attempt
    • job
    • conclusion

    ([GitHub Docs]4)

    P1-3. 実行対象の正本が増殖している

    現在、node-backed の対象は少なくとも次の場所へ重複記載されています。

    1. python-test-plan.json
    2. pytest 実行 step
    3. collect-only shell command
    4. artifact generator の pytest_args
    5. session_recording_prefixes
    6. docs
    7. Skill

    plan は既に3ファイルを宣言しています。
    一方、docs と Skill は現行実態を十分に列挙しておらず、既に drift しています。

    #1725 では大規模な SSOT 改修を行う必要はありませんが、少なくとも workflow 内の inline validator は「plan宣言とcollect実態の集合一致」を確認すべきです。一般的な SSOT 化と provider artifact 照合は #1762 に委ねるのが妥当です。

    P2. 専用 serial step へ配置する設計自体は妥当

    test_external_manifest_publish.py は Pythonだけのテストではなく、実際に以下を subprocess 起動します。

    • codex-hook-adapter.mjs
    • writer
    • resolver
    • manifest validator
    • node

    また、内部で8並列 writer を起動するテストや、ファイルシステムの atomic publish・permission・hard-link count を検査するテストを含みます。

    したがって、現行 lane topology の下で node-backed-hook-tests に配置し、-p no:xdist で serial 実行する判断は適切です。ただし「この job 以外の選択肢はない」という表現は過剰であり、「現在の Python-only lane invariant を維持する限り、この job が適切」と記述すべきです。

    修正後の最小 Acceptance Criteria

    次の形なら implementation-ready です。

    AC1: node-backed-hook-tests に external_manifest_publish の専用 serial pytest step がある
    AC2: step は一意の step_id / phase_id で measurements.jsonl に記録し、
         pytest exit code をそのまま step exit code にする
    AC3: collect-only command と generator pytest_args の両方に対象ファイルがある
    AC4: session-recording の期待ファイル集合が3ファイルと完全一致する
    AC5: 3ファイルそれぞれの collected nodeid count が1以上である
    AC6: 固定 wrapper nodeid は従来どおり正確に2件である
    AC7: plan宣言・実行対象・collect対象のファイル集合が一致する
    AC8: docs / Skill は同じ実態を記述する
    AC9: ローカル serial pytest が成功する
    AC10: PR head に対する node-backed-hook-tests が非skipの completed/success になる
    

    最終評価

    問題の切り出し自体は妥当で、優先度も高いです。PR #1586 は plan に dedicated lane を追加して G1 gate を通しましたが、実際の CI step へ当該ファイルを配線しておらず、「CI green」がテスト実行を意味しない状態を作りました。

    ただし現契約には、実装するとCIを壊す不足が一件、検証の false-green が複数、並行PR衝突、runtime evidence 判定の矛盾があります。P0-1からP0-3を Issue 本文へ反映し、PR #1824 の収束後の main を基準に再検証してから着手するのが適切です。

  4. changed the title [-]実装: node-backed-hook-tests に test_external_manifest_publish.py の実行 step を追加し宣言専用 coverage の false-green を解消する[/-] [+]実装: node-backed-hook-tests に test_external_manifest_publish.py の実行 step を追加し既知の宣言・実行不一致を解消する(一般解は #1762)[/+] on Jul 27, 2026
  5. squne121 commented on Jul 27, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Human Escalation Required

    The loop has terminated and requires human review. Cause: human judgment required

    Blockers

    "AC7の検証コマンド(test_external_manifest_publish.py の pytest実行)が、pre-existing failure(scope-rollup capture skip診断 eligibility_missing とのstderr不一致)により現在も fail する。この failure の解消はOwner scope外として切り出したfollow-up Issue #1828に委譲済みで、#1725は#1828にGitHub native blockedByで依存する状態にした。"
    
    "review-issue の contract_readiness_check(execute mode)はこの既知のfailureを regression gate failure として human_judgment 判定にする。これはIssue文面上の不備ではなく、#1828という実在する未解決の外部依存によるものであり、Issue本文のさらなる書き換えでは解消できない。"
    
    "OWNER anchor comment(https://github.com/squne121/loop-protocol/issues/1725#issuecomment-5097318451)で指摘された P0-1〜P0-3・P1-1・P1-2・terminology の全項目はcodebase調査による裏付けの上でIssue本文に反映済み(session_recording_prefixesタプル整合AC新設、Outcome narrowing+#1762委譲、VCのstep名存在チェックからファイル包含チェックへの修正、PR #1824重複に伴うrebase前提の明記、Runtime Verification理由文修正)。"
    
    "human判断が必要な点: (1) AC7のbaseline-expect: failのまま#1828マージを前提条件として維持する現在の形で良いか、(2) それとも#1828マージ完了までIssue #1725自体をblockedステートで保留するか、の方針決定。"
    
  6. added
    state/blocked
    on Jul 28, 2026
  7. squne121 commented on Jul 28, 2026

    @squne121
    OwnerAuthor

    Human Escalation の解決

    前回の human escalation で挙げた2択について、以下の方針で解決しました。

    決定: AC7 は baseline-expect: fail(#1828 依存を前提とした現状の記述)のまま維持し、Issue #1725 には state/blocked ラベルを付与しました。

    理由:

    次のアクション(人間 or 自動化への申し送り):

  8. changed the title [-]実装: node-backed-hook-tests に test_external_manifest_publish.py の実行 step を追加し既知の宣言・実行不一致を解消する(一般解は #1762)[/-] [+]実装: node-backed-hook-tests に test_external_manifest_publish.py の実行 step を追加し既知の宣言・実行不一致を解消する[/+] on Aug 12, 2026
  9. squne121 commented on Aug 12, 2026

    @squne121
    OwnerAuthor

    本文改訂: #1762 close 反映

    #1782 の OWNER 敵対的レビュー(https://github.com/squne121/loop-protocol/issues/1782#issuecomment-5266277591)に基づき、依存の一般解 Issue #1762 が not_planned で close されたため、title・Machine-Readable Contract・Parent Goal Ref・Remaining Parent Gaps・Outcome・Out of Scope から #1762 への委譲前提の記述を除去・改訂した。

    本 Issue 自体は disposition KEEP / reframe の対象であり、In Scope / Acceptance Criteria / Allowed Paths / Verification Commands / #1828 への依存関係は変更していない。

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/implementationstate/blocked

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions