Skip to content

実装: trusted human-context Allowed Paths の section-local source binding を保証する #2859

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "#2785: trusted human-context directive の Allowed Paths boundary と patch operation を同一 section-local authority に束縛する"
change_kind: workflow

Parent Issue

なし(#2785 research からの単独実装 follow-up。GitHub native parent は設定しない)

Parent Goal Ref

Current Validated Scope

  • scope_signal_delta.py の boundary / marker / item / operation producer と対応 classifier tests。
  • run_refinement_preflight.py の evidence join、production-reachable patch-plan consumer と対応 preflight tests。
  • decide_rewrite_route.py の既存 operations_empty route と対応 tests(route invariant は維持し、修正が必要な場合のみ編集)。

Remaining Parent Gaps

Source

Background

#2785 の live source contract と縮小 #2779 再現では、全文で Allowed Paths の概念を説明し、別 section に parser inventory path を列挙すると、全文 marker と無関係の item が cross join され false expands_allowed_paths と erroneous append operation を生成する。valid investigation_derived_path_literals は boundary-clearing evidence であって operation source ではなく、追加しても誤 operation は残る。detect_boundary_flags() / extract_directive_markers() / extract_directive_items() / derive_contract_patch_operations() の authority を局所化し、_build_scope_delta_authority_evidence() の join と consume_trusted_anchor_contract_patch_plan() の接続を回帰検証する。

決定論的修正を採用する。小さな pure helper で recognized ## Allowed Paths heading の直下の exact path list、または同一 directive item 内の explicit mutation verb + Allowed Paths + exact literal を source-bound に扱う。boundary flag と operation は同じ局所 source semantics を共有する。単に prompt 注記で unrelated bullets を避ける運用 workaround は誤判定を実装境界で止められないため採用しない。heavyweight Markdown parser / daemon / 新 schema / approval layer を追加せず、既存 #2620 の operations_empty editor route を維持する。section-local exact operation が無い explicit trusted directive のみ editor handoff とし、unsafe input は fail-closed に保つ。

類似 scope: #2842 は freeform unsafe raw append・URL/path span extraction・consumer integrity と失敗理由を所有する。ここで要求する #2842 型 unrelated bullet の producer regression は cross-section source binding に限定し、#2842 の consumer gate を再実装しない。#2778 は HTML/ordered-list 表現の検出 gap を所有し、この Issue はその parser 拡張を行わない。両 Issue と同じ script path を含むため着手時に同一ファイルの変更を直列化し、必要なら依存を調整する。#2620 / #2724 は既存 route の先例であって再設計対象ではない。

Scope Collision (C1 advisory)

Outcome

更新された source-binding producer / preflight connector と回帰 tests を含む 1 PR で、trusted human-context の Allowed Paths mutation が同一 section-local authority 由来の exact operation のみを通常 patch し、安全な operation 不在なら issue_editor_required / writes=0 / live body unchanged、unsafe input なら fail-closed となることを検証可能にする。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: in-process production-reachable preflight / classifier / consumer / route の fixture regression と既存 quality gates で判定し、実 GitHub mutation や外部 agent process の動作検証は acceptance に不要。

In Scope

Out of Scope

Acceptance Criteria

  • AC1: conceptual Allowed Paths 説明と別 section の parser inventory path の fixture は expands_allowed_paths == false、Allowed Paths operation 0 を assertion で固定する。
  • AC2: AC1 に valid investigation-derived path literals を足しても、その literals は operation source にならず、unrelated inventory item からの operation も 0 である。
  • AC3: 同一 item の explicit Allowed Paths に docs/foo.md を追加 は source-bound exact append operation を生成する。
  • AC4: canonical ## Allowed Paths heading と直下の exact path list は local exact operation を生成する(別 section の path は採用しない)。
  • AC5: safe literal と unsafe URL / absolute / traversal の mixed directive は unsafe fragment を無視して部分適用せず fail-closed、mutation writes 0 を固定する。
  • AC6: destructive / external-service / issue-split boundary は investigation evidence で解除せず、従来の fail-closed を維持する。
  • AC7: 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 型 unrelated / freeform bullet を raw Acceptance Criteria append operation に変換しない producer regression を追加する(consumer integrity は 実装: trusted human-context の contract_update mutation lane が、freeform directive から不正な patch operation を導出し、失敗理由を出さずに停止する欠陥を是正する #2842 の所有)。
  • AC8: production-reachable run_preflight() → classification → consume_trusted_anchor_contract_patch_plan() → decide_human_review_directive_editor_route() で、safe op 不在の explicit trusted directive は issue_editor_required / writes=0 / live body unchanged、exact op は通常 patch、unsafe は fail-closed。router の non-empty operations_empty invariant を維持する。新規 regression の実装前 baseline PASS を主張しない。

Verification Commands

各 AC の assertion を上記既存 tests に追加後に実行する。現時点の既存テスト PASS は未作成 regression の PASS を意味しない。各行は独立した単一コマンド。

# AC1
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
# AC2
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
# AC3
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
# AC4
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
# AC5
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
# AC6
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
# AC7
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py
# AC8
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py
# AC8
$ uv run pytest .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_human_review_directive.py
# 標準ゲート
$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build
$ uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py

Allowed Paths

  • .claude/skills/issue-refinement-loop/scripts/scope_signal_delta.py
  • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
  • .claude/skills/issue-refinement-loop/scripts/decide_rewrite_route.py
  • .claude/skills/issue-refinement-loop/tests/test_scope_signal_delta.py
  • .claude/skills/issue-refinement-loop/tests/test_preflight_run_with_anchor.py
  • .claude/skills/issue-refinement-loop/tests/test_decide_rewrite_route_human_review_directive.py

Stop Conditions

Required Skills

なし

Required Design References

  • docs/dev/workflow.md
  • docs/dev/agent-skill-boundaries.md
  • docs/dev/runtime-verification-policy.md

Delivery Rule

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    triage-required
    on Oct 1, 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/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions