<!-- task=m-principal-provider-credential-slot-routing/10+08,09_verification_contracts plan=0 tag=TEST -->

# Code Review Reference - TEST

> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.**
> The task is NOT complete until every implementation-owned section below is filled in.
> Complete the `Implementation Checklist`; the final checklist item is mandatory before saving.
> Fill implementation-owned sections, then stop with active files in place and report ready for review.
> If implementation is blocked, record the exact blocker, attempted commands/output, and resume condition only in implementation-owned evidence fields.
> Do not ask the user directly, present choices, call user-input tools, create control-plane stop files, or classify the next state.
> Finalization (`Code Review Result`, log rename, `complete.log`, archive moves, `Review-Only Checklist`) is review-agent-only, even after compaction/resume.
> Follow the ownership table at the bottom of this file for which sections you own.

## Overview

date=2026-08-01
task=m-principal-provider-credential-slot-routing/10+08,09_verification_contracts, plan=0, tag=TEST

## Roadmap Targets

- Milestone: `agent-roadmap/phase/operational-observability-provider-management/milestones/principal-provider-credential-slot-routing.md`
- Milestone link: [Milestone 문서](agent-roadmap/phase/operational-observability-provider-management/milestones/principal-provider-credential-slot-routing.md)
- Task ids:
  - `slot-smoke`: Seulgi/vendor fixture와 대표 slot one-shot qualification
  - `contract-ops`: wire/public contract, spec, redaction/revocation 운영 절차 동기화
- Completion mode: check-on-pass

## Archive Evidence Snapshot

- `agent-task/m-principal-provider-credential-slot-routing/08+03,04,07_secure_delivery/complete.log`: 현재 missing; secure transport/lease/injection/revocation 구현 완료 근거가 필요하다.
- `agent-task/m-principal-provider-credential-slot-routing/09+08_migration_attribution/complete.log`: 현재 missing; mode/attribution 구현 완료 근거가 필요하다.
- 두 predecessor가 PASS한 뒤에만 S17의 “구현 완료” 전제를 충족한다. 구현자는 archive를 별도로 탐색하지 않는다.

## For the Review Agent

> **[REVIEW AGENT ONLY]** The finalization steps below are review-agent only. Implementing agents must not execute this section.

Compare implementation of each item against source files and verify that output in `Verification Results` matches code.
Review completion means the following steps are finished:

1. Append verdict and `review_rework_count` / `evidence_integrity_failure` routing signals.
2. Archive `CODE_REVIEW-cloud-G07.md` → `code_review_cloud_G07_0.log` and `PLAN-local-G07.md` → `plan_local_G07_0.log`.
3. If PASS, write `complete.log` and move active task directory to `agent-task/archive/YYYY/MM/m-principal-provider-credential-slot-routing/10+08,09_verification_contracts/`. If WARN/FAIL, fully write the next filesystem state required by the code-review skill.
4. If PASS and task group is `m-principal-provider-credential-slot-routing`, report completion event metadata. Roadmap state check and `update-roadmap` calls are runtime responsibilities.
5. Check applicable `Review-Only Checklist` items at the final `.log` location before reporting.

---

## Implementation Item Completion

| Item | Status |
|------|---------|
| TEST-1 Deterministic full-cycle credential slot smoke | [ ] |
| TEST-2 Explicit representative live one-shot | [ ] |
| TEST-3 Canonical contract/spec/runbook synchronization | [ ] |

## Implementation Checklist

- [ ] Add a credential-free deterministic Seulgi/vendor/slot fixture and full Control Plane-Edge-Node credential-slot smoke with TLS, attribution, and revoke checks.
- [ ] Add a separately gated, no-retry representative live one-shot that consumes a SOPS secret through stdin and emits only sanitized qualification JSON.
- [ ] Synchronize canonical inner/outer contracts, implementation specs, indexes, and the public redaction/revocation operating guide to the completed 08/09 behavior.
- [ ] Run fresh deterministic smoke, contract/spec pointer checks, repository/task secret scans, and either capture the authorized live one-shot or exact external-execution blocker evidence.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

## Review-Only Checklist

> **[REVIEW AGENT ONLY]** This checklist is used only by the review agent.
> Implementing agents must not modify or check this section.

- [ ] Append one verdict of `PASS`, `WARN`, or `FAIL` and verified `review_rework_count`, `evidence_integrity_failure` to `Code Review Result`.
- [ ] Verify that verdict, `Dimension Assessment`, and Required/Suggested/Nit classifications match.
- [ ] Archive active `CODE_REVIEW-*-G??.md` to `code_review_cloud_G07_0.log`.
- [ ] Archive active `PLAN-*-G??.md` to `plan_local_G07_0.log`.
- [ ] Verify that the Agent-Ops managed block in `.gitignore` unignores `agent-task/**/*.md` and `agent-task/**/*.log` and ignores `agent-roadmap/current.md`.
- [ ] If PASS, write `complete.log` based on `agent-ops/skills/common/code-review/templates/complete-log-template.md` and leave no active `.md` files.
- [ ] If PASS, move active task directory `agent-task/m-principal-provider-credential-slot-routing/10+08,09_verification_contracts/` to `agent-task/archive/YYYY/MM/m-principal-provider-credential-slot-routing/10+08,09_verification_contracts/` and update this checklist at the final archive path.
- [ ] If PASS and task group is `m-principal-provider-credential-slot-routing`, report completion event metadata for runtime, without modifying roadmap or directly calling `update-roadmap`.
- [ ] If PASS for split work, remove empty active parent `agent-task/m-principal-provider-credential-slot-routing/` or verify it was kept due to remaining siblings/files.
- [ ] If WARN/FAIL, write the next filesystem state matching code-review verdict and do not write `complete.log`.

## Deviations from Plan

_Record any deviations from the plan and the rationale here._

## Key Design Decisions

_Record key design decisions here._

## Reviewer Checkpoints

- Confirm the default smoke is network-isolated, creates fresh `/tmp` state and exercises CP slot through TLS lease to Node upstream injection and revoke.
- Confirm Seulgi Chat/Messages and two-slot routes are secret-free tracked fixtures.
- Confirm `--live` requires explicit authorization, reads secret only from stdin, makes at most one generation call and never retries.
- Confirm live evidence contains only provider/model/safe slot ref/date/revision/result and no response content or secret-derived value.
- Compare every contract/spec statement with actual post-08/09 symbols/tests; verify canonical ids and pointers remain unique.
- Confirm redaction/revocation runbook and repository/task scans contain no raw secret/private key.

## Verification Results

Paste actual stdout/stderr below each command. Do not summarize or reconstruct it. Replacement commands require a `Deviations from Plan` entry. For the external one-shot, paste only sanitized stdout and exit status; never paste credential-bearing stderr.

### TEST-1

```bash
bash -n scripts/e2e-credential-slot-smoke.sh
jq -e '.profiles | length >= 4 and any(.[]; .id == "seulgi_chat") and any(.[]; .id == "seulgi_messages")' scripts/fixtures/credential-slot-vendors.json >/dev/null
make test-credential-slot-smoke
```

_Actual output:_

### TEST-2 self-test

```bash
./scripts/e2e-credential-slot-smoke.sh --self-test-live-gate
```

_Actual output:_

### TEST-2 authorized external one-shot or blocker

```bash
SOPS_AGE_KEY_FILE=/config/.config/sops/age/keys.txt \
  sops --decrypt --input-type yaml --output-type binary /config/.config/sops/iop/openai.sops.yaml \
  | IOP_ALLOW_LIVE_PROVIDER=1 ./scripts/e2e-credential-slot-smoke.sh \
      --live --secret-stdin --profile openai --model gpt-5-mini
```

_Sanitized output/exit status, or exact authorization blocker and resume condition:_

### TEST-3 pointer/drift checks

```bash
python3 - <<'PY'
from pathlib import Path
for index in (Path('agent-contract/index.md'), Path('agent-spec/index.md')):
    text = index.read_text()
    for token in text.split('`')[1::2]:
        if token.startswith(('agent-contract/', 'agent-spec/')) and not Path(token).exists():
            raise SystemExit(f'broken pointer: {index}: {token}')
PY
rg --sort path -n --hidden --glob '!agent-task/archive/**' --glob '!*.sops.yaml' --glob '!go.sum' --glob '!PLAN-*.md' --glob '!CODE_REVIEW-*.md' 'BEGIN AGE PRIVATE KEY|sk-[A-Za-z0-9_-]{20,}' agent-contract agent-spec docs scripts agent-task/m-principal-provider-credential-slot-routing/10+08,09_verification_contracts
```

_Actual output:_

### Final Verification

```bash
command -v go && go version && go env GOROOT
command -v bash && command -v jq && command -v openssl && openssl version
command -v sops && command -v curl && command -v netstat
git status --short --branch
bash -n scripts/e2e-credential-slot-smoke.sh
jq -e '.profiles | length >= 4 and any(.[]; .id == "seulgi_chat") and any(.[]; .id == "seulgi_messages")' scripts/fixtures/credential-slot-vendors.json >/dev/null
./scripts/e2e-credential-slot-smoke.sh --self-test-live-gate
make test-credential-slot-smoke
go test -count=1 ./apps/control-plane/... ./apps/edge/... ./apps/node/... ./packages/go/...
python3 - <<'PY'
from pathlib import Path
for index in (Path('agent-contract/index.md'), Path('agent-spec/index.md')):
    text = index.read_text()
    for token in text.split('`')[1::2]:
        if token.startswith(('agent-contract/', 'agent-spec/')) and not Path(token).exists():
            raise SystemExit(f'broken pointer: {index}: {token}')
PY
rg --sort path -n --hidden --glob '!agent-task/archive/**' --glob '!*.sops.yaml' --glob '!go.sum' --glob '!PLAN-*.md' --glob '!CODE_REVIEW-*.md' 'BEGIN AGE PRIVATE KEY|sk-[A-Za-z0-9_-]{20,}' agent-contract agent-spec docs scripts agent-task/m-principal-provider-credential-slot-routing/10+08,09_verification_contracts
```

_Actual output:_

---

> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?**
> If anything is blank, go back and fill it in before saving this file.
> Leave review-agent-only sections unchanged.

## Section Ownership

| Section | Owner | Note |
|---------|-------|------|
| Header comment, Overview, Review Agent Instructions | Fixed at stub creation | Implementing agent must not modify or execute these (archive, complete.log, and task-directory archive move are review-agent only) |
| Roadmap Targets | Fixed at stub creation from plan when present | Implementing agent must not modify; code-review copies it into `complete.log` as `Roadmap Completion` only on PASS |
| Archive Evidence Snapshot | Fixed at stub creation from plan when present | Implementing agent uses it as default prior-loop context; read only the specific archive files cited there when more detail is required |
| Implementation Item Completion (item names) | Fixed at stub creation | Implementing agent checks `[ ]` → `[x]` only |
| Implementation Checklist (item text/order) | Fixed at stub creation from plan | Implementing agent checks `[ ]` → `[x]` only |
| Review-Only Checklist | Review agent only | Implementing agent must not modify or check this section |
| Deviations from Plan, Key Design Decisions | Implementing agent | Replace placeholder text with actual content |
| Reviewer Checkpoints | Fixed at stub creation | Pre-filled from plan |
| Verification Results (section headings + commands) | Fixed at stub creation | Implementing agent fills in command output only; command changes require a `Deviations from Plan` entry |
| Code Review Result | Review agent appends | Not included in stub |
