iop/agent-task/m-node-resource-model-unification/01_contract_schema/CODE_REVIEW-cloud-G07.md

12 KiB

Code Review Reference - API

[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 구현 체크리스트; 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 by a selected Milestone 구현 잠금 > 결정 필요 item, fill 사용자 리뷰 요청 with linked evidence and stop with active files in place; code-review decides whether to write USER_REVIEW.md. Do not ask the user directly, present choices in chat, or call request_user_input during implementation. Finalization is review-agent-only.

개요

date=2026-06-27 task=m-node-resource-model-unification/01_contract_schema, plan=0, tag=API

Roadmap Targets

  • Milestone: agent-roadmap/phase/operational-observability-provider-management/milestones/node-resource-model-unification.md
  • Task ids:
    • contract-schema: Node runtime contract and resource catalog validation
  • Completion mode: check-on-pass

이 파일을 읽는 리뷰 에이전트에게

[REVIEW AGENT ONLY] 아래 종결 절차는 코드리뷰 에이전트 전용이다. 구현 에이전트는 이 섹션을 실행하지 않는다.

각 항목의 구현을 실제 소스 파일과 대조하고, 검증 결과 섹션의 출력이 코드와 일치하는지 확인하세요.

구현 항목별 완료 여부

항목 완료 여부
[API-1] Runtime Concurrency Contract [x]
[API-2] Resource Catalog Validation [x]
[API-3] Resource Snapshot Compatibility [x]

구현 체크리스트

  • NodeRuntimeConfig.concurrency를 node-wide admission source가 아닌 legacy/compat runtime payload로 계약 문서와 comments에서 정리한다.
  • nodes[].providers[]를 현재 wire의 resource catalog로 해석한다는 compat 기준을 문서화하고, category=cli|api|local_inference가 CLI/provider/resource 구분자임을 명시한다.
  • nodes[].providers[].adapter가 같은 node 안의 enabled adapter instance로 해석되어야 한다는 config validation을 추가한다.
  • provider adapter reference, duplicate/resource category, legacy config compatibility regression test를 추가한다.
  • proto 변경이 발생하면 make proto를 실행하고 generated diff가 원본 proto와 일치하는지 확인한다.
  • CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.

코드리뷰 전용 체크리스트

[REVIEW AGENT ONLY] 이 체크리스트는 코드리뷰 에이전트만 사용한다.

  • 코드리뷰 결과PASS, WARN, FAIL 중 하나의 판정을 append한다.
  • 판정과 차원별 평가, Required/Suggested/Nit 분류가 서로 일치한다.
  • active CODE_REVIEW-*-G??.mdcode_review_cloud_G07_0.log로 아카이브한다.
  • active PLAN-*-G??.mdplan_cloud_G07_0.log로 아카이브한다.
  • .gitignore의 Agent-Ops 관리 block이 task artifact를 unignore하는지 확인한다.
  • PASS이면 complete.log를 작성하고 active task 디렉터리를 archive로 이동한다.
  • WARN/FAIL이면 다음 active plan/review 또는 USER_REVIEW.md를 작성한다.

계획 대비 변경 사항

  • Validation 구현 위치는 계획의 선택지 중 apps/edge/internal/edgevalidate로 고정했다. config.LoadEdge는 legacy YAML 파싱/구조 검증을 유지하고, config check와 refresh candidate loader가 공유하는 runtime validation 단계에서 provider adapter reference를 검증한다.
  • 새 validator 때문에 refresh 관련 test YAML fixture의 nodes[].providers[].adapter를 명시했다. 이는 새 계약에 맞춘 fixture 정리이며 runtime source behavior 확장은 아니다.
  • Proto field 추가/삭제 없이 comment-only 계약 변경으로 처리했고, make proto 결과 생성물 comment diff만 발생했다.

주요 설계 결정

  • Provider/resource adapter reference는 exact enabled instance key를 먼저 인정하고, legacy type-name route는 같은 type의 enabled instance가 정확히 하나일 때만 인정한다.
  • category: cli resource는 enabled CLI adapter가 있어야 한다. CLI 외 category는 type과 adapter type을 강제 매칭하지 않았다. 예: type: vllm provider가 openai_compat adapter instance를 통해 실행되는 기존 provider 패턴을 보존하기 위해서다.
  • runtime.concurrencyNodeRuntimeConfig.concurrency는 01번 범위에서 legacy compatibility metadata로 문서화만 했다. Node admission 제거는 후속 02+01_node_admission task 범위로 남겼다.

사용자 리뷰 요청

기본값은 없음이다. 구현 중 새 결정이 필요해 보여도 직접 질문하거나 선택지를 제시하거나 request_user_input을 호출하지 않는다. 이 섹션은 선택된 Milestone 구현 잠금 > 결정 필요 항목이 실구현을 차단할 때만 채운다. 외부 환경/secret/서비스 준비, 검증 증거 공백, 반복 실패, 일반 범위 조정은 사용자 리뷰 요청이 아니며 검증 결과, 계획 대비 변경 사항, 또는 code-review의 일반 follow-up plan으로 처리한다.

  • 상태: 없음
  • 사유 유형: 없음
  • 연결 대상: 없음
  • 결정 필요: 없음
  • 차단 근거: 없음
  • 실행한 검증/명령: 없음
  • 자동 후속 불가 이유: 없음
  • 재개 조건: 없음

리뷰어를 위한 체크포인트

  • runtime.concurrency가 더 이상 node-wide admission source로 문서화되지 않았는지 확인한다.
  • provider/resource adapter validation이 같은 node의 enabled adapter 기준인지 확인한다.
  • proto 변경이 있으면 generated 파일이 make proto 결과인지 확인한다.

검증 결과

구현 에이전트가 각 중간 검증 및 최종 검증 명령 실행 후 출력을 여기에 붙여 넣는다.

API-1 중간 검증

$ go test -count=1 ./apps/edge/internal/configrefresh
ok  	iop/apps/edge/internal/configrefresh	0.017s

API-2 중간 검증

$ go test -count=1 ./packages/go/config ./apps/edge/internal/edgevalidate
ok  	iop/packages/go/config	0.040s
ok  	iop/apps/edge/internal/edgevalidate	0.004s

API-3 중간 검증

$ go test -count=1 ./proto/gen/...
?   	iop/proto/gen/iop	[no test files]
$ make proto
protoc \
	--go_out=. \
	--go_opt=module=iop \
	--proto_path=. \
	proto/iop/runtime.proto \
	proto/iop/node.proto \
	proto/iop/control.proto \
	proto/iop/job.proto
$ git diff -- proto/gen/iop
diff --git a/proto/gen/iop/control.pb.go b/proto/gen/iop/control.pb.go
index 05e4b78..362250f 100644
--- a/proto/gen/iop/control.pb.go
+++ b/proto/gen/iop/control.pb.go
@@ -490,13 +490,15 @@ func (x *EdgeStatusRequest) GetRequestId() string {
 // only mirrors what the Edge service exposes and must not carry Node address,
 // token, or scheduling fields.
 type EdgeNodeSnapshot struct {
-	state             protoimpl.MessageState `protogen:"open.v1"`
-	NodeId            string                 `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`
-	Alias             string                 `protobuf:"bytes,2,opt,name=alias,proto3" json:"alias,omitempty"`
-	Label             string                 `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"`
-	Connected         bool                   `protobuf:"varint,4,opt,name=connected,proto3" json:"connected,omitempty"`
-	Config            *NodeConfigPayload     `protobuf:"bytes,5,opt,name=config,proto3" json:"config,omitempty"`
-	ProviderSnapshots []*ProviderSnapshot    `protobuf:"bytes,6,rep,name=provider_snapshots,json=providerSnapshots,proto3" json:"provider_snapshots,omitempty"`
+	state     protoimpl.MessageState `protogen:"open.v1"`
+	NodeId    string                 `protobuf:"bytes,1,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"`
+	Alias     string                 `protobuf:"bytes,2,opt,name=alias,proto3" json:"alias,omitempty"`
+	Label     string                 `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"`
+	Connected bool                   `protobuf:"varint,4,opt,name=connected,proto3" json:"connected,omitempty"`
+	Config    *NodeConfigPayload     `protobuf:"bytes,5,opt,name=config,proto3" json:"config,omitempty"`
+	// provider_snapshots uses the runtime ProviderSnapshot wire name for node
+	// resources/providers. category distinguishes CLI/API/local inference.
+	ProviderSnapshots []*ProviderSnapshot `protobuf:"bytes,6,rep,name=provider_snapshots,json=providerSnapshots,proto3" json:"provider_snapshots,omitempty"`
 	unknownFields     protoimpl.UnknownFields
 	sizeCache         protoimpl.SizeCache
 }
diff --git a/proto/gen/iop/runtime.pb.go b/proto/gen/iop/runtime.pb.go
index 803a783..bfcfd3d 100644
--- a/proto/gen/iop/runtime.pb.go
+++ b/proto/gen/iop/runtime.pb.go
@@ -970,6 +970,10 @@ func (x *NodeCommandResponse) GetProviderSnapshots() []*ProviderSnapshot {
 	return nil
 }
 
+// ProviderSnapshot is the legacy wire name for a node resource/provider status
+// snapshot. category identifies whether the resource is API, CLI, or local
+// inference; provider-pool dispatch is limited to catalog resources referenced
+// by models[].providers.
 type ProviderSnapshot struct {
 	state    protoimpl.MessageState `protogen:"open.v1"`
 	Adapter  string                 `protobuf:"bytes,1,opt,name=adapter,proto3" json:"adapter,omitempty"`
@@ -2106,10 +2110,12 @@ func (x *OpenAICompatAdapterConfig) GetRequestTimeoutMs() int32 {
 	return 0
 }
 
-// NodeRuntimeConfig is the runtime tuning pushed to the node.
+// NodeRuntimeConfig carries legacy node runtime metadata. Execution admission
+// must not use this as a node-wide global gate; provider/resource capacity owns
+// concurrency.
 type NodeRuntimeConfig struct {
 	state         protoimpl.MessageState `protogen:"open.v1"`
-	Concurrency   int32                  `protobuf:"varint,1,opt,name=concurrency,proto3" json:"concurrency,omitempty"`
+	Concurrency   int32                  `protobuf:"varint,1,opt,name=concurrency,proto3" json:"concurrency,omitempty"` // legacy compatibility, 0/unset means no node-wide limit
 	unknownFields protoimpl.UnknownFields
 	sizeCache     protoimpl.SizeCache
 }

최종 검증

$ go test -count=1 ./packages/go/... ./proto/gen/... ./apps/edge/internal/configrefresh ./apps/edge/internal/node
ok  	iop/packages/go/audit	0.002s
?   	iop/packages/go/auth	[no test files]
ok  	iop/packages/go/config	0.040s
?   	iop/packages/go/events	[no test files]
ok  	iop/packages/go/hostsetup	0.007s
?   	iop/packages/go/jobs	[no test files]
?   	iop/packages/go/metadata	[no test files]
ok  	iop/packages/go/observability	0.010s
?   	iop/packages/go/policy	[no test files]
?   	iop/packages/go/version	[no test files]
?   	iop/proto/gen/iop	[no test files]
ok  	iop/apps/edge/internal/configrefresh	0.014s
ok  	iop/apps/edge/internal/node	0.004s
$ go test -count=1 ./apps/edge/...
ok  	iop/apps/edge/cmd/edge	0.041s
ok  	iop/apps/edge/internal/bootstrap	0.280s
ok  	iop/apps/edge/internal/configrefresh	0.025s
ok  	iop/apps/edge/internal/controlplane	4.450s
ok  	iop/apps/edge/internal/edgecmd	0.029s
ok  	iop/apps/edge/internal/edgevalidate	0.015s
ok  	iop/apps/edge/internal/events	0.013s
ok  	iop/apps/edge/internal/input	0.013s
ok  	iop/apps/edge/internal/input/a2a	0.008s
ok  	iop/apps/edge/internal/node	0.005s
ok  	iop/apps/edge/internal/openai	1.514s
ok  	iop/apps/edge/internal/opsconsole	0.006s
ok  	iop/apps/edge/internal/service	0.439s
ok  	iop/apps/edge/internal/transport	2.038s
$ git diff --check

[IMPLEMENTING AGENT - BEFORE SAVING] Have you filled in every implementation-owned section?