Skip to content

実装: SESSION_RECORDING_SMOKE_VERDICT/v1 schema / collector / validator を追加する #1312

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#246"
goal_ref: "session_recording_smoke_verdict/v1 schema・collector・validator を追加し、#246 の final verdict を機械的に記録できるようにする"
change_kind: mixed

Parent Issue

#246

Parent Goal Ref

Current Validated Scope

  • docs/schemas/session-recording-smoke-verdict.schema.json の新規追加
  • scripts/collect-session-recording-smoke-evidence.mjs の新規追加
  • scripts/check-session-recording-smoke-verdict.mjs の新規追加
  • package.json への smoke-verdict:check script 追加
  • tests/fixtures/session-recording-smoke-verdict/ 配下の fixture 追加
  • 対応する tests 配下の .test.ts の新規追加

Remaining Parent Gaps

Outcome

session_recording_smoke_verdict/v1 という新しい JSON Schema と、それを検証する validator script(scripts/check-session-recording-smoke-verdict.mjs)、および GitHub Issue・PR コメント、生成済み artifact、manifest コメント、negative control fixture から evidence を収集する collector script(scripts/collect-session-recording-smoke-evidence.mjs)が追加され、pnpm run smoke-verdict:check が新規 fixture 群に対して成功終了する状態。

In Scope

  • docs/schemas/session-recording-smoke-verdict.schema.json を追加する(Draft 2020-12、既存の docs/schemas/agent-session-manifest.schema.json のフォーマット・配置規約に合わせる)
  • schema の required フィールドとして最低限、以下を含める。schema(固定値 session_recording_smoke_verdict/v1)、issue、completion_state(pass・fail・blocked のいずれか)、recommendation、followup_issue、legacy_evidence_excluded(真偽値)、authoritative_count(整数)、ac_results(AC0からAC6の verdict map)、token_usage(availability・source・prompt_tokens・completion_tokens・total_tokens。unavailable 時は数値を null にし、0 を禁止する)、github_secret_scanning(status: pass・fail・unavailable、unavailable_reason: permission_missing・feature_disabled・not_checked・null)、stop_conditions_triggered(配列)、evidence_refs(配列)
  • scripts/collect-session-recording-smoke-evidence.mjs を追加する。GitHub Issue・PR コメント、生成済み artifact、manifest コメント、negative control fixture から evidence を収集する
  • 旧 agent_session_manifest のうち secret_policy フィールドを欠くものを legacy evidence として自動除外するロジックを追加する(secret_policy 必須化前の manifest を legacy_evidence_excluded true として分類し authoritative_count に含めない)
  • scripts/generate-session-manifest.mjs による manifest は、--manifest-id と --recorded-at の両方が明示指定された場合のみ authoritative として扱うロジックを追加する(デフォルト生成の UUID・現在時刻の manifest は authoritative_count に含めない)
  • scripts/check-session-recording-smoke-verdict.mjs を追加し、session_recording_smoke_verdict/v1 schema に対する validation を行う。package.json に smoke-verdict:check script として登録する
  • invalid negative control fixture(public_github_comment かつ source_kind transcript の manifest、secret_policy 欠落 manifest 等)を fail させるテストを追加する
  • collector・validator の呼び出し規約として、Secret scan 呼び出しは --fail-on-api-error と --fail-on-finding を必須にする(.claude/scripts/secret_exposure_scanner.py 自体は変更しない)
  • GitHub Secret Scanning API unavailable 時の理由コード(permission_missing・feature_disabled・not_checked)を記録できるようにする
  • token usage は AI self-report を禁止し、unavailable の場合は数値を null にする(0 で偽装しない)ことを schema・validator の両方で担保する
  • followup_issue フィールドを持たせ、research/pilot: AI 駆動 session 記録 pilot smoke test (manifest 整合性 / Kill Switch 動作 / Secret 漏れ検査) #246 の final verdict にこの Issue 番号を機械的に記録できるようにする
  • fixture は tests/fixtures/session-recording-smoke-verdict/ に、既存の tests/fixtures/agent-session-manifest/ の valid-・invalid- 命名規約に合わせて配置する

Out of Scope

Acceptance Criteria

  • AC1: docs/schemas/session-recording-smoke-verdict.schema.json が存在し、有効な JSON Schema(Draft 2020-12)であり、title が session_recording_smoke_verdict/v1 であり、required に schema・issue・completion_state・recommendation・followup_issue・legacy_evidence_excluded・authoritative_count・ac_results・token_usage・github_secret_scanning・stop_conditions_triggered・evidence_refs を含む
  • AC2: token_usage の sub-schema が availability・source・prompt_tokens・completion_tokens・total_tokens を required とし、availability が unavailable の場合は prompt_tokens・completion_tokens・total_tokens が null のみを許容し、0 を許容しない
  • AC3: github_secret_scanning の sub-schema が status(pass・fail・unavailable の enum)と unavailable_reason(permission_missing・feature_disabled・not_checked・null の enum)を持つ
  • AC4: scripts/collect-session-recording-smoke-evidence.mjs が存在し、--help 実行で使用方法を表示する
  • AC5: collector が secret_policy フィールドを欠く agent_session_manifest を legacy evidence として分類し、authoritative_count に含めない
  • AC6: collector が --manifest-id と --recorded-at の両方が明示指定された generate-session-manifest.mjs 出力のみを authoritative として扱う
  • AC7: scripts/check-session-recording-smoke-verdict.mjs が存在し、package.json の smoke-verdict:check script から実行できる
  • AC8: invalid negative control fixture(public_github_comment かつ source_kind transcript の manifest、secret_policy 欠落 manifest)に対して validator が非ゼロ終了コードで fail する
  • AC9: token_usage.availability が unavailable のとき prompt_tokens に 0 を指定した fixture を validator が invalid として拒否する
  • AC10: followup_issue フィールドに Issue 番号(整数または文字列)を設定でき、schema がこれを受理する

Verification Commands

# AC1
# baseline-expect: fail
$ test -f docs/schemas/session-recording-smoke-verdict.schema.json
# AC2
# preflight-scope: runtime_only
$ rg -n "token_usage" docs/schemas/session-recording-smoke-verdict.schema.json
# AC3
# preflight-scope: runtime_only
$ rg -n "github_secret_scanning" docs/schemas/session-recording-smoke-verdict.schema.json
# AC4
# baseline-expect: fail
$ test -f scripts/collect-session-recording-smoke-evidence.mjs
# AC5
# preflight-scope: runtime_only
$ rg -n "legacy_evidence_excluded" scripts/collect-session-recording-smoke-evidence.mjs
# AC6
# preflight-scope: runtime_only
$ rg -n "recorded-at" scripts/collect-session-recording-smoke-evidence.mjs
# AC7
# baseline-expect: fail
$ test -f scripts/check-session-recording-smoke-verdict.mjs
# AC8
# baseline-expect: fail
$ pnpm test
# AC9
$ pnpm test
# AC10
# preflight-scope: runtime_only
$ rg -n "followup_issue" docs/schemas/session-recording-smoke-verdict.schema.json

Allowed Paths

  • docs/schemas/session-recording-smoke-verdict.schema.json
  • scripts/collect-session-recording-smoke-evidence.mjs
  • scripts/check-session-recording-smoke-verdict.mjs
  • package.json
  • tests/fixtures/session-recording-smoke-verdict/
  • tests/session-recording-smoke-verdict-check.test.ts
  • tests/collect-session-recording-smoke-evidence.test.ts

Stop Conditions

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

Required Skills

  • TypeScript(Node.js ESM script)
  • JSON Schema(Draft 2020-12)
  • Vitest BDD

Scope Delta(該当時のみ記載)

N/A

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Jul 4, 2026
  2. squne121 commented on Jul 4, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-04T00:40:51Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/1312
      body_sha256: "sha256:f05d8fad9eab91a37a772d98af091be773ae872f81ec72bc40bca2ab2744c06e"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        vc_preflight: pass
      source: ensure_contract_snapshot_auto
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/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions