fix(proto): legacy enum tombstone을 보강한다

retired NodeStatus 이름을 source-level reserved로 고정해 새 번호로 재도입되는 경로를 막는다.

리뷰 루프 산출물을 archive로 정리하고 proto-legacy 완료 근거를 남긴다.
This commit is contained in:
toki 2026-06-06 21:09:10 +09:00
parent 82c1db93f8
commit b5c6ad8107
10 changed files with 442 additions and 19 deletions

View file

@ -60,16 +60,16 @@ task=m-architecture-refactor-foundation/09_proto_legacy_contract, plan=0, tag=AP
> **[REVIEW AGENT ONLY]** 이 체크리스트는 코드리뷰 에이전트만 사용한다.
> 구현 에이전트는 이 섹션을 수정하거나 체크하지 않는다.
- [ ] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
- [ ] 판정과 `차원별 평가`, Required/Suggested/Nit 분류가 서로 일치한다.
- [ ] active `CODE_REVIEW-*-G??.md`를 `code_review_cloud_G06_N.log`로 아카이브한다.
- [ ] active `PLAN-*-G??.md`를 `plan_cloud_G06_M.log`로 아카이브한다.
- [ ] `.gitignore`의 Agent-Ops 관리 block이 `agent-task/**/*.md`와 `agent-task/**/*.log`를 unignore하고 `agent-roadmap/current.md`를 ignore하는지 확인한다.
- [x] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
- [x] 판정과 `차원별 평가`, Required/Suggested/Nit 분류가 서로 일치한다.
- [x] active `CODE_REVIEW-*-G??.md`를 `code_review_cloud_G06_N.log`로 아카이브한다.
- [x] active `PLAN-*-G??.md`를 `plan_cloud_G06_M.log`로 아카이브한다.
- [x] `.gitignore`의 Agent-Ops 관리 block이 `agent-task/**/*.md`와 `agent-task/**/*.log`를 unignore하고 `agent-roadmap/current.md`를 ignore하는지 확인한다.
- [ ] PASS이면 `agent-ops/skills/common/code-review/templates/complete-log-template.md` 기준으로 `complete.log`를 작성하고 active `.md` 파일을 남기지 않는다.
- [ ] PASS이면 active task 디렉터리 `agent-task/m-architecture-refactor-foundation/09_proto_legacy_contract/`를 `agent-task/archive/YYYY/MM/m-architecture-refactor-foundation/09_proto_legacy_contract/`로 이동하고 최종 archive 경로에서 이 체크리스트를 갱신한다.
- [ ] PASS이고 task group이 `m-architecture-refactor-foundation`이면 런타임이 읽을 완료 이벤트 메타데이터를 보고하고, roadmap 수정이나 `update-roadmap` 직접 호출을 하지 않는다.
- [ ] PASS split 작업이면 이동 후 빈 active parent `agent-task/m-architecture-refactor-foundation/`를 제거하거나, 남은 sibling/file이 있어 유지했다고 확인한다.
- [ ] WARN/FAIL이고 user-review gate가 트리거되지 않았으면 다음 active `PLAN-cloud-G06.md`와 `CODE_REVIEW-cloud-G06.md`를 작성하고 `complete.log`를 작성하지 않는다.
- [x] WARN/FAIL이고 user-review gate가 트리거되지 않았으면 다음 active `PLAN-cloud-G06.md`와 `CODE_REVIEW-cloud-G06.md`를 작성하고 `complete.log`를 작성하지 않는다.
- [ ] USER_REVIEW이면 `agent-ops/skills/common/code-review/templates/user-review-template.md` 기준으로 `USER_REVIEW.md`를 작성하고 active `PLAN-*.md`, `CODE_REVIEW-*.md`, `complete.log`를 남기지 않는다.
- [ ] USER_REVIEW가 사용자 결정으로 완료/PASS 해소되면 `USER_REVIEW.md`를 해소 상태로 갱신하고 `complete.log`를 작성한 뒤 task directory를 archive로 이동한다.
@ -252,3 +252,18 @@ Sections and their ownership:
| 리뷰어를 위한 체크포인트 | Fixed at stub creation | Pre-filled from plan |
| 검증 결과 (section headings + commands) | Fixed at stub creation | Implementing agent fills in command output only |
| 코드리뷰 결과 | Review agent appends | Not included in stub |
## 코드리뷰 결과
- 종합 판정: FAIL
- 차원별 평가:
- Correctness: Pass
- Completeness: Fail
- Test coverage: Fail
- API contract: Fail
- Code quality: Pass
- Plan deviation: Fail
- Verification trust: Pass
- 발견된 문제:
- Required: `proto/iop/node.proto:20`에서 `NodeStatus`가 retired value numbers만 reserved하고 `NODE_STATUS_ONLINE`, `NODE_STATUS_OFFLINE`, `NODE_STATUS_DRAINING` 이름을 reserved하지 않는다. 이 상태에서는 같은 이름을 새 enum number로 다시 추가할 수 있어 proto source 자체가 legacy enum 이름 재활성화를 막지 못한다. 계획 [API-2]의 reserved tombstone 계약대로 retired enum value names도 `reserved "NODE_STATUS_ONLINE", "NODE_STATUS_OFFLINE", "NODE_STATUS_DRAINING";`로 고정하고, Go descriptor guard가 `ReservedNames()`까지 확인하게 보강한다. deterministic `rg` 검증은 reserved-name metadata가 아니라 active generated constants/accessors만 잡도록 패턴을 조정한다.
- 다음 단계: FAIL follow-up. Active plan/review를 log로 아카이브하고, user-review gate 없이 다음 `PLAN-cloud-G06.md`와 `CODE_REVIEW-cloud-G06.md`를 작성한다.

View file

@ -0,0 +1,221 @@
<!-- task=m-architecture-refactor-foundation/09_proto_legacy_contract plan=1 tag=REVIEW_API -->
# Code Review Reference - REVIEW_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 user-only decision, user-owned external environment prerequisite, or scope conflict, fill `사용자 리뷰 요청` with evidence and stop with active files in place; code-review decides whether to write `USER_REVIEW.md`. Evidence gaps that a follow-up agent can close by rerunning commands or collecting artifacts are normal follow-up issues, not user-review blockers by themselves.
> Do not ask the user directly, present choices in chat, or call `request_user_input` during implementation; record the needed decision in `사용자 리뷰 요청` and stop for code-review.
> Finalization (`코드리뷰 결과`, log rename, `complete.log`, archive moves, `코드리뷰 전용 체크리스트`) is review-agent-only, even after compaction/resume.
> Follow the ownership table at the bottom of this file for which sections you own.
## 개요
date=2026-06-06
task=m-architecture-refactor-foundation/09_proto_legacy_contract, plan=1, tag=REVIEW_API
## Roadmap Targets
- Milestone: `agent-roadmap/phase/automation-runtime-bridge/milestones/architecture-refactor-foundation.md`
- Task ids:
- `proto-legacy`: legacy scheduling/node registration proto placeholder를 deprecated/reserved/remove 중 하나로 정리하고 생성 코드와 call-site를 맞춘다.
- Completion mode: check-on-pass
## 이 파일을 읽는 리뷰 에이전트에게
> **[REVIEW AGENT ONLY]** 아래 종결 절차는 코드리뷰 에이전트 전용이다. 구현 에이전트는 이 섹션을 실행하지 않는다.
각 항목의 구현을 실제 소스 파일과 대조하고, `검증 결과` 섹션의 출력이 코드와 일치하는지 확인하세요.
리뷰 완료는 아래 순서까지 끝난 상태를 의미합니다.
1. 판정을 append한다.
2. `CODE_REVIEW-cloud-G06.md` -> `code_review_cloud_G06_N.log`, `PLAN-cloud-G06.md` -> `plan_cloud_G06_M.log`로 아카이브한다.
3. PASS이면 `complete.log` 작성 후 active task 디렉터리를 `agent-task/archive/YYYY/MM/m-architecture-refactor-foundation/09_proto_legacy_contract/`로 이동한다. WARN/FAIL이면 user-review gate를 확인한 뒤 다음 active plan/review 파일 또는 `USER_REVIEW.md`를 작성한다. `USER_REVIEW.md`가 사용자 결정으로 완료/PASS 해소되면 code-review가 `USER_REVIEW.md`를 해소 상태로 갱신하고 `complete.log` 작성 후 archive 이동한다.
4. PASS이고 task group이 `m-architecture-refactor-foundation`이면 완료 이벤트 메타데이터를 보고한다. roadmap 상태 체크와 `update-roadmap` 호출은 런타임 책임이다.
5. 적용 가능한 `코드리뷰 전용 체크리스트` 항목을 최종 `.log` 위치에서 체크한 뒤 보고한다.
---
## 구현 항목별 완료 여부
| 항목 | 완료 여부 |
|------|---------|
| [REVIEW_API-1] NodeStatus Reserved Name Tombstone | [x] |
## 구현 체크리스트
- [x] `proto/iop/node.proto`에서 retired `NodeStatus` value names를 source-level reserved name으로 추가하고 관련 주석을 갱신한다.
- [x] `make proto`와 `make proto-dart`로 Go/Dart 생성물을 갱신하고, generated files를 사람이 직접 편집하지 않는다.
- [x] `apps/control-plane/internal/wire/edge_test.go`의 descriptor guard가 `NodeStatus` active value, reserved range, reserved names를 함께 검증하도록 보강한다.
- [x] deterministic stale-symbol 검색을 active generated constants/accessors만 탐지하도록 실행하고 결과를 기록한다.
- [x] 최종 검증 명령을 실행하고 결과를 `CODE_REVIEW-*-G??.md`에 붙인다.
- [x] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
## 코드리뷰 전용 체크리스트
> **[REVIEW AGENT ONLY]** 이 체크리스트는 코드리뷰 에이전트만 사용한다.
> 구현 에이전트는 이 섹션을 수정하거나 체크하지 않는다.
- [x] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
- [x] 판정과 `차원별 평가`, Required/Suggested/Nit 분류가 서로 일치한다.
- [x] active `CODE_REVIEW-*-G??.md`를 `code_review_cloud_G06_N.log`로 아카이브한다.
- [x] active `PLAN-*-G??.md`를 `plan_cloud_G06_M.log`로 아카이브한다.
- [x] `.gitignore`의 Agent-Ops 관리 block이 `agent-task/**/*.md`와 `agent-task/**/*.log`를 unignore하고 `agent-roadmap/current.md`를 ignore하는지 확인한다.
- [x] PASS이면 `agent-ops/skills/common/code-review/templates/complete-log-template.md` 기준으로 `complete.log`를 작성하고 active `.md` 파일을 남기지 않는다.
- [x] PASS이면 active task 디렉터리 `agent-task/m-architecture-refactor-foundation/09_proto_legacy_contract/`를 `agent-task/archive/YYYY/MM/m-architecture-refactor-foundation/09_proto_legacy_contract/`로 이동하고 최종 archive 경로에서 이 체크리스트를 갱신한다.
- [x] PASS이고 task group이 `m-architecture-refactor-foundation`이면 런타임이 읽을 완료 이벤트 메타데이터를 보고하고, roadmap 수정이나 `update-roadmap` 직접 호출을 하지 않는다.
- [x] PASS split 작업이면 이동 후 빈 active parent `agent-task/m-architecture-refactor-foundation/`를 제거하거나, 남은 sibling/file이 있어 유지했다고 확인한다.
- [ ] WARN/FAIL이고 user-review gate가 트리거되지 않았으면 다음 active `PLAN-cloud-G06.md`와 `CODE_REVIEW-cloud-G06.md`를 작성하고 `complete.log`를 작성하지 않는다.
- [ ] USER_REVIEW이면 `agent-ops/skills/common/code-review/templates/user-review-template.md` 기준으로 `USER_REVIEW.md`를 작성하고 active `PLAN-*.md`, `CODE_REVIEW-*.md`, `complete.log`를 남기지 않는다.
- [ ] USER_REVIEW가 사용자 결정으로 완료/PASS 해소되면 `USER_REVIEW.md`를 해소 상태로 갱신하고 `complete.log`를 작성한 뒤 task directory를 archive로 이동한다.
## 계획 대비 변경 사항
- 계획대로 구현했으며 deviation 없음. 첫 리뷰(`code_review_cloud_G06_0.log`)에서 Required로 지적된 `NodeStatus` retired value name reservation 누락을 이번 follow-up에서 복원했다. 이전 plan(plan=0)에서 deterministic 검색 계약과의 충돌을 이유로 enum 이름 reservation을 생략했던 결정을, 검색 패턴을 active generated constant/accessor 전용으로 좁히는 이번 plan(plan=1)의 방향에 맞춰 되돌렸다.
- 최종 검증의 deterministic `rg` 패턴은 plan=1이 명시한 active 식별자 전용 패턴(`NodeStatus_NODE_STATUS_ONLINE`, `static const NodeStatus NODE_STATUS_ONLINE` 등)을 그대로 사용했다. reserved-name metadata에 남는 bare `NODE_STATUS_ONLINE` 문자열은 plan 기대 결과대로 의도된 tombstone이며 검색 대상이 아니다.
## 주요 설계 결정
- `NodeStatus`에 `reserved 1 to 3;`(value number)와 `reserved "NODE_STATUS_ONLINE", "NODE_STATUS_OFFLINE", "NODE_STATUS_DRAINING";`(value name)를 함께 두어, retired enum 값을 새 번호로도 retired 이름으로도 재도입할 수 없게 source 레벨에서 막았다. reserved name이 generated descriptor metadata에 문자열로 남는 것은 tombstone 그 자체이며 active 값이 아니다.
- Go descriptor guard(`TestNodeRegistrationLegacyTombstone`)를 보강해 (1) active value가 `NODE_STATUS_UNSPECIFIED=0` 단일, (2) `ReservedRanges().Has(1..3)`, (3) `ReservedNames().Has(...)` 세 가지를 모두 검증한다. 이로써 enum 이름 reservation이 제거되면 테스트가 실패한다.
- generated 산출물은 직접 편집하지 않고 `make proto`/`make proto-dart`로만 갱신했다. message field tombstone(`Schedule*`, `NodeInfo`, `NodeRegister*`)과 active `runtime.proto`/Control Plane-Edge wire 계약은 이번 범위가 아니며 손대지 않았다.
## 사용자 리뷰 요청
_기본값은 `없음`이다. 구현 중 사용자 결정, 사용자 소유 외부 환경/secret/서비스 준비, 또는 계획 범위 변경 없이는 안전하게 진행할 수 없으면 아래 항목을 실제 내용으로 교체하고, 구현을 중단한 뒤 active 파일을 그대로 둔 채 리뷰를 요청한다. 구현 에이전트는 사용자에게 직접 질문하거나 선택지를 제시하거나 `request_user_input`을 호출하지 않는다. 후속 에이전트가 명령 재실행이나 산출물 수집으로 해소할 수 있는 검증 증거 공백만으로는 사용자 리뷰 요청을 작성하지 않는다._
- 상태: 없음
- 사유 유형: 없음
- 결정 필요: 없음
- 차단 근거: 없음
- 실행한 검증/명령: 없음
- 자동 후속 불가 이유: 없음
- 재개 조건: 없음
## 리뷰어를 위한 체크포인트
- `proto/iop/node.proto`의 `NodeStatus`가 retired value numbers와 retired value names를 모두 reserved tombstone으로 고정하는지 확인한다.
- Go descriptor guard가 active value, reserved range, reserved names를 모두 검증하는지 확인한다.
- Go/Dart generated files가 manual edit이 아니라 `make proto`/`make proto-dart` 산출물인지 확인한다.
- deterministic search가 reserved metadata가 아닌 active generated constants/accessors만 탐지하도록 실행됐는지 확인한다.
## 검증 결과
_구현 에이전트가 각 중간 검증 및 최종 검증 명령 실행 후 출력을 여기에 붙여 넣는다._
필수 규칙:
- 검증 명령은 고정된 계약이다. 임의로 대체하지 않는다.
- 대체가 필요하면 `계획 대비 변경 사항`에 이유와 대체 명령을 기록한다.
- `검증 결과`에는 실제 stdout/stderr를 붙여 넣는다.
- 사용자 리뷰 요청으로 명령을 끝까지 실행하지 못했다면 `사용자 리뷰 요청`에 실행한 명령, 실제 출력, 미실행 명령의 사유를 기록한다.
- mobile/UI hang, timeout, 또는 2분 무진행은 blind retry를 중단하고 focused rerun 명령과 screenshot/window/UI-tree evidence path를 남기며, 불가능하면 정확한 사유를 남긴다.
> 비고: `make proto`/`make proto-dart`는 protoc 호출 echo만 출력하고 별도 stdout 없이 성공 종료한다. 재실행 시 추가 codegen drift는 없다(node.pbenum/pbjson/pb.go만 이번 변경분으로 modified 유지).
### REVIEW_API-1 중간 검증
```bash
$ 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
$ make proto-dart
mkdir -p apps/client/lib/gen
protoc \
--plugin=protoc-gen-dart=/config/.local/bin/protoc-gen-dart \
--dart_out=apps/client/lib/gen \
--proto_path=. \
--proto_path=/config/.local/include \
proto/iop/runtime.proto \
proto/iop/node.proto \
proto/iop/control.proto \
proto/iop/job.proto
$ go test -count=1 ./apps/control-plane/internal/wire ./proto/gen/...
ok iop/apps/control-plane/internal/wire 1.474s
? iop/proto/gen/iop [no test files]
```
### 최종 검증
```bash
$ 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
$ make proto-dart
mkdir -p apps/client/lib/gen
protoc \
--plugin=protoc-gen-dart=/config/.local/bin/protoc-gen-dart \
--dart_out=apps/client/lib/gen \
--proto_path=. \
--proto_path=/config/.local/include \
proto/iop/runtime.proto \
proto/iop/node.proto \
proto/iop/control.proto \
proto/iop/job.proto
$ go test -count=1 ./apps/control-plane/... ./packages/go/... ./proto/gen/...
ok iop/apps/control-plane/cmd/control-plane 0.139s
ok iop/apps/control-plane/internal/wire 1.470s
ok iop/packages/go/audit 0.002s
? iop/packages/go/auth [no test files]
ok iop/packages/go/config 0.015s
? iop/packages/go/events [no test files]
ok iop/packages/go/hostsetup 0.005s
? iop/packages/go/jobs [no test files]
? iop/packages/go/metadata [no test files]
ok iop/packages/go/observability 0.012s
? iop/packages/go/policy [no test files]
? iop/packages/go/version [no test files]
? iop/proto/gen/iop [no test files]
$ cd apps/client && flutter test test/iop_wire/generated_proto_import_test.dart test/iop_wire/parser_map_test.dart
00:00 +0: loading .../generated_proto_import_test.dart
00:00 +1: .../parser_map_test.dart: Parser map should contain ClientHelloRequest and ClientHelloResponse
00:00 +2: All tests passed!
$ rg --sort path -n "NodeStatus_NODE_STATUS_ONLINE|NodeStatus_NODE_STATUS_OFFLINE|NodeStatus_NODE_STATUS_DRAINING|static const NodeStatus NODE_STATUS_ONLINE|static const NodeStatus NODE_STATUS_OFFLINE|static const NodeStatus NODE_STATUS_DRAINING|GetAddress|GetToken|hasAddress|hasToken|set address|set token" proto/gen/iop/control.pb.go proto/gen/iop/node.pb.go apps/client/lib/gen/proto/iop/control.pb.dart apps/client/lib/gen/proto/iop/control.pbjson.dart apps/client/lib/gen/proto/iop/node.pb.dart apps/client/lib/gen/proto/iop/node.pbenum.dart apps/client/lib/gen/proto/iop/node.pbjson.dart
# 출력 없음 (exit code 1 = no match). active enum constant/accessor 없음. 기대 결과 충족.
```
---
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section: completion table, implementation checklist, changes from plan, design decisions, and verification output?**
> If anything is blank, go back and fill it in before saving this file.
> Leave review-agent-only sections unchanged.
Sections and their ownership:
| Section | Owner | Note |
|---------|-------|------|
| Header comment, 개요, 리뷰 에이전트 지시 | Fixed at stub creation | Implementing agent must not modify or execute these |
| Roadmap Targets | Fixed at stub creation from plan | Implementing agent must not modify; code-review copies it into `complete.log` as `Roadmap Completion` only on PASS |
| 구현 항목별 완료 여부 (item names) | Fixed at stub creation | `[ ]` -> `[x]` checks only |
| 구현 체크리스트 (item text/order) | Fixed at stub creation from plan | `[ ]` -> `[x]` checks only; final checkbox is mandatory before saving |
| 코드리뷰 전용 체크리스트 | Review agent only | Implementing agent must not modify or check this section |
| 계획 대비 변경 사항, 주요 설계 결정 | Implementing agent | Replace placeholder text with actual content |
| 사용자 리뷰 요청 | Implementing agent | Keep `상태: 없음` unless user input is required to proceed |
| 리뷰어를 위한 체크포인트 | Fixed at stub creation | Pre-filled from plan |
| 검증 결과 (section headings + commands) | Fixed at stub creation | Implementing agent fills in command output only |
| 코드리뷰 결과 | Review agent appends | Not included in stub |
## 코드리뷰 결과
- 종합 판정: PASS
- 차원별 평가:
- Correctness: Pass
- Completeness: Pass
- Test coverage: Pass
- API contract: Pass
- Code quality: Pass
- Plan deviation: Pass
- Verification trust: Pass
- 발견된 문제: 없음
- 다음 단계: PASS 종결. Active plan/review를 log로 아카이브하고, `complete.log` 작성 후 task 디렉터리를 archive로 이동한다. `m-architecture-refactor-foundation` completion metadata를 보고하며 roadmap 수정은 수행하지 않는다.

View file

@ -0,0 +1,46 @@
# Complete - m-architecture-refactor-foundation/09_proto_legacy_contract
## 완료 일시
2026-06-06
## 요약
Legacy scheduling/node registration proto tombstone 정리를 2회 리뷰 루프로 완료했다. 최종 판정: PASS.
## 루프 이력
| Plan | Review | Verdict | 메모 |
|------|--------|---------|------|
| `plan_cloud_G06_0.log` | `code_review_cloud_G06_0.log` | FAIL | `NodeStatus` retired value names가 reserved되지 않아 source-level tombstone이 불완전했다. |
| `plan_cloud_G06_1.log` | `code_review_cloud_G06_1.log` | PASS | Retired value names reservation과 descriptor guard가 보강되어 proto legacy tombstone 계약이 충족됐다. |
## 구현/정리 내용
- `ScheduleRequest`/`ScheduleResponse`, `NodeInfo`, `NodeRegisterRequest`, `NodeRegisterResponse`를 active field 없는 reserved tombstone으로 정리했다.
- `NodeStatus`는 unspecified zero value만 active로 남기고 retired value numbers와 names를 모두 reserved 처리했다.
- Go descriptor guard와 Dart generated import guard를 새 tombstone 계약에 맞게 보강했다.
- Go/Dart protobuf 생성물을 `make proto`/`make proto-dart` 산출물로 갱신했다.
## 최종 검증
- `make proto` - PASS; protoc Go generation 성공, 추가 codegen drift 없음.
- `make proto-dart` - PASS; protoc Dart generation 성공, 추가 codegen drift 없음.
- `go test -count=1 ./apps/control-plane/... ./packages/go/... ./proto/gen/...` - PASS; Control Plane wire, Go common packages, generated Go proto 검증 통과.
- `cd apps/client && flutter test test/iop_wire/generated_proto_import_test.dart test/iop_wire/parser_map_test.dart` - PASS; focused Flutter proto import/parser guard 통과.
- `rg --sort path -n "NodeStatus_NODE_STATUS_ONLINE|NodeStatus_NODE_STATUS_OFFLINE|NodeStatus_NODE_STATUS_DRAINING|static const NodeStatus NODE_STATUS_ONLINE|static const NodeStatus NODE_STATUS_OFFLINE|static const NodeStatus NODE_STATUS_DRAINING|GetAddress|GetToken|hasAddress|hasToken|set address|set token" proto/gen/iop/control.pb.go proto/gen/iop/node.pb.go apps/client/lib/gen/proto/iop/control.pb.dart apps/client/lib/gen/proto/iop/control.pbjson.dart apps/client/lib/gen/proto/iop/node.pb.dart apps/client/lib/gen/proto/iop/node.pbenum.dart apps/client/lib/gen/proto/iop/node.pbjson.dart` - PASS; 출력 없음(exit code 1), active retired enum constants/accessors 없음.
## Roadmap Completion
- Milestone: `agent-roadmap/phase/automation-runtime-bridge/milestones/architecture-refactor-foundation.md`
- Completed task ids:
- `proto-legacy`: PASS; evidence=`agent-task/archive/2026/06/m-architecture-refactor-foundation/09_proto_legacy_contract/plan_cloud_G06_0.log`, `agent-task/archive/2026/06/m-architecture-refactor-foundation/09_proto_legacy_contract/code_review_cloud_G06_0.log`, `agent-task/archive/2026/06/m-architecture-refactor-foundation/09_proto_legacy_contract/plan_cloud_G06_1.log`, `agent-task/archive/2026/06/m-architecture-refactor-foundation/09_proto_legacy_contract/code_review_cloud_G06_1.log`; verification=`make proto`, `make proto-dart`, `go test -count=1 ./apps/control-plane/... ./packages/go/... ./proto/gen/...`, `cd apps/client && flutter test test/iop_wire/generated_proto_import_test.dart test/iop_wire/parser_map_test.dart`, deterministic stale-symbol `rg`
- Not completed task ids: 없음
## 잔여 Nit
- 없음
## 후속 작업
- 없음

View file

@ -0,0 +1,112 @@
<!-- task=m-architecture-refactor-foundation/09_proto_legacy_contract plan=1 tag=REVIEW_API -->
# Plan - REVIEW_API
## 이 파일을 읽는 구현 에이전트에게
이 계획을 구현한 뒤에는 반드시 같은 디렉터리의 `CODE_REVIEW-*-G??.md`에서 구현 에이전트 소유 섹션을 실제 내용과 검증 출력으로 채운다. 검증 명령을 실행하고 실제 stdout/stderr를 붙이며, active 파일은 그대로 둔 채 리뷰 준비를 보고한다. 최종 판정, log archive, `complete.log` 작성, task archive 이동은 code-review-skill 전용이다.
구현 중 사용자만 결정할 수 있는 범위 변경, 사용자 소유 외부 환경/secret/서비스 준비, 또는 계획 충돌이 없이는 진행할 수 없으면 `CODE_REVIEW-*-G??.md`의 `사용자 리뷰 요청` 섹션에 근거와 재개 조건을 기록하고 중단한다. 구현 에이전트는 사용자에게 직접 질문하거나 선택지를 제시하거나 `request_user_input`을 호출하지 않는다. 후속 에이전트가 명령 재실행이나 증거 수집으로 해소할 수 있는 검증 공백은 사용자 리뷰 요청이 아니다.
## Roadmap Targets
- Milestone: `agent-roadmap/phase/automation-runtime-bridge/milestones/architecture-refactor-foundation.md`
- Task ids:
- `proto-legacy`: legacy scheduling/node registration proto placeholder를 deprecated/reserved/remove 중 하나로 정리하고 생성 코드와 call-site를 맞춘다.
- Completion mode: check-on-pass
## 배경
첫 리뷰(`code_review_cloud_G06_0.log`)에서 `NodeStatus` retired value names가 source-level `reserved`로 고정되지 않은 점이 Required로 판정됐다. 현재 구현은 value number `1 to 3`만 reserved하므로 `NODE_STATUS_ONLINE` 같은 retired 이름을 새 번호로 다시 추가할 수 있다. 이 follow-up은 proto source 자체가 legacy enum 이름 재활성화를 막도록 보강하고, 검증 검색은 reserved metadata와 active generated constants를 구분하도록 조정한다.
## 리뷰 지적 사항
- Required: `proto/iop/node.proto`의 `NodeStatus`에 `reserved "NODE_STATUS_ONLINE", "NODE_STATUS_OFFLINE", "NODE_STATUS_DRAINING";`가 없다.
## 범위 결정 근거
- `ScheduleRequest`/`ScheduleResponse`, `NodeInfo`, `NodeRegisterRequest`, `NodeRegisterResponse`의 message field tombstone은 이미 계획대로 적용되어 있어 수정 범위가 아니다.
- `runtime.proto`의 active `RegisterRequest`/`RegisterResponse`와 Control Plane-Edge active wire 계약은 변경하지 않는다.
- 기존 final `rg`가 bare retired enum names를 찾으면 reserved-name metadata까지 실패로 잡는다. 이번 follow-up에서는 active generated enum constants/accessors만 찾는 패턴으로 바꾼다.
## 빌드 등급
- `cloud-G06`: protobuf schema, Go/Dart generated binding, descriptor regression을 함께 갱신한다.
## 구현 체크리스트
- [ ] `proto/iop/node.proto`에서 retired `NodeStatus` value names를 source-level reserved name으로 추가하고 관련 주석을 갱신한다.
- [ ] `make proto`와 `make proto-dart`로 Go/Dart 생성물을 갱신하고, generated files를 사람이 직접 편집하지 않는다.
- [ ] `apps/control-plane/internal/wire/edge_test.go`의 descriptor guard가 `NodeStatus` active value, reserved range, reserved names를 함께 검증하도록 보강한다.
- [ ] deterministic stale-symbol 검색을 active generated constants/accessors만 탐지하도록 실행하고 결과를 기록한다.
- [ ] 최종 검증 명령을 실행하고 결과를 `CODE_REVIEW-*-G??.md`에 붙인다.
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
## 의존 관계 및 구현 순서
1. `proto/iop/node.proto`의 `NodeStatus` reserved names와 주석을 먼저 수정한다.
2. `make proto`, `make proto-dart`로 생성물을 갱신한다.
3. Go descriptor guard를 reserved names/range까지 확인하도록 보강한다.
4. 검증 명령과 deterministic search를 실행한다.
### [REVIEW_API-1] NodeStatus Reserved Name Tombstone
#### 문제
현재 `NodeStatus`는 retired value numbers만 reserved한다.
```proto
enum NodeStatus {
NODE_STATUS_UNSPECIFIED = 0;
reserved 1 to 3;
}
```
이 상태에서는 `NODE_STATUS_ONLINE = 4` 같은 source 변경이 proto compiler에서 막히지 않는다. legacy enum 이름 자체를 tombstone으로 고정하려면 retired value names도 reserved해야 한다.
#### 해결 방법
`NodeStatus`에 retired value name reservation을 추가한다.
```proto
enum NodeStatus {
NODE_STATUS_UNSPECIFIED = 0;
reserved 1 to 3;
reserved "NODE_STATUS_ONLINE", "NODE_STATUS_OFFLINE", "NODE_STATUS_DRAINING";
}
```
Go guard는 다음을 확인한다.
- active enum value는 `NODE_STATUS_UNSPECIFIED=0` 하나뿐이다.
- reserved range가 `1 to 3`을 포함한다.
- reserved names에 `NODE_STATUS_ONLINE`, `NODE_STATUS_OFFLINE`, `NODE_STATUS_DRAINING`이 모두 있다.
#### 수정 파일 및 체크리스트
- [ ] `proto/iop/node.proto`: retired enum value names를 reserved 처리한다.
- [ ] `proto/gen/iop/node.pb.go`: `make proto` 산출물로 갱신한다.
- [ ] `apps/client/lib/gen/proto/iop/node.pb.dart`: `make proto-dart` 산출물로 갱신한다.
- [ ] `apps/client/lib/gen/proto/iop/node.pbenum.dart`: `make proto-dart` 산출물로 갱신한다.
- [ ] `apps/client/lib/gen/proto/iop/node.pbjson.dart`: `make proto-dart` 산출물로 갱신한다.
- [ ] `apps/control-plane/internal/wire/edge_test.go`: reserved range/name descriptor guard를 추가한다.
#### 중간 검증
```bash
make proto
make proto-dart
go test -count=1 ./apps/control-plane/internal/wire ./proto/gen/...
```
## 최종 검증
```bash
make proto
make proto-dart
go test -count=1 ./apps/control-plane/... ./packages/go/... ./proto/gen/...
cd apps/client && flutter test test/iop_wire/generated_proto_import_test.dart test/iop_wire/parser_map_test.dart
rg --sort path -n "NodeStatus_NODE_STATUS_ONLINE|NodeStatus_NODE_STATUS_OFFLINE|NodeStatus_NODE_STATUS_DRAINING|static const NodeStatus NODE_STATUS_ONLINE|static const NodeStatus NODE_STATUS_OFFLINE|static const NodeStatus NODE_STATUS_DRAINING|GetAddress|GetToken|hasAddress|hasToken|set address|set token" proto/gen/iop/control.pb.go proto/gen/iop/node.pb.go apps/client/lib/gen/proto/iop/control.pb.dart apps/client/lib/gen/proto/iop/control.pbjson.dart apps/client/lib/gen/proto/iop/node.pb.dart apps/client/lib/gen/proto/iop/node.pbenum.dart apps/client/lib/gen/proto/iop/node.pbjson.dart
```
기대 결과: codegen 명령은 성공하고 추가 codegen drift가 없다. Go/Flutter focused tests는 통과한다. 마지막 `rg --sort path`는 출력이 없어야 한다. reserved-name metadata에 bare `NODE_STATUS_ONLINE` 문자열이 남는 것은 의도된 tombstone이므로 실패로 보지 않는다. 출력이 active generated enum constant/accessor이면 실패다.

View file

@ -15,9 +15,10 @@ import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
/// NodeStatus is an inactive legacy enum. Only the zero value remains; the
/// online/offline/draining value numbers are reserved tombstones. The retired
/// value names are intentionally not reserved as names so the generated
/// descriptor does not retain them as active-looking identifiers.
/// online/offline/draining value numbers AND names are reserved tombstones so
/// neither the numbers nor the retired identifiers can be reintroduced as an
/// active contract. The reserved names persist in the generated descriptor
/// metadata by design; that is the tombstone, not an active value.
class NodeStatus extends $pb.ProtobufEnum {
static const NodeStatus NODE_STATUS_UNSPECIFIED =
NodeStatus._(0, _omitEnumNames ? '' : 'NODE_STATUS_UNSPECIFIED');

View file

@ -24,11 +24,13 @@ const NodeStatus$json = {
'4': [
{'1': 1, '2': 3},
],
'5': ['NODE_STATUS_ONLINE', 'NODE_STATUS_OFFLINE', 'NODE_STATUS_DRAINING'],
};
/// Descriptor for `NodeStatus`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List nodeStatusDescriptor = $convert.base64Decode(
'CgpOb2RlU3RhdHVzEhsKF05PREVfU1RBVFVTX1VOU1BFQ0lGSUVEEAAiBAgBEAM=');
'CgpOb2RlU3RhdHVzEhsKF05PREVfU1RBVFVTX1VOU1BFQ0lGSUVEEAAiBAgBEAMqEk5PREVfU1'
'RBVFVTX09OTElORSoTTk9ERV9TVEFUVVNfT0ZGTElORSoUTk9ERV9TVEFUVVNfRFJBSU5JTkc=');
@$core.Deprecated('Use nodeInfoDescriptor instead')
const NodeInfo$json = {

View file

@ -293,13 +293,36 @@ func TestNodeRegistrationLegacyTombstone(t *testing.T) {
}
}
values := iop.NodeStatus(0).Descriptor().Values()
enumDesc := iop.NodeStatus(0).Descriptor()
// Only the unspecified zero value stays active.
values := enumDesc.Values()
if got := values.Len(); got != 1 {
t.Fatalf("NodeStatus must expose only the unspecified value, got %d values", got)
}
if v := values.Get(0); v.Number() != 0 || v.Name() != "NODE_STATUS_UNSPECIFIED" {
t.Errorf("NodeStatus sole value must be NODE_STATUS_UNSPECIFIED=0, got %s=%d", v.Name(), v.Number())
}
// Retired value numbers 1..3 stay reserved tombstones so they cannot be reused.
reservedRanges := enumDesc.ReservedRanges()
for _, n := range []protoreflect.EnumNumber{1, 2, 3} {
if !reservedRanges.Has(n) {
t.Errorf("NodeStatus value number %d must remain reserved", n)
}
}
// Retired value names stay reserved so they cannot be reintroduced at source level.
reservedNames := enumDesc.ReservedNames()
for _, name := range []protoreflect.Name{
"NODE_STATUS_ONLINE",
"NODE_STATUS_OFFLINE",
"NODE_STATUS_DRAINING",
} {
if !reservedNames.Has(name) {
t.Errorf("NodeStatus value name %q must remain reserved", name)
}
}
}
func TestWireTransportBoundary(t *testing.T) {

View file

@ -22,9 +22,10 @@ const (
)
// NodeStatus is an inactive legacy enum. Only the zero value remains; the
// online/offline/draining value numbers are reserved tombstones. The retired
// value names are intentionally not reserved as names so the generated
// descriptor does not retain them as active-looking identifiers.
// online/offline/draining value numbers AND names are reserved tombstones so
// neither the numbers nor the retired identifiers can be reintroduced as an
// active contract. The reserved names persist in the generated descriptor
// metadata by design; that is the tombstone, not an active value.
type NodeStatus int32
const (
@ -191,10 +192,10 @@ const file_proto_iop_node_proto_rawDesc = "" +
"\x14proto/iop/node.proto\x12\x03iop\"A\n" +
"\bNodeInfoJ\x04\b\x01\x10\aR\anode_idR\x04nameR\aaddressR\aversionR\x06statusR\x06labels\"!\n" +
"\x13NodeRegisterRequestJ\x04\b\x01\x10\x02R\x04info\"5\n" +
"\x14NodeRegisterResponseJ\x04\b\x01\x10\x04R\bacceptedR\x05tokenR\x06reason*/\n" +
"\x14NodeRegisterResponseJ\x04\b\x01\x10\x04R\bacceptedR\x05tokenR\x06reason*n\n" +
"\n" +
"NodeStatus\x12\x1b\n" +
"\x17NODE_STATUS_UNSPECIFIED\x10\x00\"\x04\b\x01\x10\x03B\x13Z\x11iop/proto/gen/iopb\x06proto3"
"\x17NODE_STATUS_UNSPECIFIED\x10\x00\"\x04\b\x01\x10\x03*\x12NODE_STATUS_ONLINE*\x13NODE_STATUS_OFFLINE*\x14NODE_STATUS_DRAININGB\x13Z\x11iop/proto/gen/iopb\x06proto3"
var (
file_proto_iop_node_proto_rawDescOnce sync.Once

View file

@ -14,12 +14,14 @@ message NodeInfo {
}
// NodeStatus is an inactive legacy enum. Only the zero value remains; the
// online/offline/draining value numbers are reserved tombstones. The retired
// value names are intentionally not reserved as names so the generated
// descriptor does not retain them as active-looking identifiers.
// online/offline/draining value numbers AND names are reserved tombstones so
// neither the numbers nor the retired identifiers can be reintroduced as an
// active contract. The reserved names persist in the generated descriptor
// metadata by design; that is the tombstone, not an active value.
enum NodeStatus {
NODE_STATUS_UNSPECIFIED = 0;
reserved 1 to 3;
reserved "NODE_STATUS_ONLINE", "NODE_STATUS_OFFLINE", "NODE_STATUS_DRAINING";
}
// NodeRegisterRequest is a reserved legacy tombstone and is not the active