# Complete - m-provider-resource-admission-ownership-alignment/06+05_refresh_consistency

## 완료 일시

2026-07-20

## 요약

Provider resource와 공통 queue policy의 live refresh 정합성을 2회 리뷰 루프로 검증했으며 최종 판정은 PASS다.

## 루프 이력

| Plan | Review | Verdict | 메모 |
|------|--------|---------|------|
| `plan_local_G07_0.log` | `code_review_local_G07_0.log` | FAIL | production deadline rebase와 zero-timeout timer state machine, 실제 lease/atomic refresh/race evidence가 부족했다. |
| `plan_local_G08_1.log` | `code_review_local_G08_1.log` | PASS | production refresh 경로와 실제 lease 기반 deterministic/race 검증으로 G07 Required 6건을 해소했다. |

## 구현/정리 내용

- provider-pool pending deadline을 원래 enqueue 시각과 현재 root queue policy로 rebase하고 legacy queue item은 격리했다.
- initial-zero, disable/re-enable, shorten/extend와 stale timer를 하나의 waiter 상태 loop로 처리했다.
- capacity/long capacity shrink-recovery, priority/enabled waiter 재평가와 bootstrap runtime snapshot apply를 실제 lease 기반 테스트로 고정했다.
- concurrent refresh/admission/release/cancel에서 lease identity, over-capacity 증가 금지, peak와 final pending/resource/lease zero를 검증했다.

## 최종 검증

- `gofmt -d <변경 Go 파일> && git diff --check` - PASS; 출력 없음.
- `go test -count=1 ./apps/edge/internal/service -run 'TestProviderPool(PolicyRefreshShortensExistingWaiterTimeout|PolicyRefreshExtendsExistingWaiterTimeout|PolicyRefreshDisablesExistingWaiterTimeout|PolicyRefreshReenablesExistingWaiterTimeout|PolicyRefreshExtensionIgnoresStaleTimer|MaxQueueShrinkPreservesExistingWaiters|PolicyRefreshDoesNotChangeLegacyWaiter)$'` - PASS; `ok iop/apps/edge/internal/service 1.521s`.
- `go test -count=1 ./apps/edge/internal/service -run 'TestRefresh(CapacityShrinkPreservesLeaseAndBlocksUntilRecovery|LongCapacityShrinkPreservesLeaseAndBlocksLongAdmission|PriorityChangesQueuedProviderSelection|DisableReenableReevaluatesAllWaiters)$'` - PASS; `ok iop/apps/edge/internal/service 0.016s`.
- `go test -count=1 ./apps/edge/internal/bootstrap -run 'TestRefreshRuntimeSnapshotPreservesLeaseAndAppliesPolicyAtomically$'` - PASS; `ok iop/apps/edge/internal/bootstrap 0.026s`.
- `go test -race -count=5 ./apps/edge/internal/service -run 'TestRefreshConcurrentAdmissionReleasePreservesProviderPolicyInvariants|TestProviderPoolPolicyRefresh'` - PASS; `ok iop/apps/edge/internal/service 9.798s`.
- `go test -count=1 ./apps/edge/...` - PASS; 모든 Edge 패키지 통과.
- `scripts/e2e-long-context-admission-smoke.sh --preflight --out-dir /tmp/iop-long-admission-smoke-cr-g08` - BLOCKED(rc=3); config check는 PASS했고 외부 `/models`와 local Control Plane status가 연결되지 않아 mixed scenario는 실행하지 않았다.

## Roadmap Completion

- Milestone: `agent-roadmap/phase/operational-observability-provider-management/milestones/provider-resource-admission-ownership-alignment.md`
- Milestone link: [Milestone 문서](agent-roadmap/phase/operational-observability-provider-management/milestones/provider-resource-admission-ownership-alignment.md)
- Completed task ids:
  - `refresh-consistency`: PASS; evidence=`agent-task/archive/2026/07/m-provider-resource-admission-ownership-alignment/06+05_refresh_consistency/plan_local_G08_1.log`, `agent-task/archive/2026/07/m-provider-resource-admission-ownership-alignment/06+05_refresh_consistency/code_review_local_G08_1.log`; verification=focused service/bootstrap tests, `-race -count=5`, fresh `go test -count=1 ./apps/edge/...`.
- Not completed task ids: 없음

## 잔여 Nit

- `apps/edge/internal/service/service.go`의 test-only `Service.NodeStore()` accessor는 bootstrap `Runtime.NodeStore`로 대체한 뒤 제거할 수 있다.

## 후속 작업

- 외부 provider와 local Control Plane이 가용해지면 별도 roadmap Task `capacity-smoke`에서 live mixed capacity smoke를 수행한다.
