Skip to content

調査: isolated subprocess fixture の repo-local import 依存配備漏れを再発防止する #2793

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: research
parent_issue: "none"
goal_ref: "isolated subprocess fixture がコピー対象 production script の repo-local import 依存を欠落させ、実行時 ModuleNotFoundError になる再発パターンを予防する"
change_kind: research-only

Parent Issue

なし(PR #2791 のレビューで発見した横断的な再発防止課題)

Outcome

production script を一時的な isolated repo / fixture repo にコピーして real subprocess で実行するテスト群について、コピー対象スクリプトに repo-local import が追加されたときの「依存ファイル配備漏れ」を deterministic に検出できる最小の仕組みと実装範囲を確定し、必要なら implementation Issue を起票できる状態にする。

Background

PR #2791 で .claude/skills/issue-refinement-loop/scripts/repair_issue_contract.py に scripts/agent-ops/allowed_paths_policy.py への repo-local import が追加された一方、real production script を isolated fixture repo にコピーする既存 fixture は新依存をコピーしていなかった。

PR #2791 の current-head CI では実際に以下が発生している。

from allowed_paths_policy import is_no_path_marker
ModuleNotFoundError: No module named 'allowed_paths_policy'

この種の failure は xdist 並列性や timeout とは独立して、production script の import graph が変わるたびに再発し得る。

In Scope

  • real production script を isolated repo / tmp repo にコピーして subprocess 実行する fixture installer の inventory
  • copied production script の repo-local import dependency closure が fixture 内で満たされるかを deterministic に検証する方法の比較
  • 最小の予防策の決定
    • fixture-local dependency manifest / copy helper
    • fixture construction 時の import-closure assertion
    • production source と fixture payload の bounded parity check
    • その他、既存 fixture の isolation を壊さない小規模案
  • PYTHONPATH 等で canonical checkout の実体へ逃がさず、fixture repo 内で依存が完結することを維持する
  • PR 実装: Allowed Paths の canonical no-path marker (none) を全 independent parser/consumer へ導入する #2791 で顕在化した repair_issue_contract.py -> allowed_paths_policy.py を代表 regression として扱う
  • 推奨案の implementation Issue 化が必要なら起票する

Out of Scope

Acceptance Criteria

  • isolated repo に real production script をコピーする fixture installer の代表的な call site が inventory 化されている
  • repo-local import が追加されたのに dependency copy が欠落した場合、business assertion 群が大量に落ちる前に deterministic に検出できる案が示されている
  • 推奨案は canonical checkout への PYTHONPATH escape を必要とせず、isolated fixture の意味を維持する
  • repair_issue_contract.py -> allowed_paths_policy.py の欠落を再現できる最小 regression scenario が記載されている
  • 既存 fixture 群への適用範囲、導入コスト、false positive / maintenance cost を比較して推奨案が1つ選定されている
  • 実装が必要な場合、bounded scope の implementation Issue が起票され link されている

Verification Commands

# inventory と推奨案、必要なら follow-up implementation Issue が記載されていることを確認
gh issue view THIS_ISSUE_NUMBER --repo squne121/loop-protocol --json body,comments

Allowed Paths

  • (none)

Stop Conditions

Related

Activity

  1. added
    phase/research
    agent/research
    on Sep 27, 2026
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/researchphase/research

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions