Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "test_manifest_schema_has_secret_policy_property が PASS する状態にする(test_secret_boundary_contract.py の期待値を #536/#537 後の新 schema shape に更新)"
change_kind: testParent Issue
none(単独改善)
Parent Goal Ref
- Goal: pre-existing failure
test_manifest_schema_has_secret_policy_propertyを解消し、test_secret_boundary_contract.pyの全テストが CI で登録・実行できる状態にする - Desired Destination:
.claude/hooks/tests/test_secret_boundary_contract.pyの期待値が現行 schema shape と整合し、テストが PASS している
Current Validated Scope
.claude/hooks/tests/test_secret_boundary_contract.py::test_manifest_schema_has_secret_policy_propertyの期待フィールドを 実装: secret_policy.boundary_enforced の意味論を再設計し runtime attestation と static producer contract を schema 上で分離する #536/feat(#536): split secret policy runtime and static schema #537 後の正しい schema shape に更新する
Remaining Parent Gaps
-
test_secret_boundary_contract.pyの CI 登録(Issue 実装: hooks tests の CI 取りこぼしを防ぐ(directory 実行 + 未登録検出) #682 の Out of Scope に明記されており、本 Issue 完了後に 実装: hooks tests の CI 取りこぼしを防ぐ(directory 実行 + 未登録検出) #682 または後続 Issue で対応)
Outcome
.claude/hooks/tests/test_secret_boundary_contract.py::test_manifest_schema_has_secret_policy_property が PASS する状態になる。
docs/schemas/agent-session-manifest.schema.json は変更しない(#536/#537 の設計を維持)。
本 Issue 完了後、test_secret_boundary_contract.py の CI 登録は #682 の scope delta または dedicated follow-up Issue で扱う。本 PR は #682 を close しない。
Background
PR #694 のレビューで pre-existing failure として確認された test_manifest_schema_has_secret_policy_property は、secret_policy.properties に value_exposed / boundary_enforced / mode が存在することを期待している。
しかし #536/#537(breaking change) で boundary_enforced は廃止され、producer_contract(static 宣言)と runtime_boundary(runtime attestation)に分離済みである。
docs/schemas/agent-session-manifest.md: 「boundary_enforcedは廃止、旧 shape は invalid」と明記- 廃止理由:
boundary_enforced: trueが runtime enforcement 済みと誤読される security semantics 問題
したがって failure の原因は「schema が足りない」ではなく、テストの期待値が #537 後の新 schema shape に追従できていないことである。
修正対象は test_secret_boundary_contract.py のみ。docs/schemas/agent-session-manifest.schema.json は変更しない。
In Scope
.claude/hooks/tests/test_secret_boundary_contract.py::test_manifest_schema_has_secret_policy_propertyの期待フィールドを更新する- 旧期待(stale):
value_exposed/boundary_enforced/mode - 新期待(正しい):
value_exposed/mode/producer_contract/runtime_boundary
- 旧期待(stale):
boundary_enforcedがsecret_policy.propertiesに存在しないことの regression guard を同テストに追加するassert "boundary_enforced" not in secret_policy_props
- Scope Delta(PR fix(#699): update test_manifest_schema_has_secret_policy_property to match current schema shape #716 レビュー指摘受け): 同ファイル内の legacy
boundary_enforcedfixture を新 shape に更新するtest_sentinel_producer_injection_does_not_leakのsecret_policyfixturetest_manifest_fixture_with_secret_policy_validates_sentinel_absenceのsecret_policyfixture
- Scope Delta:
test_manifest_schema_has_secret_policy_propertyに deeper contract check を追加するrequiredフィールドセット(value_exposed/mode/producer_contract/runtime_boundary)additionalProperties: falseの確認producer_contractの型・required フィールド確認runtime_boundaryの型・required フィールド・allOf条件制約確認
Out of Scope
docs/schemas/agent-session-manifest.schema.jsonの変更(実装: secret_policy.boundary_enforced の意味論を再設計し runtime attestation と static producer contract を schema 上で分離する #536/feat(#536): split secret policy runtime and static schema #537 の設計を維持)boundary_enforcedフィールドの schema への追加(廃止済みフィールドの復活は行わない)test_secret_boundary_contract.pyの CI 登録(Issue 実装: hooks tests の CI 取りこぼしを防ぐ(directory 実行 + 未登録検出) #682 で管理)docs/dev/secret-policy.mdの変更- 実装コードや hook スクリプトの変更
tests/agent-session-manifest.test.tsの変更
Acceptance Criteria
- AC1:
uv run pytest .claude/hooks/tests/test_secret_boundary_contract.py::test_manifest_schema_has_secret_policy_property -vが PASS する - AC2:
test_manifest_schema_has_secret_policy_propertyが期待するフィールドにvalue_exposed/mode/producer_contract/runtime_boundaryが含まれる - AC3:
test_manifest_schema_has_secret_policy_propertyがboundary_enforcedを期待しない(regression guard が存在する) - AC4:
docs/schemas/agent-session-manifest.schema.jsonにboundary_enforcedが追加されていない(スキーマ変更なし)
Verification Commands
# AC1
# preflight-scope: pr_review_only
$ uv run pytest .claude/hooks/tests/test_secret_boundary_contract.py::test_manifest_schema_has_secret_policy_property -v
# AC2
$ rg -n "producer_contract" .claude/hooks/tests/test_secret_boundary_contract.py
# AC3
$ rg -n "boundary_enforced.*not in" .claude/hooks/tests/test_secret_boundary_contract.py
# AC4
# preflight-scope: pr_review_only
$ rg -n "boundary_enforced" docs/schemas/agent-session-manifest.schema.jsonAllowed Paths
.claude/hooks/tests/test_secret_boundary_contract.py
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
docs/schemas/agent-session-manifest.schema.jsonの変更が必要と判明した場合(スキーマ変更は本 Issue のスコープ外)- 新規 Issue の起票が必要と判断した場合
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
- Python / pytest
Scope Delta(任意)
N/A(前回の Scope Delta(tests/agent-session-manifest.test.ts 追加)は取り消し。本 Issue では schema 変更を行わないため不要)
Delivery Rule
- 1 Issue = 1 PR
- Draft PR で開始、レビュー後にマージ
Runtime Verification Applicability
rva_schema_version: v1
applicability: not_applicable
decision: not_applicable
reason: "テストファイルの更新のみ。runtime 動作検証不要。pytest PASS を VC で確認する。"
Activity
squne121 commentedon Jun 6, 2026
判定
Issue #699 は方向性として妥当。ただし、このまま実装に渡すと「テストは通るが、secret boundary の意味論を壊す」リスクがあるため、Issue 契約は修正した方がよいです。
対象 failure は実在します。
test_secret_boundary_contract.py::test_manifest_schema_has_secret_policy_propertyはsecret_policy.propertiesにvalue_exposed/boundary_enforced/modeがあることを直接 assert していますが、現行 schema はvalue_exposed/mode/producer_contract/runtime_boundaryを持ち、boundary_enforcedを持っていません。([GitHub]1)また、PR #694 のレビューでもこの failure は pre-existing failure として follow-up 化され、#699 に言及されています。([GitHub]2)
敵対的レビュー
1. Blocker:
docs/dev/secret-policy.mdを根拠にしている記述が不正確Issue #699 は「
docs/dev/secret-policy.mdはboundary_enforced: trueをsecret_policyの一部として扱っている」と書いていますが、現行のdocs/dev/secret-policy.mdにはboundary_enforcedが見つかりません。出てくるのはsecret_policy/v1の inventory metadata であり、boundary_enforcedではありません。([GitHub]3)実際に
boundary_enforcedに近い文脈を持っているのはdocs/dev/session-recording-policy.md側の #412 追加セクションです。ただし、そこでも manifest schema の説明はsecret_policy.value_exposed: falseが中心で、boundary_enforcedは明示されていません。([GitHub]4)修正案:
Issue 本文の Background / In Scope から「
docs/dev/secret-policy.md準拠」という根拠を外し、次のように変えるべきです。2. Blocker:
boundary_enforcedとruntime_boundary.attestedの意味が衝突しうる現行 schema の
secret_policydescription は、static producer contract と runtime attestation を分離している、と明示しています。さらにruntime_boundary.attested/evidence_refが runtime enforcement の実証情報を持つ構造になっています。([GitHub]5)ここに単純に
boundary_enforced: trueを入れると、runtime_boundary.attested: falseの manifest と意味が矛盾します。セキュリティ境界の文脈では、GitHub Actions 公式も「secret がログに出ないことを確認せよ」「sensitive data は plaintext workflow に置くな」としており、自己申告 boolean を実証済み enforcement と誤読させる設計は危険です。([GitHub Docs]6)実装方針:
boundary_enforcedは required にしない。const: trueも付けない。説明文で 互換用・legacy structural marker と明示し、runtime 判定には使わせない。推奨追加:
配置は
value_exposedとmodeの間がよいです。テストが要求するキー集合と、人間の読み順が一致します。3. Major:
secret_policy自体が root required ではないIssue #699 の対象テストは「schema に property があるか」しか見ません。現行 schema の root
requiredにはsecret_policyが含まれていないため、secret_policyを丸ごと省いた manifest が schema validation を通る可能性があります。([GitHub]5)#412 の AC9 は manifest schema または producer output contract に
secret_policy.value_exposed: false相当の明示フィールドを要求しており、AC13 でtest_secret_boundary_contract.pyの実行を求めています。([GitHub]7)したがって #699 は failure 修正としては十分でも、secret boundary enforcement としては不十分です。
ただし #699 に含めるべきではありません。
root required 化は既存 manifest 互換性を壊す可能性があるため、別 Issue に分けるべきです。
後続 Issue 案:
4. Major: fixture が「schema valid」と言いながら現行 schema では valid ではない
test_manifest_fixture_with_secret_policy_validates_sentinel_absenceの fixture はvalue_exposed/boundary_enforced/modeだけを持ちますが、現行 schema のsecret_policy.requiredはproducer_contractとruntime_boundaryも要求しています。つまり、テスト名・コメント上の「schema valid manifest」という主張が schema 実態と一致していません。([GitHub]1)#699 の scope は schema 1 ファイルだけなので、このテスト修正は含めない方がよいです。ただし、#699 完了後に
test_secret_boundary_contract.pyの fixture を現行 schema 準拠に直す follow-up が必要です。5. Major: #682 との接続を明確化する必要がある
#682 は
test_secret_boundary_contract.pyを pre-existing failure のため CI 登録対象外にしています。([GitHub]8)#699 はその failure を消す Issue ですが、#699 完了後に CI 登録まで進めないと回帰防止になりません。Issue #699 は「#682 または後続 Issue で対応」としていますが、これは曖昧です。([GitHub]9)
修正案:
#699 の Outcome に次を追加。
実装 PR に出すべきレビュー指摘
PR が来たら、最低限この観点で見るべきです。
docs/schemas/agent-session-manifest.schema.jsonのみ。Issue 実装: docs/schemas/agent-session-manifest.schema.json に boundary_enforced フィールドを追加する(test_manifest_schema_has_secret_policy_property 修正) #699 の Allowed Paths と一致していること。([GitHub]9)secret_policy.properties.boundary_enforced.typeはboolean。secret_policy.requiredには追加しない。既存互換性を壊さない。boundary_enforcedの説明は runtime enforcement と誤読されない文言にする。runtime_boundary.attested/evidence_refを正本として残す。additionalProperties: falseが未定義 property を拒否するため、今回の追加は schema contract 上も意味があります。([json-schema.org]10)推奨 Verification Commands
Issue #699 の VC は概ねよいですが、次を追加したいです。
Issue #699 本文の修正文案
最終判断
実装は小さいが、セキュリティ契約の意味論が危ない Issue です。
boundary_enforcedを「実行時に境界が実証された」という意味で足すのは不可。runtime_boundary.attestedの互換 marker として optional boolean を追加するなら妥当です。PR レビュー時の判定基準はこれでよいです。
squne121 commentedon Jun 6, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jun 6, 2026
Contract Review: BLOCKED (2026-06-06T12:18:00Z)
不足項目
VC preflight が
status: blockedを返しました。以下の AC/コマンドに問題があります。AC2 —
uv run python3 -c(command_not_allowed / blocked)uv run python3 -cは VC preflight の allowlist 外です(uv run pytestとuv run python3 -m pytestのみ許可)。→ 推奨修正:
# preflight-scope: pr_review_onlyマーカーを追加するか、pytest テストに書き直す。AC3 —
uv run pytest ... ::test_manifest_schema_has_secret_policy_property(human_judgment)テストは実行され exit code 1 で失敗(baseline では期待通り失敗)しますが、preflight classifier が
category: unknown/decision: human_judgmentと判定しました。pytest 失敗の自動分類ができていません。→ 推奨修正:
# preflight-scope: pr_review_onlyマーカーを追加し、実装後の Step 2 (Verification) で確認する。AC4 additive checks —
unexpected_pass(blocked)これらのフィールドは 既にスキーマに存在する ため baseline で exit 0(unexpected_pass/blocked)となります。これらは後方互換性の regression gate チェックですが、baseline_fail_expected として扱われています。
→ 推奨修正:
# preflight-scope: pr_review_onlyマーカーを追加する(既存フィールド確認は baseline-fail の証拠にならないため)。AC4 —
uv run python3 -c(command_not_allowed / blocked)AC2 と同様。
→ 推奨修正:
# preflight-scope: pr_review_onlyマーカーを追加する。分類根拠
uv run python3 -cuv run pytestrg '"runtime_boundary"'rg '"producer_contract"'uv run python3 -c推奨アクション
issue-refinement-loopを起動して VC に# preflight-scope: pr_review_onlyマーカーを追加してください。変更は AC の意味論を変えないため
simple_contract_hygiene_fixに分類されます。squne121 commentedon Jun 6, 2026
Contract Snapshot (2026-06-06T12:21:04Z)
docs/schemas/agent-session-manifest.schema.jsonにboundary_enforcedフィールドが追加され、test_manifest_schema_has_secret_policy_propertyが PASS する状態にするsecret_policy.propertiesにboundary_enforcedキーが存在するboundary_enforcedの型がbooleanであるtest_manifest_schema_has_secret_policy_propertyが PASS するdocs/schemas/agent-session-manifest.schema.jsonが有効な JSON であるdocs/schemas/agent-session-manifest.schema.json.claude/worktrees/issue-699-docs-schemas-agent-session-manifest-scheworktree-issue-699-docs-schemas-agent-session-manifest-schesqune121 commentedon Jun 6, 2026
Contract Snapshot — Scope Delta 反映版 (2026-06-06T12:27:33Z)
Scope Delta:
tests/agent-session-manifest.test.tsを Allowed Paths に追加。boundary_enforcedフィールドを schema に追加し、pytest PASS かつ Vitest 整合を確保するdocs/schemas/agent-session-manifest.schema.jsontests/agent-session-manifest.test.ts(Scope Delta 追加).claude/worktrees/issue-699-docs-schemas-agent-session-manifest-scheworktree-issue-699-docs-schemas-agent-session-manifest-schesqune121 commentedon Jun 6, 2026
実装完了: PR #711 を作成しました。
#711
Quality Gates 結果
pnpm typecheck: PASSpnpm lint: PASSpnpm test(406 tests): PASSpnpm build: PASSuv run pytest test_manifest_schema_has_secret_policy_property -v: PASSuv run pytest test_model_routing.py(21 tests): PASSsqune121 commentedon Jun 6, 2026
Contract Snapshot — スコープ変更版 (2026-06-06T13:05:44Z)
スコープを「schema 変更」から「stale test 修正(#536/#537 整合)」に変更。
test_manifest_schema_has_secret_policy_propertyの期待フィールドを新 schema shape に更新し、regression guard を追加する.claude/hooks/tests/test_secret_boundary_contract.py.claude/worktrees/issue-699-docs-schemas-agent-session-manifest-scheworktree-issue-699-docs-schemas-agent-session-manifest-schefix(#699): update test_manifest_schema_has_secret_policy_property to …
squne121 commentedon Jun 6, 2026
PR を作成しました: #715
実装内容
.claude/hooks/tests/test_secret_boundary_contract.pyのtest_manifest_schema_has_secret_policy_propertyを修正:{"value_exposed", "mode", "producer_contract", "runtime_boundary"}に更新boundary_enforcedの regression guard を追加:assert "boundary_enforced" not in sp_propsdocs/schemas/agent-session-manifest.schema.jsonは変更なしAC 確認結果
uv run pytest ... PASSED✓producer_contractとruntime_boundaryが期待フィールドに含まれる ✓boundary_enforced.*not inの regression guard が存在する ✓docs/schemas/agent-session-manifest.schema.jsonにboundary_enforcedなし ✓fix(#699): update legacy boundary_enforced fixtures and add deeper sc…
fix(#699): update test_manifest_schema_has_secret_policy_property to …