Repository navigation
実装: visual-impact-policy-trusted に TS import graph transitive reachability の trusted-side 独立検証を追加する - #2144
Conversation
…ability の trusted-side 独立検証を追加 (#2099) candidate PR head を checkout/materialize せず、既にfetch済みのgit commit objectを `git ls-tree`/`git cat-file` で読むだけの base-locked な static import resolver (`resolve_trusted_transitive_graph()`) を追加し、 `resolve_trusted_minimum()` の trusted 5シグナルに transitive reachability チェックを追加した (Issue #2099 AC1/AC2)。absolute path / `..` escape / symlink escape / `/` 始まり specifier は単一の confined resolver で 一貫して拒否し (AC3)、per-file/total bytes・file count・import-hop depth・ wall-clock time それぞれに個別 fail-closed reason code を持つ resource bound を実装した (AC4)。transitive-only な変更を検出する adversarial fixture を追加し、`affected_surfaces: []` を forge した producer decision を trusted-side で確実に reject することを end-to-end で検証する (AC5)。 `.github/workflows/visual-impact-trusted-consumer.yml` の trusted input 取得における `|| true` fail-open を除去し (AC6)、`git show`/`git diff` の missing-path と genuine plumbing failure を区別する failure taxonomy を `read_git_blob_at_ref()` として実装した (AC7)。TypeScript dependency の trusted-side bootstrap は「Node dependency を一切持ち込まない」設計を 採用し、既存の pnpm/npm/npx 禁止 regression と自然に整合する (AC8)。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URLPreview removed (PR #2144 closed). |
PR レビュー結果(iteration 0)Mergeability
Evidence Check
Blockers非 required だが legitimate な
verdict: REQUEST_CHANGES
reviewed_head_sha: "b3109d58bbc450d7469b3bbbddd5d04dbde4d58d"
blockers:
- "PR本文が meta_policy_change 分類をトリガーしているにもかかわらず、必須の VISUAL_IMPACT_DECLARATION_V1 fenced yaml block を含んでいない(visual-impact-policy run 31606578749 / job 94147591829 が正しく検出)。surfaces: [] の最小 declaration block を PR 本文に追加する必要がある"
warnings: [] |
meta_policy_change fail-safe が正しく検出した VISUAL_IMPACT_DECLARATION_V1 欠落 (PR review comment #2144 (comment)) を修正するため PR body を更新した。visual-impact-policy job は github.event.pull_request.body をイベントトリガー時点の値で評価するため、 本 empty commit で新規 synchronize イベントを発火し、更新済み body で 再評価させる。コード変更は含まない。
…トリガー (#2099) visual-impact-policy job のログにより、空 surfaces:[] では meta_policy_change で affected 扱いになった combat-hud-critical / combat-hud-running の各エントリが missing 判定されることが判明した(PR #2094 の既存前例パターンに合わせ、両 surface に disposition: verified_unchanged を明示)。component-vrt-report job の 実 VRT 実行結果(baseline diff 0px)がこの申告の evidence として機能する。 コード変更は含まない。
|
fix_delta iteration 1 適用完了(Issue #2099 / レビューコメント #2144 (comment) 対応)。 実施内容PR 本文の「Visual Impact Declaration(視覚影響申告)」節に コード変更は含まない(PR body 編集 + 再検証トリガー用の empty commit 2件のみ、head: 検証結果
別件(out of scope):
|
PR レビュー結果(iteration 1・再レビュー)iteration-0 blocker の解消確認
|
結論REQUEST_CHANGES が妥当です。PR #2144 は設計方向そのものは良く、#2091/#2093 から残った trusted-side transitive reachability gap に対して、candidate checkout/実行を避けた Git-object-backed walker を導入しています。これは また、hard predecessor の #2098 / PR #2104 は既に merge 済みで、Git 認証 bootstrap の前提も満たされています。 現 head P1 — CSS transitive asset の削除で
|
…bing誤分類を修正 (#2099) PR #2144 レビュー fix_delta (iteration 2, human REQUEST_CHANGES) への対応: - P1-1: CSS `url()` のターゲットが候補ヘッドで削除/存在しない場合、これまで サイレントにグラフから消えていたのを `unresolvable_static_import` として fail-closed に報告するよう修正。`resolve_trusted_minimum()` はこれを `trusted_transitive_unknown_impact` として affected surface に反映するため、 偽の `affected_surfaces: []` を検出できる。 - P1-2: CSS `url()`/`@import` の素の相対指定子(`./` プレフィックスなし、 例 `bg.png`)を JS/TS のバブ import 分類器と区別する `_trusted_is_css_relative_specifier()` を新設し、CSS 専用の確認済み resolver 経路へルーティング。 - P1-3: TrustedGraphWalker/`git_ls_tree()`/`read_git_blob_at_ref()` の git subprocess 呼び出しに、検証全体で共有される単一の絶対デッドラインから 導出した `timeout=` を付与。スタールした git プロセスが wall-clock 上限を超えて無期限にブロックすることを防止。 - P1-4: `git ls-tree` / `git cat-file` の真の plumbing 失敗を resource-bound-exceeded と区別する新しい `TrustedGitPlumbingError` を 導入し、`trusted_transitive_git_plumbing_error:*` という別個の理由コード として最終判定に反映(Issue #2099 AC7 の 3 分類維持)。 新規リグレッションテスト 10 件を追加(28/28 既存+新規 pass、visual-impact consumer/schema 76/76 pass、ruff check/format 通過)。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
fix_delta 対応(iteration 2, review comment #2273206822 への回答)human REQUEST_CHANGES の P1-1〜P1-4 をすべて修正し、
新規リグレッションテスト 10 件を追加(人間指摘の各シナリオを含む)。 P2/budget 項目(budget global 化・directory-index fallback・package.json imports/exports)は Issue #2099 の Allowed Paths / In-Scope・Out-of-Scope 境界を尊重し、今回はスコープ外としました(必要であれば follow-up で検討)。 |
PR レビュー結果(iteration 2・人間 REQUEST_CHANGES 対応後の再レビュー)対象: repo owner による PR コメント #2144 (comment) (P1 4件・P2 2件)への対応。 P1 4件、実コードで独立再検証(worker の自己申告を信用せず再確認)
AC / 回帰
P2 項目human 指摘の P2(verdict-global budget, base/head fallback, package.json imports/exports parity)は未対応だが、Issue #2099 Out of Scope 境界と fix_delta の scope 指示に整合するため non-blocking。 verdict: APPROVE
reviewed_head_sha: "14b850e08ac780c0a5695cc6110c86243ce4e181"
blockers: []
warnings:
- "Human P2 items (verdict-global resource budget, base/head directory-index fallback, package.json imports/exports parity) remain unaddressed by design (Issue #2099 Out-of-Scope); consider a follow-up issue if judged worth closing later."Mergeability(control-plane 独立確認)head |
Summary
resolve_trusted_minimum()(scripts/agent-ops/resolve_visual_impact.py)に、candidate PR head を checkout/materialize せず既に fetch 済みの Git commit object をgit ls-tree/git cat-fileで読むだけの base-locked な static import resolver(resolve_trusted_transitive_graph()/TrustedGraphWalker)を追加し、TS/CSS の transitive reachability を trusted side で独立検証する(AC1/AC2)。..escape / symlink escape(git mode120000)//始まり specifier の誤許容を単一の confined resolver(_trusted_resolve_relative_path())で一貫して拒否する(AC3)。max_graph_depth)/ wall-clock time それぞれに個別の fail-closed reason code を持つ resource bound を実装し、超過時はTrustedTransitiveResourceBoundExceededを raise してverify_trusted_artifact()の最終 verdict を無条件にok=Falseにする(AC4)。affected_surfaces: []を forge した producer decision)を追加し、verify_trusted_artifact()の最終 verdict まで通す end-to-end テストで rejection を検証する(AC1/AC5)。.github/workflows/visual-impact-trusted-consumer.ymlの trusted input 取得における|| truefail-open(git diff --name-status ...)を除去した(AC6、214行目の診断用cat verdict.json || trueは対象外のまま維持)。git show/git cat-fileの "path missing at this ref"(正常系)と "ref not resolvable as a commit object" 等の genuine git plumbing failure(異常系)を独立に分類するread_git_blob_at_ref()を追加し、--mode resolve-trusted-registry-blobCLI 経由でワークフローのbase_registry.yml/head_registry.yml取得ロジックを置き換えた(AC7)。test_visual_impact_trusted_consumer.py::test_no_pr_head_execution_no_package_scripts)は無変更のまま満たされる(AC8)。run_mjs()(producer 側 TS-compiler-API resolver 呼び出し)に wall-clock timeout を追加し、hang した Node subprocess が CI job を無期限にブロックしないようにした(Current Validated Scope に記載の既知バグの修正)。Design Note(設計判断)
resolve_visual_impact.mjs)は producer/candidate 側の既存責務のまま変更していない。trusted 側は独立実装の正規表現ベース specifier 抽出であり、tsconfigpaths/baseUrl、Viteresolve.alias、package.jsonimports/exportsは解決しない(既存の producer 側 resolver と同じ、文書化済みの限界)。Checks
pnpm typecheckpnpm lintpnpm testpnpm buildSchema Change Applicability
not_schema_changeUPDATE_BRANCH_REQUEST_V1等の schema は変更していない。VISUAL_IMPACT_TRUSTED_CONSUMER_VERDICT_V1の外部フィールド構造・TrustedRederivationのキャリング契約は変更せず、candidate_head_ref/repo_rootフィールドを新規追加しただけ(既存フィールドは非破壊)。CLI 追加フラグ(--trusted-candidate-tree-ref等)も既存フラグとの互換性を壊さない。Schema Consumer Inventory
N/A(
not_schema_changeのため)。Visual Impact Declaration(視覚影響申告)
本 PR は UI(DOM/CSS)を一切変更しない(Python / GitHub Actions workflow / pytest のみ)。
.github/workflows/visual-impact-trusted-consumer.ymlとscripts/agent-ops/resolve_visual_impact.pyの両方がMETA_POLICY_PATHSに該当するため、resolve_trusted_minimum()の meta-policy-change fail-safe により形式的に全 surface(combat-hud-critical/combat-hud-running)が affected 扱いになる。これは evaluator/resolver コードの防御的仕様であり、本 PR の実装内容自体は trusted-side resolver の追加・強化のみで DOM/CSS の変更を一切含まない。Safety Claim Matrix
git ls-tree/git cat-fileobject 読み取りのみで動作するtest_resolve_visual_impact_trusted_transitive.py全18テスト PASS(実 git repo に対する実 subprocess 実行)。.github/workflows/visual-impact-trusted-consumer.ymlはactions/checkoutに candidate PR head 由来のref:を一切渡さない(既存test_no_pr_head_execution_no_checkout_ref_overrideが継続 PASS)eval/import()/require()を一切呼ばない)TrustedGraphWalker実装コードレビュー(resolve_visual_impact.py内、_read_blob/_visit_module_text/_visit_css_text)。テキストをreでパースするのみで interpreter を起動しない..escape / symlink escape //始まり specifier は confined resolver で一貫して拒否されるtest_absolute_specifier_rejected/test_dot_dot_escape_rejected/test_symlink_escape_rejectedPASS(AC3 VC:pytest -k symlink)ok=False)になり、部分結果を PASS として扱わないtest_resource_bound_*5テスト PASS。test_resource_bound_exceeded_fails_closed_in_verify_trusted_artifactがverify_trusted_artifact()の最終 verdict まで検証(AC4 VC:pytest -k resource_bound)set -euo pipefail下で genuine failure は steps.trusted.outcome != success として publish step に伝播する)test_trusted_failure_blocks_verifier_using_pre_continue_on_error_outcomeが継続 PASS(workflow のcontinue-on-error: true+ publish step の failure taxonomy は無変更)test_typescript_bootstrap_policy_avoids_node_dependency_in_trusted_workflow(AC8 VC:pytest -k typescript_bootstrap)PASS。既存test_no_pr_head_execution_no_package_scriptsregression は無変更のまま PASSCI テストパフォーマンス判定(CI Test Performance Decision、advisory、ci-test-performance skill 準拠)
Notes
git diff --name-status ... || trueを含む行と重複しない別ブロック(artifact ダウンロード周辺)を変更しており、本 PR とのコンフリクトは無い(着手前に確認済み)。