Repository navigation
Open
Labels
Description
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-onlyParent 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
- PR 実装: Allowed Paths の canonical no-path marker (none) を全 independent parser/consumer へ導入する #2791 自体の blocker 修正(PR 実装: Allowed Paths の canonical no-path marker (none) を全 independent parser/consumer へ導入する #2791 内で扱う)
- 調査: python-test-core の3ファイルがCI並列実行下で非決定的にfailするroot causeを特定する #2792 が扱う pytest-xdist / shared state / resource contention の root cause 調査
- 全 Python import system の一般化や独自 package manager の導入
- production code を fixture 専用設計へ大規模変更すること
Acceptance Criteria
- isolated repo に real production script をコピーする fixture installer の代表的な call site が inventory 化されている
- repo-local import が追加されたのに dependency copy が欠落した場合、business assertion 群が大量に落ちる前に deterministic に検出できる案が示されている
- 推奨案は canonical checkout への
PYTHONPATHescape を必要とせず、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,commentsAllowed Paths
- (none)
Stop Conditions
- 調査だけでは bounded implementation scope を決められない場合は未確定点を明示して停止
- canonical checkout への import escape を前提にしないと成立しない案しか残らない場合はその理由を記録して停止
- 調査: python-test-core の3ファイルがCI並列実行下で非決定的にfailするroot causeを特定する #2792 の xdist/shared-state 問題と混同せず、依存配備漏れと並列競合を分離できない場合は追加証拠を要求する
Related
- Source PR: 実装: Allowed Paths の canonical no-path marker (none) を全 independent parser/consumer へ導入する #2791
- Source implementation Issue: 実装: Allowed Paths の canonical no-path marker (none) を legacy 慣用句と互換のまま current-main の全 independent parser/consumer へ導入する #2783
- Separate CI isolation investigation: 調査: python-test-core の3ファイルがCI並列実行下で非決定的にfailするroot causeを特定する #2792
Activity