Skip to content

実装: credentialless GitHub read live test の github_live marker適合と例外処理是正 #2361

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#2313"
goal_ref: "credentialless GitHub live positive control を `github_live` opt-in verification に分離し、required pytest / PR CI を shared-runner の GitHub API quota・network availability から独立させて deterministic にする(#2313 調査の推奨実装、#2361 OWNER review 反映)"
change_kind: code

Parent Issue

#2313

Parent Goal Ref

Runtime Verification Applicability

  • decision: not_applicable
  • reason: fault injection(monkeypatch による例外分岐の固定)と pytest --collect-only による marker deselect/collect 確認のみで decision-relevant な挙動を deterministic に検証でき、実ネットワークへの live 実行を merge gate(required CI)にしないため

Current Validated Scope

  • scripts/agent-guards/tests/test_credentialless_github_read.py の test_credentialless_public_issue_read_succeeds に @pytest.mark.github_live を付与する
  • 同テストの例外処理を production transport(scripts/agent-guards/github_credentialless_read.py)の現在の taxonomy(TransportConnectivityFailure / RateLimitedRejected / ForbiddenRejected / UnexpectedAuthenticationDependency / CanonicalResourceMissing / UpstreamEnvironmentFailure)に合わせて是正する
  • .claude/skills/impl-review-loop/tests/test_credentialless_read_marker_nodeid_collection.py(新設)で test_credentialless_github_read.py 内の test_credentialless_public_issue_read_succeeds[1] という exact nodeid の deselect/collect 挙動を検証できるようにする(既存の test_github_live_marker_collection.py の _collect() パターンを踏襲する)

Remaining Parent Gaps

Outcome

scripts/agent-guards/tests/test_credentialless_github_read.py::test_credentialless_public_issue_read_succeeds に @pytest.mark.github_live が付与され default pytest 実行から deselect されること、同テストの例外処理が production transport(scripts/agent-guards/github_credentialless_read.py)の現在の taxonomy と整合し、TransportConnectivityFailure(DNS/egress)のみを SKIP、それ以外の構造化例外(RateLimitedRejected / ForbiddenRejected / UnexpectedAuthenticationDependency / CanonicalResourceMissing / UpstreamEnvironmentFailure)および _classify_http_error が分類しない raw/unknown urllib.error.HTTPError をすべて FAIL とすることが、新設の fault-injection ユニットテストファイル(scripts/agent-guards/tests/test_credentialless_read_exception_policy_matrix.py)で検証できること、および新設の marker collection regression test ファイル(.claude/skills/impl-review-loop/tests/test_credentialless_read_marker_nodeid_collection.py)が test_credentialless_public_issue_read_succeeds[1] という exact nodeid を対象に、default では deselect、-m github_live では collect されることを検証していることが、それぞれ commit され、対応する pytest 実行結果で確認できる状態を完了とする。

In Scope

  1. scripts/agent-guards/tests/test_credentialless_github_read.py::test_credentialless_public_issue_read_succeeds に @pytest.mark.github_live を追加する
  2. 同テストの例外処理を、production transport(scripts/agent-guards/github_credentialless_read.py)の現在の taxonomy に合わせて是正する: TransportConnectivityFailure(DNS/egress)のみ SKIP、RateLimitedRejected / ForbiddenRejected / UnexpectedAuthenticationDependency / CanonicalResourceMissing / UpstreamEnvironmentFailure、および _classify_http_error が分類しない raw/unknown urllib.error.HTTPError はすべて FAIL とする。現行の broad except urllib.error.URLError / except OSError は TransportConnectivityFailure 以外の理由で SKIP させない形に是正する。新設ファイル scripts/agent-guards/tests/test_credentialless_read_exception_policy_matrix.py で、monkeypatch/subprocess-based fault-injection により各例外クラス(および raw/unmapped urllib.error.HTTPError)を注入し、期待される skip/fail 判定と一致することを検証する
  3. 新設ファイル .claude/skills/impl-review-loop/tests/test_credentialless_read_marker_nodeid_collection.py で、test_credentialless_public_issue_read_succeeds[1] という exact nodeid を対象に、default では deselect、-m github_live では collect されることを検証できるようにする(既存の .claude/skills/impl-review-loop/tests/test_github_live_marker_collection.py(実装: ensure_contract_snapshot.py の materialized_go 経路で fingerprint PATCH が反映されないバグを修正する #1562 用)はそのまま維持し変更しない)

Out of Scope

Acceptance Criteria

  • AC1: test_credentialless_public_issue_read_succeeds に @pytest.mark.github_live が付与されており、default pytest 実行(-m 'not github_live and not claude_live' 相当)で deselect されることを検証できる
  • AC2: scripts/agent-guards/tests/test_credentialless_read_exception_policy_matrix.py(新設)が、TransportConnectivityFailure(DNS/egress)のみ SKIP、RateLimitedRejected / ForbiddenRejected / UnexpectedAuthenticationDependency / CanonicalResourceMissing / UpstreamEnvironmentFailure および raw/unknown urllib.error.HTTPError はすべて FAIL とする fault-injection ユニットテストで検証しており、Issue 実装: Claude-GPT isolated session の minimum control-plane capability を保証する(uv toolchain resolution + credentialless GitHub read) #2241 AC3 の fail-closed 契約と整合している
  • AC3: .claude/skills/impl-review-loop/tests/test_credentialless_read_marker_nodeid_collection.py(新設)が test_credentialless_public_issue_read_succeeds[1] という exact nodeid を対象に、default での deselect と -m github_live での collect の両方を検証している

Verification Commands

# AC1
$ grep -n "@pytest.mark.github_live" -A2 scripts/agent-guards/tests/test_credentialless_github_read.py
# AC2
$ uv run --locked pytest scripts/agent-guards/tests/test_credentialless_read_exception_policy_matrix.py -q
# AC3
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_credentialless_read_marker_nodeid_collection.py -q

Allowed Paths

  • scripts/agent-guards/tests/test_credentialless_github_read.py
  • scripts/agent-guards/tests/test_credentialless_read_exception_policy_matrix.py
  • .claude/skills/impl-review-loop/tests/test_credentialless_read_marker_nodeid_collection.py

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合。特に対象テストの production transport 呼び出し先(github_credentialless_read.py)の公開 API・例外型を変更する必要が生じた場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合。特に Issue 実装: Claude-GPT isolated session の minimum control-plane capability を保証する(uv toolchain resolution + credentialless GitHub read) #2241 AC3 の fail-closed 契約(rate limit/HTTP error を fail させる設計意図)と矛盾する変更が必要になった場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合。marker collection regression test の汎化が既存の他テストの marker 判定契約を壊す場合を含む

Required Skills

なし

Required Design References

Delivery Rule

1 Issue = 1 PR とする。worktree で作業し、Draft PR を既定とする。

Notes for Reviewer

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Aug 27, 2026
  2. squne121 commented on Aug 27, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES です。ただし、実装方針そのものはかなり良いです。github_live へ移して required CI から実 GitHub API 可用性を切り離す、CI workflow や新 runner、authenticated broker を増やさない、という方向はそのまま採用すべきです。現行 pyproject.toml は既に github_live を default pytest から除外しており、Python test plan 側にも github_live / claude_live を runtime-verification-only として扱う仕組みがあります。

    問題は AC2 の false-green 余地 と AC3 の regression test が弱いことです。この2点は実装前に Issue 本文を直した方がよいです。新しいハーネスやセキュリティ層は不要です。

    Severity | 指摘 | 判定 -- | -- | -- P1 | AC2 の Verification Command が grep TransportConnectivityFailure だけで、skip/fail semantics を証明しない | 修正必須 P1 | marker regression が件数ベースで、対象 nodeid 自体が github_live かを保証しない | 修正必須 P2 | AC2 の taxonomy が #2257 / PR #2260 より古く、ForbiddenRejected と 429 を欠く | 修正推奨 P2 | 「live AC を deterministic にする」という goal が親レビューの結論とズレる | 文言修正推奨

    この形なら 2ファイルだけの小さな PR のまま、元の事故をかなり確実に封じられます。逆に dedicated CI lane や live retry、authenticated read を持ち込むのは、この Issue では品質向上より運用負荷の増加が大きいです。

    総評としては、設計方針は APPROVE、Issue contract は REQUEST_CHANGES です。実装前に上の P1 2件だけ直せば、個人趣味開発としては十分に高品質で、過剰なガードも増やさないバランスになっています。

    ## 判定

    REQUEST_CHANGES です。ただし、実装方針そのものはかなり良いです。github_live へ移して required CI から実 GitHub API 可用性を切り離す、CI workflow や新 runner、authenticated broker を増やさない、という方向はそのまま採用すべきです。現行 pyproject.toml は既に github_live を default pytest から除外しており、Python test plan 側にも github_live / claude_live を runtime-verification-only として扱う仕組みがあります。

    問題は AC2 の false-green 余地 と AC3 の regression test が弱いことです。この2点は実装前に Issue 本文を直した方がよいです。新しいハーネスやセキュリティ層は不要です。

    Severity 指摘 判定
    P1 AC2 の Verification Command が grep TransportConnectivityFailure だけで、skip/fail semantics を証明しない 修正必須
    P1 marker regression が件数ベースで、対象 nodeid 自体が github_live かを保証しない 修正必須
    P2 AC2 の taxonomy が #2257 / PR #2260 より古く、ForbiddenRejected と 429 を欠く 修正推奨
    P2 「live AC を deterministic にする」という goal が親レビューの結論とズレる 文言修正推奨

    P1 — AC2 は現状の VC だと false-green できます

    現在の live test は、5xx の UpstreamEnvironmentFailure を pytest.skip() し、URLError / OSError も skip しています。一方 production transport は DNS/connection/timeout を TransportConnectivityFailure に変換し、401/403/404/429/5xx を構造化例外へ分類しています。

    #2361 はここを直そうとしているので方向は正しいのですが、AC2 の Verification Command は単に、

    grep -n "TransportConnectivityFailure" scripts/agent-guards/tests/test_credentialless_github_read.py

    です。これでは例えば TransportConnectivityFailure の catch を追加しつつ、既存の except urllib.error.URLError: pytest.skip(...) を残しても AC2 が PASS します。Issue 自身が要求している「HTTP error は fail、DNS/egress のみ skip」を証明していません。

    これは実害があります。Python 公式仕様上、HTTPError は URLError の subclass、URLError は OSError の subclass です。したがって production の _classify_http_error() が構造化しない将来の HTTP status、例えば 400/422 等が raw HTTPError として返った場合、broad URLError / OSError catch が残っていれば HTTP failure を SKIP にしてしまいます。([Python documentation]1)

    ここは security harness を増やす必要はありません。test_credentialless_github_read.py 内に unmarked な小さな fault-injection regression を置き、live test の exception policy を直接検証するだけで十分です。最低限、次の matrix を固定すべきです。

    production exception live positive control の verdict
    TransportConnectivityFailure SKIP
    RateLimitedRejected FAIL
    ForbiddenRejected FAIL
    UnexpectedAuthenticationDependency FAIL
    CanonicalResourceMissing FAIL
    UpstreamEnvironmentFailure FAIL
    raw / unknown HTTPError FAIL/Error、SKIP 禁止

    特に except urllib.error.URLError と except OSError は live test から削除して、skip の入口を TransportConnectivityFailure だけにするのが最小で堅いです。残りは CredentiallessReadError をまとめて fail にしてもよく、その方が今後 taxonomy が増えても fail-closed になります。

    PR #2247 の元の OWNER review も、403/429、401、404、5xx を PASS/SKIP に昇格させず、DNS/egress と分離することを要求していました。つまりこれは新しい厳格化ではなく、既存契約を正しく回復するだけです。

    P1 — marker regression は「件数」ではなく対象 nodeid を検証すべきです

    現在の .claude/skills/impl-review-loop/tests/test_github_live_marker_collection.py は、#1562 用の別ファイル test_ensure_contract_snapshot_fingerprint_patch.py を _LIVE_TEST_FILE としてハードコードし、default で "2 deselected"、-m github_live で「2件以上 collected」を見ています。

    この方式を雑に拡張して aggregate count だけ見ると、今回の test_credentialless_public_issue_read_succeeds[1] が marker 未付与でも、別の github_live tests が件数を満たして regression test が green になり得ます。今回まさに「marker policy は存在したが、このテストだけ付与漏れ」という事故なので、件数ベースでは再発防止として弱いです。PR #2319 で unauthenticated live GitHub read も github_live の対象に既に一般化されています。

    ここも大きな generic policy engine は不要です。対象を exact nodeid で確認すれば済みます。

    scripts/agent-guards/tests/test_credentialless_github_read.py
    ::test_credentialless_public_issue_read_succeeds[1]
    

    pytest は nodeid による個別 collection と -m marker selection を公式にサポートしており、対象が全部 deselect された場合の exit code 5 も正式な契約です。([pytestドキュメンテーション]2)

    したがって AC3 は「default → exact node が deselect / exit 5」「-m github_live → exact nodeid が collect / exit 0」を見るべきです。既存 #1562 用チェックは残し、対象ケースを1件追加する程度で十分です。

    P2 — rate limit (403) は現在の taxonomy とずれています

    #2361 は AC2 で RateLimitedRejected と「rate limit(403)」を中心に書いていますが、これは現在の production contract より古いです。Issue #2257 / PR #2260 で、429 は rate limit、403 は rate-limit header evidence がある場合のみ RateLimitedRejected、それ以外の 403 は ForbiddenRejected に改修されています。

    GitHub 公式仕様とも一致します。unauthenticated REST は IP 単位で 60 requests/hour ですが、rate limit 超過は 403 または 429 で、primary limit なら x-ratelimit-remaining: 0、secondary limit では retry-after 等が判断材料になります。403 という status だけで rate-limit と断定すべきではありません。([GitHub Docs]3)

    したがって AC2 は「rate limit (403)」ではなく、概ね RateLimitedRejected / ForbiddenRejected / UnexpectedAuthenticationDependency / CanonicalResourceMissing / UpstreamEnvironmentFailure は fail、TransportConnectivityFailure のみ skip と現在の class taxonomy で書く方がよいです。

    また Required Design References に Issue #2257 / PR #2260 を追加すべきです。#2241 と #2313 だけを読ませると、実装者が現在の 403 classification を見落とす可能性があります。

    P2 — deterministic にする対象を明確化した方がよいです

    親 #2313 の OWNER review で重要なのは、「実 GitHub API を無認証で叩く live test 自体は deterministic にはならない。deterministic にすべきなのは required PR CI」という整理でした。

    ところが #2361 の goal_ref はまだ「credentialless GitHub read の live AC を ... deterministic にする」と書かれています。

    ここは、

    credentialless GitHub live positive control を github_live opt-in verification に分離し、required pytest / PR CI を shared-runner の GitHub API quota・network availability から独立させて deterministic にする

    という意味に修正した方がよいです。live test は今後も 60 req/hour/IP の quota、GitHub outage、ネットワークに依存します。それ自体を deterministic と呼ぶと、後で dedicated runner や retry harness を追加する誤った動機になります。GitHub の unauthenticated rate limit 自体がこの外部依存を避けられないことを示しています。([GitHub Docs]3)

    推奨する最小修正

    Issue のスコープや Allowed Paths は増やさなくてよいです。CI workflow、新 runner、authenticated broker、credential forwarding、strict-markers 導入、scheduled canary も不要です。

    変更すべき契約は次の程度です。

    箇所 修正
    Goal / Outcome deterministic の対象を required CI と明記
    AC2 TransportConnectivityFailure のみ SKIP。それ以外の structured HTTP failures は FAIL。ForbiddenRejected と 429 も明記
    AC2 VC grep を廃止し、monkeypatch/fault injection による behavioral test に変更
    AC3 aggregate collected count ではなく test_credentialless_public_issue_read_succeeds[1] exact nodeid を検証
    Runtime Verification not_applicable は維持。ただし「静的コード確認」ではなく「fault injection + collect-only で deterministic に検証、実ネットワーク実行は merge gate にしない」とする
    Design References #2257 / PR #2260 を追加

    この形なら 2ファイルだけの小さな PR のまま、元の事故をかなり確実に封じられます。逆に dedicated CI lane や live retry、authenticated read を持ち込むのは、この Issue では品質向上より運用負荷の増加が大きいです。

    総評としては、設計方針は APPROVE、Issue contract は REQUEST_CHANGES です。実装前に上の P1 2件だけ直せば、個人趣味開発としては十分に高品質で、過剰なガードも増やさないバランスになっています。

  3. squne121 commented on Aug 27, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: approved

    LOOP_HANDOFF_RESULT_V1:
      schema_version: 1
      issue_number: 2361
      issue_kind: implementation
      handoff_state: implementation_ready
      reviewed_body_sha256: sha256:dc6494e5076cdc5ff68e34e9c018d8e8c856bc9c37c9ac55300716878f729a54
      contract_review_status: go
      verdict: approve

    FOLLOW_UP_MATERIALIZATION_RESULT_V1

    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations: []
  4. squne121 commented on Aug 27, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  5. squne121 commented on Aug 27, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-08-27T15:42:39Z)

  6. squne121 commented on Aug 27, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-08-28T00:00:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2363"
      head_sha: "e5c6f2ef70f8a8a0ed6aab75a94dca5d6a21f49b"
      issue_number: 2361
      termination_reason: approved
      merge_ready: true
      iteration: 1
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations: []
  7. self-assigned this
    on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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