# Complete - m-usage-token-log-ops-mvp/01_identity_alias_auth

## 완료 일시

2026-07-09

## 요약

OpenAI-compatible principal token auth/config 계약과 living spec 동기화까지 2개 리뷰 루프를 거쳐 PASS로 완료했다.

## 루프 이력

| Plan | Review | Verdict | 메모 |
|------|--------|---------|------|
| `plan_cloud_G05_0.log` | `code_review_cloud_G05_0.log` | FAIL | Go 구현과 테스트는 통과했지만 OpenAI auth/config 계약과 living spec이 새 principal token 경계를 설명하지 않아 follow-up으로 전환했다. |
| `plan_local_G03_1.log` | `code_review_local_G03_1.log` | PASS | 계약/spec drift를 보정하고 현재 worktree 기준 검증을 재실행해 완료했다. |

## 구현/정리 내용

- `packages/go/config`에 raw-token-free `openai.principal_tokens[]` schema와 validation을 추가했다.
- OpenAI-compatible auth를 principal token hash mapping 우선, legacy bearer fallback으로 구성하고 Chat/Responses/provider tunnel dispatch metadata에 authenticated principal context를 전파했다.
- `agent-contract/outer/openai-compatible-api.md`, `agent-contract/inner/edge-config-runtime-refresh.md`, `agent-spec/input/openai-compatible-surface.md`를 현재 구현 기준으로 동기화했다.

## 최종 검증

- `rg -n "principal_tokens|token_hash_sha256|iop_principal|metadata\\.user|legacy.*bearer|restart_required" agent-contract/outer/openai-compatible-api.md agent-contract/inner/edge-config-runtime-refresh.md agent-spec/input/openai-compatible-surface.md` - PASS; 계약/spec 세 문서에서 principal token auth, metadata policy, legacy fallback, restart-required 근거를 확인했다.
- `GOCACHE=/config/workspace/iop/.cache/go-build go test -count=1 ./packages/go/config ./apps/edge/internal/openai` - PASS; `ok iop/packages/go/config 0.039s`, `ok iop/apps/edge/internal/openai 1.813s`.
- `GOCACHE=/config/workspace/iop/.cache/go-build go test -count=1 ./apps/edge/...` - PASS; edge domain 전체 패키지가 통과했다.
- `git diff --check` - PASS; 출력 없음.

## Roadmap Completion

- Milestone: `agent-roadmap/phase/operational-observability-provider-management/milestones/usage-token-log-ops-mvp.md`
- Milestone link: [Milestone 문서](agent-roadmap/phase/operational-observability-provider-management/milestones/usage-token-log-ops-mvp.md)
- Completed task ids:
  - `identity-scope`: PASS; evidence=`plan_local_G03_1.log`, `code_review_local_G03_1.log`; verification=`GOCACHE=/config/workspace/iop/.cache/go-build go test -count=1 ./packages/go/config ./apps/edge/internal/openai`, `GOCACHE=/config/workspace/iop/.cache/go-build go test -count=1 ./apps/edge/...`, `git diff --check`
  - `token-alias`: PASS; evidence=`plan_local_G03_1.log`, `code_review_local_G03_1.log`; verification=`rg -n "principal_tokens|token_hash_sha256|iop_principal|metadata\\.user|legacy.*bearer|restart_required" agent-contract/outer/openai-compatible-api.md agent-contract/inner/edge-config-runtime-refresh.md agent-spec/input/openai-compatible-surface.md`, `GOCACHE=/config/workspace/iop/.cache/go-build go test -count=1 ./packages/go/config ./apps/edge/internal/openai`
- Not completed task ids: 없음

## 잔여 Nit

- 없음

## 후속 작업

- 없음
