Skip to content

fix: baseline_vc_preflight.py で test -s をサポートし file_not_found_expected として分類する #840

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "baseline_vc_preflight.py の test -s 未対応バグを修正し、shlex.split による argv parse に移行する"
change_kind: code

Parent Issue

none

Parent Goal Ref

  • Goal: baseline_vc_preflight.py が test -s コマンドを正しく file_not_found_expected / go に分類できるようにする
  • Desired Destination: N/A(スタンドアロン Issue)

Current Validated Scope

  • .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py(classify_result 関数の test -s 対応と shlex.split 移行)
  • .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py(test_s_* テスト追加)

Remaining Parent Gaps

なし(スタンドアロン Issue)

背景

#824 の作業で test -s <file> が baseline_vc_preflight.py に unknown として分類され、human_judgment が発生した。test -s は「ファイルが存在し、かつ空でないこと」を検証するコマンドであり、baseline で fail することが期待される(ファイル未作成のため)。

現状

baseline_vc_preflight.py の classify_result 関数は test -f / test -d の exit 1 のみを file_not_found_expected として認識し、test -s は unknown / human_judgment として分類する。また、現行コードは "test -f " in command という substring 判定を使っており、quoted path や空白混入コマンドに弱い。

修正内容

  • classify_result 関数で test -s <path> + exit 1 を file_not_found_expected / go として分類する
  • 判定は shlex.split による argv parse に切り替える(substring 判定から移行)
  • test -s の exit 2(operand missing / extra operand)は go にせず blocked または human_judgment に分類する
  • file_not_found_expected category 名は後方互換性のため維持するが、test -s exit 1 の場合は "missing or zero-size file" の意味であることを fix_hint で補足する

Outcome

baseline_vc_preflight.py の classify_result 関数が test -s <path> + exit 1 を file_not_found_expected / go として正しく分類する。判定は shlex.split による argv parse で行い(substring 判定からの移行)、exit 2 は go にしない。空ファイルの baseline fail も期待通り go に分類される。

In Scope

  • classify_result 関数への test -s exit 1 対応(file_not_found_expected / go)
  • test -f / test -d 判定の shlex.split argv parse への移行
  • test -s exit 2(malformed)を go にしない分類
  • test_s_* 単体テスト追加

Out of Scope

  • test -f / test -d 以外の新規コマンド追加
  • file_not_found_expected カテゴリ名の変更(後方互換性のため維持)
  • baseline_vc_preflight.py の他の分類ロジック変更

Allowed Paths

  • .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
  • .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
  • .claude/skills/issue-contract-review/references/vc-preflight.md(分類仕様を文書化する場合のみ)

Acceptance Criteria

  • AC1: test -s <存在しないファイル> が exit 1 のとき category: file_not_found_expected / decision: go に分類される
  • AC2: test -s <存在するが空のファイル> が exit 1 のとき category: file_not_found_expected / decision: go に分類される(空ファイルも baseline fail 期待。fix_hint: "test -s false means missing or zero-size file" を付与する)
  • AC3: test -s <存在し非空のファイル> が exit 0 のとき category: unexpected_pass / decision: blocked に分類される
  • AC4: 既存の test -f の分類に影響を与えない
  • AC5: test -s 判定は shlex.split 後の argv で行い、単純な substring 判定に依存しない
  • AC6: quoted path / space-containing path の test -s "<path with space>" exit 1 が category: file_not_found_expected / decision: go になる
  • AC7: malformed test -s(operand missing / extra operand)で exit 2 の場合は decision: go にならない(blocked または human_judgment)
  • AC8: test -d の既存 exit 1 分類(file_not_found_expected / go)が維持される
  • AC9: classify_static_command の allowlist コメントと classify_result の実分類仕様が一致している

Verification Commands

# AC1
# preflight-scope: runtime_only
$ uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k "test_s"

# AC2
$ uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k "test_s"

# AC3
$ uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k "test_s"

# AC4
$ uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v

# AC5
$ uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k "test_s"

# AC6
$ uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k "test_s"

# AC7
$ uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k "test_s"

# AC8
$ uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v

# AC9
$ uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

  • Python / shlex / subprocess
  • pytest(ユニットテスト追加)
  • baseline_vc_preflight.py の classify_result ロジック

Runtime Verification Applicability

decision: not_applicable
reason: この Issue の VC はすべて pytest による単体テストであり、アプリ起動・実ブラウザ・MCP ツール実行は不要。

参考

Activity

  1. added
    bug
    phase/research
    on Jun 13, 2026
  2. squne121 commented on Jun 13, 2026

    @squne121
    OwnerAuthor

    判定: REQUEST_CHANGES

    #840 の問題認識は正しいです。現行 baseline_vc_preflight.py は allowlist コメント上では test -f / -d / -s を読取専用 assertion として扱う前提になっていますが、classify_result 側では test -f / test -d の exit 1 だけを file_not_found_expected に分類し、test -s は最後の unknown / human_judgment に落ちます。これは #840 の指摘どおり実バグです。

    ただし、現行 Issue 契約のまま実装に渡すのは粗いです。

    主要ブロッカー

    1. Verification Command のテストパスが間違っている可能性が高い

    #840 の VC は .claude/skills/issue-contract-review/tests/test_baseline_vc_preflight.py を指定していますが、検索で見えている既存テストの実体は .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py です。

    このままだと実装者が正しくテストを書いても、VC 自体が pytest: file or directory not found になり得ます。#840 は「preflight 分類器のバグ修正 Issue」なのに、Issue の VC がまた preflight を誤誘導する構造になっています。まずパスを修正してください。

    推奨:

    uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k "test_s"
    uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v
    uv run pytest .claude/skills/issue-contract-review/tests/ .claude/skills/issue-contract-review/scripts/tests/ -v
    

    2. file_not_found_expected という category は test -s には意味的に不正確

    GNU coreutils の test -s file は「file が存在し、かつサイズが 0 より大きい」場合に true です。つまり exit 1 の原因は「ファイルが存在しない」だけでなく「ファイルは存在するが空」も含みます。(GNU)

    #840 の AC2 は「空ファイルも file_not_found_expected」としていますが、これは category 名と実態がズレています。短期互換性のため既存 category を使う判断はあり得ますが、レビュー観点では telemetry / routing / 後続エージェント判断を汚染します。

    より正確には以下のどちらかにすべきです。

    option_a_backward_compatible:
      category: file_not_found_expected
      subcategory: file_empty_or_missing_expected
      reason: "test -s false means missing or zero-size file"
    

    option_b_schema_clean:
    category: file_empty_or_missing_expected
    decision: go

    既存 schema に category 追加コストがあるなら、最低限 fix_hint または補助フィールドで「missing_or_empty」を残してください。

    3. 実装は文字列 contains ではなく argv で判定すべき

    現行コードは ("test -f " in command or "test -d " in command) という文字列判定です。
    これは test -s file、quoted path、将来の env test -s file、あるいはコメント的文字列混入に弱いです。

    すでにこのスクリプトは run_command で shlex.split(command) を使い、subprocess.run(..., shell=False) で argv 実行しています。 Python 公式 docs も subprocess.run の既定は shell=False で、引数列を使う形を説明しています。(Python documentation)

    実装方針はこうです。

    def _parse_test_file_predicate(command: str) -> tuple[str, str] | None:
    try:
    argv = shlex.split(command)
    except ValueError:
    return None

    if len(argv) != 3:
        return None
    
    if Path(argv[0]).name != "test":
        return None
    
    predicate = argv[1]
    path = argv[2]
    if predicate in {"-f", "-d", "-s"}:
        return predicate, path
    
    return None
    

    そして classify_result 側では exit 1 のみを期待 fail にする。

    test_predicate = _parse_test_file_predicate(command)
    if exit_code == 1 and test_predicate:
    predicate, _path = test_predicate
    if predicate in {"-f", "-d", "-s"}:
    return (
    "expected_fail",
    "file_not_found_expected",
    "go",
    None,
    "baseline_fail_expected",
    )

    exit 0 は既存の generic unexpected_pass でよいです。現行コードは回帰ゲート以外の exit 0 を unexpected_pass / blocked にしているため、#840 AC3 は既存動作で満たせます。

    4. exit 2 を go にしてはいけない

    GNU coreutils の test は true なら 0、false なら 1、式エラーなら 2 を返します。(GNU)
    したがって test -s の分類はこう切るべきです。

    command exit 分類
    test -s missing 1 expected_fail / go
    test -s empty 1 expected_fail / go
    test -s nonempty 0 unexpected_pass / blocked
    test -s 2 blocked または human_judgment
    test -s a b 2 blocked または human_judgment

    #840 の AC は exit 1/0 しか見ていません。異常式の exit 2 を追加しないと、将来 test -s の引数ミスが「baseline fail 期待」として誤分類される余地が残ります。

    関連 Issue / PR / コメントから見たリスク

    #840 の直接発生源は #824 です。#824 には test -s .claude/artifacts/context-mode/ctx-doctor-result.json、test -s .claude/artifacts/context-mode/registered-tools.json、test -s .claude/artifacts/context-mode/profile-isolation.json が VC として入っています。

    #824 のレビューでは、context-mode 導入に対して「自己申告ではなく構造化 artifact / permission policy / runtime evidence で検証する」方向へ修正が要求されていました。特に artifact redaction、registered tools と permission policy の分離、rollback 手順の明確化が求められています。

    関連 PR #856 は最終的に .claude/settings.json に mcp__context-mode__ctx_execute と mcp__context-mode__ctx_fetch_and_index の deny を追加し、context-mode@context-mode plugin を有効化しています。 さらに registered-tools.json では 11 tools を列挙し、ctx_execute / ctx_fetch_and_index を deny として記録しています。

    一方で #856 のレビュー履歴を見ると、最初は Allowed Paths 外の src/main.ts / tests/storage.test.ts 混入、PR Body Japanese Check failure、Safety Claim Matrix 欠落で REQUEST_CHANGES になっています。 その後も runtime VC の証跡が PR body 自己申告だけだとして REQUEST_CHANGES が出ています。

    つまり #840 は小粒な classifier 修正ですが、雑に実装するとまた「VC 自体の品質」「self-report only」「scope 混入」でレビューを詰まらせます。

    #840 に追加すべき Acceptance Criteria

    現行 AC1〜AC4 は最低限ですが、足りません。以下を追加してください。

    - [ ] AC5: `test -s` 判定は `shlex.split` 後の argv で行い、単純な substring 判定に依存しない
    - [ ] AC6: quoted path / space-containing path の `test -s "<path with space>"` exit 1 が `file_not_found_expected` / `go` になる
    - [ ] AC7: malformed `test -s`(operand missing / extra operand)で exit 2 の場合は `go` にならない
    - [ ] AC8: `test -f` / `test -d` の既存 exit 1 分類が維持される
    - [ ] AC9: `classify_static_command` の allowlist コメントと `classify_result` の実分類仕様が一致している
    

    Allowed Paths も明示すべき

    #840 本文には Allowed Paths が見当たりません。小修正でも、PR #856 の履歴から見て Allowed Paths 未定義は scope creep の入口です。最低限これを入れてください。

    ## Allowed Paths
    
    • .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
    • .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
    • .claude/skills/issue-contract-review/references/vc-preflight.md(分類仕様を文書化する場合のみ)

    最終提案

    #840 は実装してよいですが、現行のままだと 「正しいバグを、雑な category と壊れた VC で直す Issue」 です。

    実装者への指示は次に絞るべきです。

    1. test -s を test -f / test -d と同じ exit 1 expected fail 系に追加する。

    2. 判定は substring ではなく argv parse で行う。

    3. exit 2 は絶対に go にしない。

    4. 空ファイルは test -s false なので expected baseline fail だが、file_not_found_expected という category 名の不正確さを補助フィールドまたは docs で明示する。

    5. VC のテストパスを .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py に修正する。

    6. test -s の quoted path / empty file / missing file / non-empty file / malformed expression をすべて regression test に入れる。

    ## 判定: REQUEST_CHANGES

    #840 の問題認識は正しいです。現行 baseline_vc_preflight.py は allowlist コメント上では test -f / -d / -s を読取専用 assertion として扱う前提になっていますが、classify_result 側では test -f / test -d の exit 1 だけを file_not_found_expected に分類し、test -s は最後の unknown / human_judgment に落ちます。これは #840 の指摘どおり実バグです。

    ただし、現行 Issue 契約のまま実装に渡すのは粗いです。

    主要ブロッカー

    1. Verification Command のテストパスが間違っている可能性が高い

    #840 の VC は .claude/skills/issue-contract-review/tests/test_baseline_vc_preflight.py を指定していますが、検索で見えている既存テストの実体は .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py です。

    このままだと実装者が正しくテストを書いても、VC 自体が pytest: file or directory not found になり得ます。#840 は「preflight 分類器のバグ修正 Issue」なのに、Issue の VC がまた preflight を誤誘導する構造になっています。まずパスを修正してください。

    推奨:

    uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k "test_s"
    uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v
    uv run pytest .claude/skills/issue-contract-review/tests/ .claude/skills/issue-contract-review/scripts/tests/ -v

    2. file_not_found_expected という category は test -s には意味的に不正確

    GNU coreutils の test -s file は「file が存在し、かつサイズが 0 より大きい」場合に true です。つまり exit 1 の原因は「ファイルが存在しない」だけでなく「ファイルは存在するが空」も含みます。([GNU]1)

    #840 の AC2 は「空ファイルも file_not_found_expected」としていますが、これは category 名と実態がズレています。短期互換性のため既存 category を使う判断はあり得ますが、レビュー観点では telemetry / routing / 後続エージェント判断を汚染します。

    より正確には以下のどちらかにすべきです。

    option_a_backward_compatible:
      category: file_not_found_expected
      subcategory: file_empty_or_missing_expected
      reason: "test -s false means missing or zero-size file"
    
    option_b_schema_clean:
      category: file_empty_or_missing_expected
      decision: go

    既存 schema に category 追加コストがあるなら、最低限 fix_hint または補助フィールドで「missing_or_empty」を残してください。

    3. 実装は文字列 contains ではなく argv で判定すべき

    現行コードは ("test -f " in command or "test -d " in command) という文字列判定です。
    これは test -s file、quoted path、将来の env test -s file、あるいはコメント的文字列混入に弱いです。

    すでにこのスクリプトは run_command で shlex.split(command) を使い、subprocess.run(..., shell=False) で argv 実行しています。 Python 公式 docs も subprocess.run の既定は shell=False で、引数列を使う形を説明しています。([Python documentation]2)

    実装方針はこうです。

    def _parse_test_file_predicate(command: str) -> tuple[str, str] | None:
        try:
            argv = shlex.split(command)
        except ValueError:
            return None
    
        if len(argv) != 3:
            return None
    
        if Path(argv[0]).name != "test":
            return None
    
        predicate = argv[1]
        path = argv[2]
        if predicate in {"-f", "-d", "-s"}:
            return predicate, path
    
        return None

    そして classify_result 側では exit 1 のみを期待 fail にする。

    test_predicate = _parse_test_file_predicate(command)
    if exit_code == 1 and test_predicate:
        predicate, _path = test_predicate
        if predicate in {"-f", "-d", "-s"}:
            return (
                "expected_fail",
                "file_not_found_expected",
                "go",
                None,
                "baseline_fail_expected",
            )

    exit 0 は既存の generic unexpected_pass でよいです。現行コードは回帰ゲート以外の exit 0 を unexpected_pass / blocked にしているため、#840 AC3 は既存動作で満たせます。

    4. exit 2 を go にしてはいけない

    GNU coreutils の test は true なら 0、false なら 1、式エラーなら 2 を返します。(GNU)
    したがって test -s の分類はこう切るべきです。

    command exit 分類
    test -s missing 1 expected_fail / go
    test -s empty 1 expected_fail / go
    test -s nonempty 0 unexpected_pass / blocked
    test -s 2 blocked または human_judgment
    test -s a b 2 blocked または human_judgment

    #840 の AC は exit 1/0 しか見ていません。異常式の exit 2 を追加しないと、将来 test -s の引数ミスが「baseline fail 期待」として誤分類される余地が残ります。

    関連 Issue / PR / コメントから見たリスク

    #840 の直接発生源は #824 です。#824 には test -s .claude/artifacts/context-mode/ctx-doctor-result.json、test -s .claude/artifacts/context-mode/registered-tools.json、test -s .claude/artifacts/context-mode/profile-isolation.json が VC として入っています。

    #824 のレビューでは、context-mode 導入に対して「自己申告ではなく構造化 artifact / permission policy / runtime evidence で検証する」方向へ修正が要求されていました。特に artifact redaction、registered tools と permission policy の分離、rollback 手順の明確化が求められています。

    関連 PR #856 は最終的に .claude/settings.json に mcp__context-mode__ctx_execute と mcp__context-mode__ctx_fetch_and_index の deny を追加し、context-mode@context-mode plugin を有効化しています。 さらに registered-tools.json では 11 tools を列挙し、ctx_execute / ctx_fetch_and_index を deny として記録しています。

    一方で #856 のレビュー履歴を見ると、最初は Allowed Paths 外の src/main.ts / tests/storage.test.ts 混入、PR Body Japanese Check failure、Safety Claim Matrix 欠落で REQUEST_CHANGES になっています。 その後も runtime VC の証跡が PR body 自己申告だけだとして REQUEST_CHANGES が出ています。

    つまり #840 は小粒な classifier 修正ですが、雑に実装するとまた「VC 自体の品質」「self-report only」「scope 混入」でレビューを詰まらせます。

    #840 に追加すべき Acceptance Criteria

    現行 AC1〜AC4 は最低限ですが、足りません。以下を追加してください。

    - [ ] AC5: `test -s` 判定は `shlex.split` 後の argv で行い、単純な substring 判定に依存しない
    - [ ] AC6: quoted path / space-containing path の `test -s "<path with space>"` exit 1 が `file_not_found_expected` / `go` になる
    - [ ] AC7: malformed `test -s`(operand missing / extra operand)で exit 2 の場合は `go` にならない
    - [ ] AC8: `test -f` / `test -d` の既存 exit 1 分類が維持される
    - [ ] AC9: `classify_static_command` の allowlist コメントと `classify_result` の実分類仕様が一致している

    Allowed Paths も明示すべき

    #840 本文には Allowed Paths が見当たりません。小修正でも、PR #856 の履歴から見て Allowed Paths 未定義は scope creep の入口です。最低限これを入れてください。

    ## Allowed Paths
    
    - `.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py`
    - `.claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py`
    - `.claude/skills/issue-contract-review/references/vc-preflight.md`(分類仕様を文書化する場合のみ)

    最終提案

    #840 は実装してよいですが、現行のままだと 「正しいバグを、雑な category と壊れた VC で直す Issue」 です。

    実装者への指示は次に絞るべきです。

    1. test -s を test -f / test -d と同じ exit 1 expected fail 系に追加する。
    2. 判定は substring ではなく argv parse で行う。
    3. exit 2 は絶対に go にしない。
    4. 空ファイルは test -s false なので expected baseline fail だが、file_not_found_expected という category 名の不正確さを補助フィールドまたは docs で明示する。
    5. VC のテストパスを .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py に修正する。
    6. test -s の quoted path / empty file / missing file / non-empty file / malformed expression をすべて regression test に入れる。
  3. added
    kind/implementation
    and removed
    phase/research
    on Jun 13, 2026
  4. squne121 commented on Jun 13, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

  5. squne121 commented on Jun 13, 2026

    @squne121
    OwnerAuthor

    CONTRACT_REVIEW_RESULT_V1

    schema: CONTRACT_REVIEW_RESULT_V1
    issue_number: 840
    repo: squne121/loop-protocol
    status: blocked
    generated_at: 2026-06-13T10:36:00Z
    body_sha256: sha256:dd888298825b9b46e3253040a5731aa8bc976a35795979812a27a1985ac71808

    判定: blocked

    AC / VC / Allowed Paths は存在するが、implementation issue として必須の構造セクションが欠如しており、実装着手不可と判定する。

    checks

    checks:
      template_compliance: fail
      state_label: go
      allowed_paths_present: go
      vc_present: go
      stop_conditions_complete: fail
      vc_preflight:
        status: partial_blocked
        summary:
          expected_fail: 0
          unexpected_pass: 0
          blocked: 1
          human_judgment: 0
          expected_pass: 7
          skipped: 1
        note: "AC9 timeout は AC8 と同コマンドの順次実行アーティファクト(AC8: 27858ms pass, AC9: 30s timeout)。実質 regression gate pass。"
      ac_verifiability:
        C3_ac_checkbox_format: pass
        C4_vc_commands_present: pass
        C5_ac_vc_number_alignment: pass
        C9_runtime_applicability: legacy_missing
      product_spec_check:
        applicability: not_applicable
        decision: pass
      worktree_branch_collision: go
      next_action: blocked → issue-refinement-loop
      blocked_reasons:
        - "必須セクション '## Stop Conditions' が存在しない(implementation issue 必須)"
        - "必須セクション '## Required Skills' が存在しない"
        - "必須セクション '## Machine-Readable Contract' が存在しない"
        - "必須セクション '## In Scope' / '## Out of Scope' が存在しない"
        - "必須セクション '## Parent Issue' / '## Parent Goal Ref' / '## Current Validated Scope' / '## Remaining Parent Gaps' が存在しない"
        - "## Runtime Verification Applicability セクションがない(C9: LEGACY_MISSING)"

    対処方法

    issue-refinement-loop で以下を追加してください。

    最低限必要なセクション(Stop Conditions は 6 定型項目 + 必要に応じ issue 固有条件):

    ## Stop Conditions
    
    - Allowed Paths 外の変更が必要と判明した場合
    - In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
    - 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
    - 後続 Phase / 別スコープへの波及が判明した場合
    - nested SubAgent delegation が必要になった場合
    - 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
    
    ## Required Skills
    
    - Python / shlex / subprocess
    - pytest(ユニットテスト)
    
    ## Runtime Verification Applicability
    
    not_applicable: この Issue の VC はすべて pytest による単体テストであり、アプリ起動・実ブラウザ・MCP ツール実行は不要。

    SDD スタイルセクション(## Machine-Readable Contract / ## Parent Issue 等)は standalone implementation issue の場合スコープ外の可能性があるが、check_issue_contract.py が必須と判定しているため refinement loop でご確認ください。

  6. squne121 commented on Jun 13, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

  7. squne121 commented on Jun 13, 2026

    @squne121
    OwnerAuthor

    CONTRACT_REVIEW_RESULT_V1

    schema: CONTRACT_REVIEW_RESULT_V1
    issue_number: 840
    repo: squne121/loop-protocol
    status: go
    generated_at: 2026-06-13T11:05:00Z
    body_sha256: sha256:2389d8cf596934371f4aa2744cc09e9c4ac2cbe8acea2a195139682d330d966f

    判定: go

    全チェック通過。implement-issue handoff 可能。

    checks

    checks:
      template_compliance: go
      state_label: go
      allowed_paths_present: go
      vc_present: go
      stop_conditions_complete: go
      vc_preflight:
        status: pass
        summary:
          expected_fail: 0
          unexpected_pass: 0
          blocked: 0
          human_judgment: 0
          expected_pass: 8
          skipped: 1
        note: "AC1 は preflight-scope: runtime_only のため skipped(go)。AC2-9 は regression_gate で全 pass。"
      ac_verifiability:
        C3_ac_checkbox_format: pass
        C4_vc_commands_present: pass
        C5_ac_vc_number_alignment: pass
        C9_runtime_applicability: pass
      product_spec_check:
        applicability: not_applicable
        decision: pass
      worktree_branch_collision: go
      blockers: none
      next_action: go → implement-issue
      blocked_reasons: []

    Contract Snapshot

    outcome: >
      baseline_vc_preflight.py の classify_result 関数が test -s <path> + exit 1 を
      file_not_found_expected / go として正しく分類する。shlex.split による argv parse
      に移行し、exit 2 は go にしない。
    
    acceptance_criteria:
      - AC1: test -s 存在しないファイル exit 1 → file_not_found_expected / go
      - AC2: test -s 空ファイル exit 1 → file_not_found_expected / go(fix_hint付き)
      - AC3: test -s 非空ファイル exit 0 → unexpected_pass / blocked
      - AC4: 既存 test -f 分類に影響なし
      - AC5: shlex.split argv parse(substring 判定廃止)
      - AC6: quoted/空白含むパスの test -s exit 1 → go
      - AC7: malformed test -s exit 2 → go にならない
      - AC8: test -d 既存 exit 1 分類維持
      - AC9: classify_static_command allowlist と classify_result 仕様一致
    
    verification_commands:
      AC1: "uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k 'test_s'"
      AC2: "uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k 'test_s'"
      AC3: "uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k 'test_s'"
      AC4: "uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v"
      AC5: "uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k 'test_s'"
      AC6: "uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k 'test_s'"
      AC7: "uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v -k 'test_s'"
      AC8: "uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v"
      AC9: "uv run pytest .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py -v"
    
    allowed_paths:
      - .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
      - .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
      - .claude/skills/issue-contract-review/references/vc-preflight.md
    
    worktree: .claude/worktrees/issue-840-baseline-vc-test-s-support
    branch: worktree-issue-840-baseline-vc-test-s-support
    
    required_skills:
      - Python / shlex / subprocess
      - pytest
      - baseline_vc_preflight.py classify_result ロジック
    
    runtime_verification_applicability:
      decision: not_applicable
      reason: VC はすべて pytest 単体テスト。アプリ起動・実ブラウザ・MCP ツール実行不要。
    
    vc_preflight_ref:
      schema: baseline_vc_preflight/v1
      status: pass
      body_sha256: sha256:2389d8cf596934371f4aa2744cc09e9c4ac2cbe8acea2a195139682d330d966f
  8. squne121 commented on Jun 13, 2026

    @squne121
    OwnerAuthor

    実装完了 — Draft PR #871

    変更ファイル

    • .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py

      • classify_result 内の test -f/test -d 判定を shlex.split ベース argv parse に移行(AC5)
      • test -s + exit 1 → file_not_found_expected / go、fix_hint: "test -s false means missing or zero-size file" 付与(AC1, AC2)
      • test -s + exit 2 → blocked / unknown(AC7)
      • quoted path(空白含み)対応(AC6)
    • .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py

      • test_s_missing_file_exit1_go / test_s_empty_file_exit1_go / test_s_nonempty_file_exit0_blocked / test_s_quoted_path_exit1_go / test_s_malformed_exit2_not_go 追加

    検証結果

    コマンド 結果
    uv run pytest ... -k "test_s" 9 passed
    uv run pytest ... (全テスト) 72 passed, 1 skipped
    pnpm typecheck pass
    pnpm lint pass
    pnpm test 566 passed
    pnpm build pass

    PR

    #871

  9. added 3 commits that reference this issue on Jun 13, 2026
  10. squne121 commented on Jun 13, 2026

    @squne121
    OwnerAuthor

    PR #871 がマージされ全 AC が確認されたためクローズします。

  11. squne121 commented on Jun 13, 2026

    @squne121
    OwnerAuthor

    post-merge-cleanup: 完了 (2026-06-13)

    • status: ok
    • 次アクション: なし(スタンドアロン Issue、parent なし)
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: post-merge-cleanup
      follow_up_issues: []
      note_only_observations: []

    実行済み操作

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

    bugkind/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions