feat: dart inbound gateway implementation and inbound queue ordering milestone progress
- Add inbound_gateway.dart, inbound_gateway_io.dart, inbound_gateway_web.dart - Update communicator.dart and proto_socket.dart for inbound queue support - Update browser_ws_import_compile.dart and communicator_test.dart - Archive Dart gateway task (04_dart_gateway) - Create plan and code review docs for go/kotlin/python/typescript gateways - Update roadmap files (ROADMAP.md, current.md, inbound-queue-ordering.md)
This commit is contained in:
parent
be9d1936c5
commit
bdcebdeb56
23 changed files with 1744 additions and 14 deletions
|
|
@ -28,7 +28,7 @@ Proto Socket은 여러 언어와 플랫폼에서 일관되게 동작하는 얇
|
|||
### 안정화와 유지
|
||||
|
||||
- [안정화 기준선](milestones/stability-baseline.md) - 상태: 완료; 목표: 현재 5개 언어 구현을 완성형 후보로 보고 안정성 판단과 유지 기준을 정리한다.
|
||||
- [수신 큐와 처리 순서 보장](milestones/inbound-queue-ordering.md) - 상태: [계획]; 목표: 현재 5개 언어 구현에 per-connection 수신 큐와 언어별 worker gateway 후보를 도입해 수신 처리 순서, 자동 응답 출력 순서, thread-safe한 공유 상태 접근, 대량 처리 성능 개선 가능성을 보장한다.
|
||||
- [수신 큐와 처리 순서 보장](milestones/inbound-queue-ordering.md) - 상태: [진행중]; 목표: 현재 5개 언어 구현에 per-connection 수신 큐와 언어별 worker gateway 후보를 도입해 수신 처리 순서, 자동 응답 출력 순서, thread-safe한 공유 상태 접근, 대량 처리 성능 개선 가능성을 보장한다.
|
||||
|
||||
### 남은 native platform 포팅
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
## 활성 Milestone
|
||||
|
||||
- [계획] 수신 큐와 처리 순서 보장
|
||||
- [진행중] 수신 큐와 처리 순서 보장
|
||||
- 단계: 안정화와 유지
|
||||
- 경로: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
## 상태
|
||||
|
||||
[계획]
|
||||
[진행중]
|
||||
|
||||
## 구현 잠금
|
||||
|
||||
|
|
@ -32,19 +32,19 @@
|
|||
|
||||
수신 큐가 제공해야 하는 ordering, backpressure, close semantics를 모든 언어 구현의 공통 기준으로 정리한다.
|
||||
|
||||
- [ ] [recv-contract] per-connection inbound queue 계약을 문서화한다. 검증: 수신 순서, 자동 응답 순서, 큐 capacity, close/drain/cancel 정책이 README 또는 PROTOCOL/PORTING_GUIDE 중 적절한 문서에 명시되어 있다.
|
||||
- [ ] [thread-model] handlers, request handlers, pending response map 접근의 thread-safety 기준을 언어별 구현 메모에 반영한다. 검증: 각 언어 구현에서 수신 worker와 공유 상태 보호 방식이 코드 또는 테스트로 확인된다.
|
||||
- [ ] [gateway-contract] worker gateway 계약을 문서화한다. 검증: gateway는 순수 raw bytes/decode/전처리만 담당하고, coordinator가 `seq` 순서 복원과 stateful dispatch를 단독 소유한다는 기준이 문서와 테스트에 반영되어 있다.
|
||||
- [x] [recv-contract] per-connection inbound queue 계약을 문서화한다. 검증: 수신 순서, 자동 응답 순서, 큐 capacity, close/drain/cancel 정책이 README 또는 PROTOCOL/PORTING_GUIDE 중 적절한 문서에 명시되어 있다.
|
||||
- [x] [thread-model] handlers, request handlers, pending response map 접근의 thread-safety 기준을 언어별 구현 메모에 반영한다. 검증: 각 언어 구현에서 수신 worker와 공유 상태 보호 방식이 코드 또는 테스트로 확인된다.
|
||||
- [x] [gateway-contract] worker gateway 계약을 문서화한다. 검증: gateway는 순수 raw bytes/decode/전처리만 담당하고, coordinator가 `seq` 순서 복원과 stateful dispatch를 단독 소유한다는 기준이 문서와 테스트에 반영되어 있다.
|
||||
|
||||
### Epic: [impl] 언어별 수신 큐 구현
|
||||
|
||||
각 언어에서 read loop와 message dispatch 사이에 bounded FIFO 큐와 단일 consumer를 둔다.
|
||||
|
||||
- [ ] [dart] Dart 구현에 inbound queue와 receive worker를 추가하고 request handler를 순차 처리한다. 검증: Dart 테스트에서 수신 순서, 자동 응답 순서, close 시 큐/pending 정리가 통과한다.
|
||||
- [ ] [go] Go 구현에 inbound queue channel과 receive worker를 추가하고 request handler goroutine 분기를 제거하거나 순서 보장 경계 뒤로 옮긴다. 검증: Go 테스트에서 수신 순서, 자동 응답 순서, close 시 큐/pending 정리가 통과한다.
|
||||
- [ ] [kotlin] Kotlin 구현에 inbound `Channel`과 receive coroutine을 추가하고 request handler launch 정책을 FIFO 처리로 맞춘다. 검증: Kotlin 테스트에서 수신 순서, 자동 응답 순서, close 시 큐/pending 정리가 통과한다.
|
||||
- [ ] [python] Python 구현에 `asyncio.Queue` 기반 inbound queue와 receive task를 추가하고 request handler task 분기를 순서 보장 모델로 바꾼다. 검증: Python 테스트에서 수신 순서, 자동 응답 순서, close 시 큐/pending 정리가 통과한다.
|
||||
- [ ] [typescript] TypeScript 구현에 inbound queue와 async receive worker를 추가하고 request handler 실행을 FIFO로 직렬화한다. 검증: TypeScript 테스트에서 수신 순서, 자동 응답 순서, close 시 큐/pending 정리가 통과한다.
|
||||
- [x] [dart] Dart 구현에 inbound queue와 receive worker를 추가하고 request handler를 순차 처리한다. 검증: Dart 테스트에서 수신 순서, 자동 응답 순서, close 시 큐/pending 정리가 통과한다.
|
||||
- [x] [go] Go 구현에 inbound queue channel과 receive worker를 추가하고 request handler goroutine 분기를 제거하거나 순서 보장 경계 뒤로 옮긴다. 검증: Go 테스트에서 수신 순서, 자동 응답 순서, close 시 큐/pending 정리가 통과한다.
|
||||
- [x] [kotlin] Kotlin 구현에 inbound `Channel`과 receive coroutine을 추가하고 request handler launch 정책을 FIFO 처리로 맞춘다. 검증: Kotlin 테스트에서 수신 순서, 자동 응답 순서, close 시 큐/pending 정리가 통과한다.
|
||||
- [x] [python] Python 구현에 `asyncio.Queue` 기반 inbound queue와 receive task를 추가하고 request handler task 분기를 순서 보장 모델로 바꾼다. 검증: Python 테스트에서 수신 순서, 자동 응답 순서, close 시 큐/pending 정리가 통과한다.
|
||||
- [x] [typescript] TypeScript 구현에 inbound queue와 async receive worker를 추가하고 request handler 실행을 FIFO로 직렬화한다. 검증: TypeScript 테스트에서 수신 순서, 자동 응답 순서, close 시 큐/pending 정리가 통과한다.
|
||||
|
||||
### Epic: [gateway] 언어별 worker gateway
|
||||
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
|
||||
- 상태: 없음
|
||||
- 요청일: 없음
|
||||
- 완료 근거: 아직 구현 전 계획 상태다.
|
||||
- 완료 근거: contract Epic과 impl Epic은 완료되었으나 gateway/verify Epic은 아직 완료 전이다.
|
||||
- 리뷰 필요:
|
||||
- [ ] 사용자가 완료 결과를 확인했다
|
||||
- [ ] archive 이동을 승인했다
|
||||
|
|
@ -90,5 +90,14 @@
|
|||
- Dart isolate 후보: `../dart-app-core/lib/platform/isolate_manager.dart`의 장기 실행 isolate + `SendPort`/`ReceivePort` 이벤트 패턴은 참고하되, `dart:io`/앱 전역 system 초기화/범용 broadcast 구조는 복사하지 않는다. proto-socket에는 IO 전용 상시 worker gateway와 web fallback/stub을 둔다. gateway는 isolate spawn 비용을 반복하지 않고 `seq`가 붙은 raw bytes를 받아 병렬화 가능한 순수 작업을 처리한다. user listener/request handler, `pendingRequests`, transport/write queue는 isolate로 옮기지 않고 main isolate의 receive worker에서 순서와 상태 일관성을 유지한다.
|
||||
- 언어별 gateway 후보: Go는 goroutine worker pool, Kotlin은 coroutine worker pool/dispatcher, Python은 process worker 또는 asyncio fallback, TypeScript는 Node `worker_threads`/browser Web Worker를 후보로 둔다. 모든 gateway 결과는 `seq`로 reorder된 뒤 coordinator가 dispatch하며, gateway는 수신 큐와 thread-safe 상태 소유 모델을 대체하지 않는다.
|
||||
- 선행 작업: 안정화 기준선에서 확인된 현재 5개 언어 구현
|
||||
- 후속 작업: 수신 큐 구현 완료 후 안정화 기준선 재평가
|
||||
- 후속 작업: 다음 작업 지점은 `[dart-gateway]` Dart IO worker gateway 후보 구현 계획이다.
|
||||
- 완료 근거:
|
||||
- [recv-contract] `agent-task/archive/2026/06/m-inbound-queue-ordering/01_contract_docs/complete.log` PASS. 검증: `agent-test/runs/20260601-105247-proto-socket-full-matrix.md`.
|
||||
- [thread-model] `agent-task/archive/2026/06/m-inbound-queue-ordering/02+01_receive_thread_model/complete.log` PASS. 검증: `agent-test/runs/20260601-201443-proto-socket-full-matrix.md`.
|
||||
- [gateway-contract] `agent-task/archive/2026/06/m-inbound-queue-ordering/03+02_gateway_contract/complete.log` PASS. 검증: `agent-test/runs/20260601-213027-proto-socket-full-matrix.md`, Dart/Kotlin/TypeScript communicator reorder anchor 테스트 통과.
|
||||
- [dart] `dart/lib/src/communicator.dart`의 inbound queue/receive worker와 `dart/test/communicator_test.dart` PASS. 검증: `dart test test/communicator_test.dart` 16/16 PASS.
|
||||
- [go] `go/communicator.go`의 inbound queue channel/receive loop와 `go/test/communicator_test.go` PASS. 검증: `go test -count=1 ./...` PASS.
|
||||
- [kotlin] `kotlin/src/main/kotlin/com/tokilabs/proto_socket/Communicator.kt`의 inbound `Channel`/receive coroutine과 `CommunicatorTest.kt` PASS. 검증: `./gradlew test --tests com.tokilabs.proto_socket.CommunicatorTest --rerun-tasks` PASS.
|
||||
- [python] `python/proto_socket/communicator.py`의 `asyncio.Queue`/receive task와 `python/test/test_communicator.py` PASS. 검증: `python3 -m pytest -q test/test_communicator.py` 13 passed.
|
||||
- [typescript] `typescript/src/communicator.ts`의 inbound queue/async worker와 `typescript/test/communicator.test.ts` PASS. 검증: `npm test -- communicator` 16/16 PASS.
|
||||
- 확인 필요: 없음
|
||||
|
|
|
|||
|
|
@ -0,0 +1,115 @@
|
|||
<!-- task=m-inbound-queue-ordering/04_dart_gateway plan=0 tag=API -->
|
||||
|
||||
# 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.
|
||||
> Finalization (`코드리뷰 결과`, log rename, `complete.log`, archive moves, `코드리뷰 전용 체크리스트`) is review-agent-only.
|
||||
|
||||
## 개요
|
||||
|
||||
date=2026-06-02
|
||||
task=m-inbound-queue-ordering/04_dart_gateway, plan=0, tag=API
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- Task ids:
|
||||
- `dart-gateway`: Dart IO 구현에서 상시 isolate gateway를 두고 순수 bytes 작업을 분리한다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 이 파일을 읽는 리뷰 에이전트에게
|
||||
|
||||
각 항목의 구현을 실제 소스 파일과 대조하고, `검증 결과` 섹션의 출력이 코드와 일치하는지 확인하세요.
|
||||
|
||||
## 구현 항목별 완료 여부
|
||||
|
||||
| 항목 | 완료 여부 |
|
||||
|------|---------|
|
||||
| [API-1] Dart IO worker gateway | [x] |
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [x] Dart IO 전용 worker gateway 타입을 추가하고, gateway input/output에 내부 `seq`를 포함한다.
|
||||
- [x] gateway는 `PacketBase` envelope decode 또는 순수 bytes 전처리만 수행하고, 결과를 `seq`로 reorder한 뒤 기존 `Communicator.onReceivedData`/coordinator path로 전달한다.
|
||||
- [x] Dart web 조건부 export/stub 또는 fallback이 깨지지 않도록 IO 전용 import 경계를 유지한다.
|
||||
- [x] Dart 테스트에 gateway on reorder/response order/fallback compile anchor를 추가한다.
|
||||
- [x] 중간 검증으로 `cd dart && dart test test/communicator_test.dart && dart compile js test/browser_ws_import_compile.dart -o /tmp/proto_socket_browser_ws_import_compile.js`를 실행하고 실제 stdout/stderr를 기록한다.
|
||||
- [ ] 최종 검증으로 `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 실행하고 결과 기록 파일을 남긴다.
|
||||
- [x] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
## 코드리뷰 전용 체크리스트
|
||||
|
||||
- [x] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
|
||||
- [x] 판정과 `차원별 평가`, Required/Suggested/Nit 분류가 서로 일치한다.
|
||||
- [x] active `CODE_REVIEW-*-G??.md`를 `code_review_{review_lane}_GNN_N.log`로 아카이브한다.
|
||||
- [x] active `PLAN-*-G??.md`를 `plan_{build_lane}_GNN_M.log`로 아카이브한다.
|
||||
- [x] `.gitignore`의 Agent-Ops 관리 block이 `agent-task/**/*.md`와 `agent-task/**/*.log`를 unignore하여 plan/review/archive 산출물이 추적 가능한지 확인한다.
|
||||
- [ ] PASS이면 `complete.log`를 작성하고 active `.md` 파일을 남기지 않는다.
|
||||
- [ ] PASS이면 active task 디렉터리를 archive로 이동한다.
|
||||
- [ ] PASS이고 task group이 `m-<milestone-slug>`이면 완료 이벤트 메타데이터를 보고하고 roadmap 수정이나 `update-roadmap` 직접 호출을 하지 않는다.
|
||||
- [x] WARN/FAIL이고 user-review gate가 트리거되지 않았으면 다음 active `PLAN-{build_lane}-GNN.md`와 `CODE_REVIEW-{review_lane}-GNN.md`를 작성하고 `complete.log`를 작성하지 않는다.
|
||||
|
||||
## 계획 대비 변경 사항
|
||||
|
||||
- gateway는 **opt-in**으로 추가했고, 라이브 소켓 클라이언트(`protobuf_client.dart`, `ws_protobuf_client_io.dart`)의 기본 수신 경로는 그대로 inline decode → `onReceivedData`를 유지했다. 이유: 계획의 `수정 파일 요약`이 `communicator.dart`/`communicator_test.dart`/IO gateway 파일만 명시하고, milestone 컨텍스트가 gateway를 "후보"이자 "작은 packet에서는 gateway 우회 fallback"으로 규정한다. 모든 frame을 무조건 isolate로 보내면 spawn/transfer 비용과 크로스 언어 매트릭스 리스크가 생겨 scope/안전성 기준에서 기본 경로를 바꾸지 않았다. 통합 지점은 `Communicator.attachInboundGateway` + `onReceivedFrame`으로 제공한다.
|
||||
- IO 전용 gateway 파일을 1개가 아니라 3개(중립 인터페이스 `inbound_gateway.dart`, IO isolate `inbound_gateway_io.dart`, web stub `inbound_gateway_web.dart`)로 나눴다. 이유: `communicator.dart`는 web에서도 unconditional export되므로 `dart:io`/`dart:isolate`를 import할 수 없다. gateway 타입을 중립 인터페이스로 분리해야 communicator가 IO 의존성 없이 참조할 수 있고, 조건부 export로 web 빌드가 깨지지 않는다.
|
||||
|
||||
## 주요 설계 결정
|
||||
|
||||
- **세 파일 경계**: `inbound_gateway.dart`는 `InboundFrame`/`DecodedFrame`/`InboundGateway` 인터페이스 + 순수 `FrameReorderBuffer` + web-safe `SyncInboundGateway`(protobuf만 의존). `inbound_gateway_io.dart`는 `dart:isolate` 기반 상시 isolate `IsolateInboundGateway`. `inbound_gateway_web.dart`는 동일 이름 `IsolateInboundGateway`가 `SyncInboundGateway`를 상속하는 stub. `proto_socket.dart`에서 `export 'inbound_gateway_io.dart' if (dart.library.html) 'inbound_gateway_web.dart'`로 분기.
|
||||
- **seq reorder 위치**: gateway 컴포넌트 내부 `FrameReorderBuffer`가 seq(1부터 contiguous) 기준으로 입력 순서를 복원해 `results` 스트림에 emit한다. coordinator(`Communicator`)는 reorder된 결과를 받아 기존 `onReceivedData` FIFO 체인으로만 dispatch하므로 stateful dispatch 단독 소유가 유지된다.
|
||||
- **상시 isolate**: `IsolateInboundGateway.start()`가 isolate를 1회 spawn하고 `SendPort`/`ReceivePort`로 frame마다 `[seq, bytes]`만 주고받는다(frame당 spawn 없음). isolate entry는 `PacketBase.fromBuffer` 순수 decode만 수행하고 `[seq, typeName, data, nonce, responseNonce]`를 돌려준다. `../dart-app-core`의 장기 isolate + Port 이벤트 패턴만 참고하고 `dart:io`/앱 전역 system 초기화/broadcast는 복사하지 않았다.
|
||||
- **상태 비소유**: gateway는 listener/request handler/`_pendingRequests`/transport/write queue를 일절 보유하지 않는다. `responseNonce>0` 매칭도 gateway가 아니라 `onReceivedData`가 main isolate에서 처리한다.
|
||||
- **정리**: `Communicator.close()`/`shutdown()`에 `_closeInboundGateway()`를 추가해 subscription cancel + isolate kill + stream close를 수행한다.
|
||||
|
||||
## 사용자 리뷰 요청
|
||||
|
||||
- 상태: 없음
|
||||
- 사유 유형: 없음
|
||||
- 결정 필요: 없음
|
||||
- 차단 근거: 없음
|
||||
- 실행한 검증/명령: 없음
|
||||
- 자동 후속 불가 이유: 없음
|
||||
- 재개 조건: 없음
|
||||
|
||||
## 리뷰어를 위한 체크포인트
|
||||
|
||||
- isolate gateway가 stateful dispatch/pending/write queue를 소유하지 않는지 확인한다.
|
||||
- Dart web compile이 IO isolate import 때문에 깨지지 않는지 확인한다.
|
||||
|
||||
## 검증 결과
|
||||
|
||||
### API-1 중간 검증
|
||||
```
|
||||
$ cd dart && dart test test/communicator_test.dart && dart compile js test/browser_ws_import_compile.dart -o /tmp/proto_socket_browser_ws_import_compile.js
|
||||
00:00 +19: Communicator protocol guards IsolateInboundGateway: 상시 isolate 디코드 후 수신/응답 순서가 유지된다
|
||||
00:00 +20: All tests passed!
|
||||
Compiled 10,867,984 input bytes (5,869,212 characters source) to 11,692 characters JavaScript in 0.48 seconds
|
||||
```
|
||||
결과: communicator tests 20/20 PASS (기존 16 + gateway 4 신규: FrameReorderBuffer reorder, SyncInboundGateway dispatch, SyncInboundGateway responseNonce 완료, IsolateInboundGateway 상시 isolate 순서 유지). browser import compile PASS (조건부 export가 web stub으로 해소되어 `dart:io`/`dart:isolate` 없이 11,692자 JS 생성).
|
||||
|
||||
`dart analyze lib test/communicator_test.dart test/browser_ws_import_compile.dart`: 신규 코드 0 issue (기존 `heartbeat_mixin.dart:13` annotate_overrides info만 잔존).
|
||||
|
||||
### 최종 검증
|
||||
```
|
||||
$ bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all
|
||||
(실행 중 — 결과는 매트릭스 완료 후 기록)
|
||||
```
|
||||
|
||||
## 코드리뷰 결과
|
||||
|
||||
- 종합 판정: FAIL
|
||||
- 차원별 평가:
|
||||
- Correctness: Pass
|
||||
- Completeness: Fail
|
||||
- Test coverage: Pass
|
||||
- API contract: Pass
|
||||
- Code quality: Pass
|
||||
- Plan deviation: Pass
|
||||
- Verification trust: Fail
|
||||
- 발견된 문제:
|
||||
- Required: `agent-task/m-inbound-queue-ordering/04_dart_gateway/CODE_REVIEW-cloud-G08.md:40`의 최종 검증 체크리스트가 미완료이고, `agent-task/m-inbound-queue-ordering/04_dart_gateway/CODE_REVIEW-cloud-G08.md:95`의 최종 검증 결과도 `(실행 중 — 결과는 매트릭스 완료 후 기록)` placeholder 상태다. 계획에 통합된 검증 항목이므로 `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 끝까지 실행하고 실제 stdout/stderr 및 결과 기록 파일 경로를 남긴 뒤 체크리스트를 완료해야 한다.
|
||||
- 다음 단계: WARN/FAIL 후속 plan/review를 작성한다.
|
||||
|
|
@ -0,0 +1,189 @@
|
|||
<!-- task=m-inbound-queue-ordering/04_dart_gateway 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.
|
||||
> 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-02
|
||||
task=m-inbound-queue-ordering/04_dart_gateway, plan=1, tag=REVIEW_API
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- Task ids:
|
||||
- `dart-gateway`: Dart IO 구현에서 상시 isolate gateway를 두고 순수 bytes 작업을 분리한다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 이 파일을 읽는 리뷰 에이전트에게
|
||||
|
||||
> **[REVIEW AGENT ONLY]** 아래 종결 절차는 코드리뷰 에이전트 전용이다. 구현 에이전트는 이 섹션을 실행하지 않는다.
|
||||
|
||||
각 항목의 구현을 실제 소스 파일과 대조하고, `검증 결과` 섹션의 출력이 코드와 일치하는지 확인하세요.
|
||||
리뷰 완료는 아래 순서까지 끝난 상태를 의미합니다.
|
||||
|
||||
1. 판정을 append한다.
|
||||
2. `CODE_REVIEW-{review_lane}-GNN.md` -> `code_review_{review_lane}_GNN_N.log`, `PLAN-{build_lane}-GNN.md` -> `plan_{build_lane}_GNN_M.log`로 아카이브한다.
|
||||
3. PASS이면 `complete.log` 작성 후 active task 디렉터리를 `agent-task/archive/YYYY/MM/{task_name}/`로 이동한다. WARN/FAIL이면 user-review gate를 확인한 뒤 다음 active plan/review 파일 또는 `USER_REVIEW.md`를 작성한다. `USER_REVIEW.md`가 사용자 결정으로 완료/PASS 해소되면 `USER_REVIEW.md`를 해소 상태로 갱신하고 `complete.log` 작성 후 archive 이동한다.
|
||||
4. PASS이고 task group이 `m-<milestone-slug>`이면 완료 이벤트 메타데이터를 보고한다. roadmap 상태 체크와 `update-roadmap` 호출은 런타임 책임이다.
|
||||
5. 적용 가능한 `코드리뷰 전용 체크리스트` 항목을 최종 `.log` 위치에서 체크한 뒤 보고한다.
|
||||
|
||||
---
|
||||
|
||||
## 구현 항목별 완료 여부
|
||||
|
||||
| 항목 | 완료 여부 |
|
||||
|------|---------|
|
||||
| [REVIEW_API-1] 최종 매트릭스 검증 회수 | [x] |
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [x] `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 repo root에서 끝까지 실행하고 exit code, 실제 stdout/stderr, 결과 기록 파일 경로를 `CODE_REVIEW-cloud-G08.md`에 기록한다.
|
||||
- [x] 매트릭스 실패가 Dart gateway 구현에서 비롯되면 최소 범위로 수정하고 관련 Dart 중간 검증과 전체 매트릭스를 다시 실행해 실제 stdout/stderr를 기록한다.
|
||||
- [x] 외부 환경 또는 사용자 소유 전제 때문에 매트릭스를 완료할 수 없으면 `사용자 리뷰 요청`에 정확한 차단 근거, 실행한 명령 출력, 자동 후속 불가 이유, 재개 조건을 기록한다.
|
||||
- [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_{review_lane}_GNN_N.log`로 아카이브한다.
|
||||
- [x] active `PLAN-*-G??.md`를 `plan_{build_lane}_GNN_M.log`로 아카이브한다.
|
||||
- [x] `.gitignore`의 Agent-Ops 관리 block이 `agent-task/**/*.md`와 `agent-task/**/*.log`를 unignore하여 plan/review/archive 산출물이 추적 가능한지 확인한다.
|
||||
- [x] PASS이면 `agent-ops/skills/common/code-review/templates/complete-log-template.md` 기준으로 `complete.log`를 작성하고 active `.md` 파일을 남기지 않는다.
|
||||
- [x] PASS이면 active task 디렉터리 `agent-task/{task_name}/`를 `agent-task/archive/YYYY/MM/{task_name}/`로 이동하고 최종 archive 경로에서 이 체크리스트를 갱신한다.
|
||||
- [x] PASS이고 task group이 `m-<milestone-slug>`이면 런타임이 읽을 완료 이벤트 메타데이터를 보고하고, roadmap 수정이나 `update-roadmap` 직접 호출을 하지 않는다.
|
||||
- [x] PASS split 작업이면 이동 후 빈 active parent `agent-task/{task_group}/`를 제거하거나, 남은 sibling/file이 있어 유지했다고 확인한다.
|
||||
- [ ] WARN/FAIL이고 user-review gate가 트리거되지 않았으면 다음 active `PLAN-{build_lane}-GNN.md`와 `CODE_REVIEW-{review_lane}-GNN.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로 이동한다.
|
||||
|
||||
## 계획 대비 변경 사항
|
||||
|
||||
- 코드 변경 없음. 이 반복(plan=1, REVIEW_API)은 검증 회수 전용이며, iteration 0에서 구현한 Dart gateway 코드(`inbound_gateway.dart`, `inbound_gateway_io.dart`, `inbound_gateway_web.dart`, `communicator.dart`, `proto_socket.dart`, `communicator_test.dart`, `browser_ws_import_compile.dart`)를 그대로 둔 채 최종 매트릭스를 끝까지 실행하고 결과를 기록했다.
|
||||
- 체크리스트 2번(매트릭스 실패 시 Dart 코드 수정): **해당 없음**. 매트릭스가 `exit 0` / `overall_result: PASS`로 완료되어 수정할 실패가 없었다.
|
||||
- 체크리스트 3번(외부 환경/사용자 전제로 매트릭스 미완료 시 사용자 리뷰 요청): **해당 없음**. 매트릭스를 끝까지 자동 실행해 완료했고 사용자 소유 blocker가 없었다. 따라서 `사용자 리뷰 요청`은 `상태: 없음`을 유지한다.
|
||||
|
||||
## 주요 설계 결정
|
||||
|
||||
- **증거 유효성**: 매트릭스 결과 기록(`agent-test/runs/20260602-012917-proto-socket-full-matrix.md`, 생성 10:34)이 모든 gateway 소스 최종 수정(10:26–10:28)보다 뒤이므로, PASS는 현재 working tree를 그대로 검증한 결과다. iteration 0 리뷰의 FAIL은 코드 결함이 아니라 리뷰가 매트릭스 완료 전에 실행되어 `검증 결과`가 placeholder였던 타이밍 artifact였고, 이번 반복에서 실제 출력으로 해소했다.
|
||||
- **설계 자체는 iteration 0과 동일**: gateway는 `seq` reorder만 담당하고 stateful dispatch/pending/write queue는 main isolate coordinator(`Communicator`)가 단독 소유. 상시 isolate 1회 spawn, 조건부 export로 web 빌드에 `dart:io`/`dart:isolate` 미포함. 상세는 `code_review_cloud_G08_0.log`의 `주요 설계 결정` 참조.
|
||||
|
||||
## 사용자 리뷰 요청
|
||||
|
||||
_기본값은 `없음`이다. 구현 중 사용자 결정, 사용자 소유 외부 환경/secret/서비스 준비, 또는 계획 범위 변경 없이는 안전하게 진행할 수 없으면 아래 항목을 실제 내용으로 교체하고, 구현을 중단한 뒤 active 파일을 그대로 둔 채 리뷰를 요청한다. 후속 에이전트가 명령 재실행이나 산출물 수집으로 해소할 수 있는 검증 증거 공백만으로는 사용자 리뷰 요청을 작성하지 않는다._
|
||||
|
||||
- 상태: 없음
|
||||
- 사유 유형: 없음
|
||||
- 결정 필요: 없음
|
||||
- 차단 근거: 없음
|
||||
- 실행한 검증/명령: 없음
|
||||
- 자동 후속 불가 이유: 없음
|
||||
- 재개 조건: 없음
|
||||
|
||||
## 리뷰어를 위한 체크포인트
|
||||
|
||||
- `run_matrix.sh --all`의 실제 stdout/stderr와 결과 기록 파일 경로가 기록되었는지 확인한다.
|
||||
- 매트릭스 실패가 있었다면 Dart gateway 코드 수정, 환경 차단, 또는 검증 기록 실패 중 하나로 근거가 분리되었는지 확인한다.
|
||||
|
||||
## 검증 결과
|
||||
|
||||
_구현 에이전트가 각 중간 검증 및 최종 검증 명령 실행 후 출력을 여기에 붙여 넣는다._
|
||||
|
||||
필수 규칙:
|
||||
- 검증 명령은 고정된 계약이다. 임의로 대체하지 않는다.
|
||||
- 대체가 필요하면 `계획 대비 변경 사항`에 이유와 대체 명령을 기록한다.
|
||||
- `검증 결과`에는 실제 stdout/stderr를 붙여 넣는다.
|
||||
- 사용자 리뷰 요청으로 명령을 끝까지 실행하지 못했다면 `사용자 리뷰 요청`에 실행한 명령, 실제 출력, 미실행 명령의 사유를 기록한다.
|
||||
|
||||
### REVIEW_API-1 중간 검증
|
||||
```
|
||||
$ cd dart && dart test test/communicator_test.dart && dart compile js test/browser_ws_import_compile.dart -o /tmp/proto_socket_browser_ws_import_compile.js
|
||||
00:00 +17: Communicator protocol guards SyncInboundGateway: onReceivedFrame이 디코드 후 입력 순서로 dispatch한다
|
||||
00:00 +18: Communicator protocol guards SyncInboundGateway: responseNonce 프레임이 pending sendRequest를 완료한다
|
||||
00:00 +19: Communicator protocol guards IsolateInboundGateway: 상시 isolate 디코드 후 수신/응답 순서가 유지된다
|
||||
00:00 +20: All tests passed!
|
||||
Compiled 10,867,984 input bytes (5,869,212 characters source) to 11,692 characters JavaScript in 0.44 seconds
|
||||
EXIT=0
|
||||
```
|
||||
결과: communicator tests 20/20 PASS, browser import compile PASS (조건부 export가 web stub으로 해소되어 `dart:io`/`dart:isolate` 없이 11,692자 JS 생성).
|
||||
|
||||
### 최종 검증
|
||||
```
|
||||
$ bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all
|
||||
... (전체 출력은 결과 기록 파일에 보존)
|
||||
|
||||
**Proto 동기화**
|
||||
| 검사 | 명령 | 결과 |
|
||||
|---|---|---|
|
||||
| schema sync | `tools/check_proto_sync.sh` | PASS |
|
||||
|
||||
**동일언어**
|
||||
| 언어 | 결과 |
|
||||
|---|---|
|
||||
| Dart | PASS |
|
||||
| Go | PASS |
|
||||
| Kotlin | PASS |
|
||||
| Python | PASS |
|
||||
| TypeScript | PASS |
|
||||
|
||||
**언어 PASS 매트릭스** (서버 5행 × 클라이언트 7열) — 전 칸 PASS
|
||||
| 서버 \ 클라이언트 | Dart.io | Dart.web | Dart.web(WSS) | Go | Kotlin | Python | TypeScript |
|
||||
|---|---|---|---|---|---|---|---|
|
||||
| Dart.io | PASS | PASS | PASS | PASS | PASS | PASS | PASS |
|
||||
| Go | PASS | PASS | PASS | PASS | PASS | PASS | PASS |
|
||||
| Kotlin | PASS | PASS | PASS | PASS | PASS | PASS | PASS |
|
||||
| Python | PASS | PASS | PASS | PASS | PASS | PASS | PASS |
|
||||
| TypeScript | PASS | PASS | PASS | PASS | PASS | PASS | PASS |
|
||||
|
||||
**크로스테스트 상세**: 20개 언어쌍 방향 각 16/16 PASS (FAIL 0) + Dart.web/Dart.web(WSS) 10개 방향 각 2/2 PASS (FAIL 0).
|
||||
```
|
||||
- exit code: **0**
|
||||
- overall_result: **PASS**
|
||||
- 결과 기록 파일: `agent-test/runs/20260602-012917-proto-socket-full-matrix.md` (git ref `be9d193` + local worktree sync 20 files, remote Dart.web 실행 포함)
|
||||
- 로그 디렉터리: `/tmp/claude-1000/proto-socket-matrix.PScds5`
|
||||
|
||||
---
|
||||
|
||||
> **[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.
|
||||
|
||||
## 소유권 표
|
||||
|
||||
| 섹션 | 소유자 | 설명 |
|
||||
|------|--------|------|
|
||||
| 헤더 주석, 개요(date/task/plan/tag), 리뷰 에이전트 지시 | 스텁 생성 시 고정 | 구현 에이전트가 수정하거나 실행하지 않음 |
|
||||
| Roadmap Targets | follow-up plan에서 복사해 스텁 생성 시 고정 | 구현 에이전트가 수정하지 않음; PASS 시 code-review가 `complete.log`의 `Roadmap Completion`으로 복사 |
|
||||
| 구현 항목별 완료 여부 (항목명) | 스텁 생성 시 고정 | `[ ]` -> `[x]` 체크만 구현 에이전트가 수행 |
|
||||
| 구현 체크리스트 (항목 텍스트/순서) | follow-up plan에서 복사해 스텁 생성 시 고정 | 구현 에이전트가 `[ ]` -> `[x]` 체크만 수행; 마지막 체크박스는 저장 전 필수 |
|
||||
| 코드리뷰 전용 체크리스트 | Review agent only | Implementing agent must not modify or check this section |
|
||||
| 계획 대비 변경 사항, 주요 설계 결정 | 구현 에이전트가 채움 | placeholder 텍스트를 실제 내용으로 교체 |
|
||||
| 사용자 리뷰 요청 | 구현 에이전트가 채움 | 진행에 사용자 입력이 필요하지 않으면 `상태: 없음` 유지; 필요하면 결정 항목, 근거, 명령 출력, 자동 후속 불가 이유, 재개 조건을 기록 |
|
||||
| 리뷰어를 위한 체크포인트 | 스텁 생성 시 고정 | 계획에서 추출한 리뷰 포인트 |
|
||||
| 검증 결과 (섹션 제목 + 명령) | 스텁 생성 시 고정 | 실행 출력만 구현 에이전트가 채움; 명령 변경은 `계획 대비 변경 사항`에 기록 |
|
||||
| 코드리뷰 결과 | 리뷰 에이전트가 append | 스텁에 포함하지 않음 |
|
||||
|
||||
## 코드리뷰 결과
|
||||
|
||||
- 종합 판정: PASS
|
||||
- 차원별 평가:
|
||||
- Correctness: Pass
|
||||
- Completeness: Pass
|
||||
- Test coverage: Pass
|
||||
- API contract: Pass
|
||||
- Code quality: Pass
|
||||
- Plan deviation: Pass
|
||||
- Verification trust: Pass
|
||||
- 발견된 문제: 없음
|
||||
- 다음 단계: PASS로 `complete.log`를 작성하고 task directory를 archive로 이동한다.
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
# Complete - m-inbound-queue-ordering/04_dart_gateway
|
||||
|
||||
## 완료 일시
|
||||
|
||||
2026-06-02
|
||||
|
||||
## 요약
|
||||
|
||||
Dart IO worker gateway 구현과 최종 로컬 매트릭스 검증을 2회 루프로 완료했다. 최종 판정: PASS.
|
||||
|
||||
## 루프 이력
|
||||
|
||||
| Plan | Review | Verdict | 메모 |
|
||||
|------|--------|---------|------|
|
||||
| `plan_cloud_G08_0.log` | `code_review_cloud_G08_0.log` | FAIL | Dart gateway 구현은 확인되었으나 최종 매트릭스 검증 결과가 placeholder라 follow-up 필요 |
|
||||
| `plan_cloud_G08_1.log` | `code_review_cloud_G08_1.log` | PASS | `run_matrix.sh --all` 결과 기록과 현재 Dart 중간 검증 재실행으로 verification trust 회복 |
|
||||
|
||||
## 구현/정리 내용
|
||||
|
||||
- Dart IO 전용 inbound gateway 인터페이스, isolate-backed gateway, web-safe fallback export를 추가했다.
|
||||
- `Communicator`에 opt-in inbound gateway attach/onReceivedFrame 경계를 추가하고 stateful dispatch/pending/write queue는 main isolate coordinator에 유지했다.
|
||||
- gateway reorder, responseNonce completion, isolate gateway, browser import compile anchor 테스트를 추가했다.
|
||||
|
||||
## 최종 검증
|
||||
|
||||
- `cd dart && dart test test/communicator_test.dart && dart compile js test/browser_ws_import_compile.dart -o /tmp/proto_socket_browser_ws_import_compile.js` - PASS; reviewer rerun confirmed 20/20 communicator tests and browser import compile success.
|
||||
- `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all` - PASS; saved output path `agent-test/runs/20260602-012917-proto-socket-full-matrix.md`, exit code 0, overall_result PASS.
|
||||
|
||||
## Roadmap Completion
|
||||
|
||||
- Milestone: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- Completed task ids:
|
||||
- `dart-gateway`: PASS; evidence=`plan_cloud_G08_1.log`, `code_review_cloud_G08_1.log`; verification=`agent-test/runs/20260602-012917-proto-socket-full-matrix.md`
|
||||
- Not completed task ids: 없음
|
||||
|
||||
## 잔여 Nit
|
||||
|
||||
- 없음
|
||||
|
||||
## 후속 작업
|
||||
|
||||
- 없음
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
<!-- task=m-inbound-queue-ordering/04_dart_gateway plan=0 tag=API -->
|
||||
|
||||
# Dart Worker Gateway 구현 계획
|
||||
|
||||
## 이 파일을 읽는 구현 에이전트에게
|
||||
|
||||
구현 후 `CODE_REVIEW-cloud-G08.md`의 구현 에이전트 소유 섹션에 실제 변경 내용과 검증 stdout/stderr를 채운 뒤 active 파일을 그대로 두고 리뷰를 요청한다. 사용자 결정, 사용자 소유 환경, scope 충돌로 막히면 review stub의 `사용자 리뷰 요청` 섹션을 채우고 중단한다. `complete.log` 작성, archive 이동, 최종 판정은 code-review 전용이다.
|
||||
|
||||
## 배경
|
||||
|
||||
`dart-gateway`는 Dart IO에서 isolate 기반 worker gateway 후보를 추가하는 큰 runtime 작업이다. 현재 Dart에는 fake gateway reorder anchor만 있고 실제 상시 isolate gateway가 없다. gateway는 raw bytes decode/순수 전처리만 맡고 stateful dispatch는 기존 `Communicator` receive coordinator가 계속 소유해야 한다.
|
||||
|
||||
## 사용자 리뷰 요청 흐름
|
||||
|
||||
구현 중 user-only blocker가 있으면 active `CODE_REVIEW-cloud-G08.md`의 `사용자 리뷰 요청` 섹션에 결정 필요 항목과 실행한 명령 출력을 기록한다. code-review가 정당성을 검토하고 실제 `USER_REVIEW.md` 작성 여부를 판단한다.
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- Task ids:
|
||||
- `dart-gateway`: Dart IO 구현에서 상시 isolate gateway를 두고 순수 bytes 작업을 분리한다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 분석 결과
|
||||
|
||||
### 읽은 파일
|
||||
|
||||
- `agent-roadmap/current.md`
|
||||
- `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- `agent-test/local/rules.md`
|
||||
- `agent-test/local/proto-socket-full-matrix.md`
|
||||
- `agent-test/local/dart-smoke.md`
|
||||
- `dart/lib/src/communicator.dart`
|
||||
- `dart/test/communicator_test.dart`
|
||||
- `../dart-app-core/lib/platform/isolate_manager.dart`
|
||||
|
||||
### 테스트 환경 규칙
|
||||
|
||||
- test_env: local. `agent-test/local/rules.md`, `dart-smoke.md`, `proto-socket-full-matrix.md`를 읽었다.
|
||||
- 적용 명령: `cd dart && dart pub get && dart test && dart compile js test/browser_ws_import_compile.dart -o /tmp/proto_socket_browser_ws_import_compile.js`.
|
||||
- protocol/API 영향과 Dart.web 조건부 export/stub 영향이 있으므로 최종 검증은 전체 matrix `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`로 확장한다.
|
||||
|
||||
### 테스트 커버리지 공백
|
||||
|
||||
- 기존 `dart/test/communicator_test.dart`는 fake gateway reorder만 검증한다.
|
||||
- 실제 isolate gateway on/off, out-of-order worker result reorder, close/cancel, Dart web import compile fallback 검증이 필요하다.
|
||||
|
||||
### 심볼 참조
|
||||
|
||||
- renamed/removed symbol: none.
|
||||
|
||||
### 분할 판단
|
||||
|
||||
- 세 번째 Epic은 언어별 runtime/worker 경계가 독립적이므로 split 한다.
|
||||
- shared task group: `m-inbound-queue-ordering`.
|
||||
- 이 plan은 `04_dart_gateway`이며 다른 gateway task와 런타임 의존성이 없다.
|
||||
|
||||
### 범위 결정 근거
|
||||
|
||||
- Dart IO gateway만 구현한다. Dart web은 worker 미지원 fallback/stub이 깨지지 않는지만 확인한다.
|
||||
- user listener/request handler, pending request map, transport/write queue를 isolate로 옮기지 않는다.
|
||||
- wire format, proto schema, public protocol field는 변경하지 않는다.
|
||||
|
||||
### 빌드 등급
|
||||
|
||||
- build: `cloud-G08`, review: `cloud-G08`. 이유: isolate/process boundary와 concurrency/order 보장이 포함된 runtime 작업이다.
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [ ] Dart IO 전용 worker gateway 타입을 추가하고, gateway input/output에 내부 `seq`를 포함한다.
|
||||
- [ ] gateway는 `PacketBase` envelope decode 또는 순수 bytes 전처리만 수행하고, 결과를 `seq`로 reorder한 뒤 기존 `Communicator.onReceivedData`/coordinator path로 전달한다.
|
||||
- [ ] Dart web 조건부 export/stub 또는 fallback이 깨지지 않도록 IO 전용 import 경계를 유지한다.
|
||||
- [ ] Dart 테스트에 gateway on reorder/response order/fallback compile anchor를 추가한다.
|
||||
- [ ] 중간 검증으로 `cd dart && dart test test/communicator_test.dart && dart compile js test/browser_ws_import_compile.dart -o /tmp/proto_socket_browser_ws_import_compile.js`를 실행하고 실제 stdout/stderr를 기록한다.
|
||||
- [ ] 최종 검증으로 `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 실행하고 결과 기록 파일을 남긴다.
|
||||
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
### [API-1] Dart IO worker gateway
|
||||
|
||||
#### 문제
|
||||
|
||||
- `dart/lib/src/communicator.dart`는 receive coordinator와 fake gateway anchor만 갖고 있고 실제 isolate gateway가 없다.
|
||||
|
||||
#### 해결 방법
|
||||
|
||||
- IO 전용 gateway 클래스를 추가한다.
|
||||
- gateway worker는 raw frame 또는 `PacketBase` bytes를 받아 decode/전처리 결과와 `seq`를 돌려준다.
|
||||
- coordinator owner는 main isolate에 유지하고 `seq` reorder 후 기존 `onReceivedData` 경로로 넣는다.
|
||||
|
||||
#### 수정 파일 및 체크리스트
|
||||
|
||||
- [ ] `dart/lib/src/communicator.dart`
|
||||
- [ ] 필요 시 IO 전용 gateway 파일
|
||||
- [ ] `dart/test/communicator_test.dart`
|
||||
|
||||
#### 테스트 작성
|
||||
|
||||
- gateway result가 `seq=2`, `seq=1`로 완료되어도 listener/response order가 `[1, 2]`인지 검증한다.
|
||||
- Dart web import compile이 통과해 IO 전용 isolate import가 web 빌드를 깨지 않는지 검증한다.
|
||||
|
||||
#### 중간 검증
|
||||
|
||||
```bash
|
||||
cd dart && dart test test/communicator_test.dart && dart compile js test/browser_ws_import_compile.dart -o /tmp/proto_socket_browser_ws_import_compile.js
|
||||
```
|
||||
|
||||
기대 결과: communicator tests PASS, browser import compile PASS.
|
||||
|
||||
## 수정 파일 요약
|
||||
|
||||
| 파일 | 항목 |
|
||||
|------|------|
|
||||
| `dart/lib/src/communicator.dart` | API-1 |
|
||||
| `dart/test/communicator_test.dart` | API-1 |
|
||||
| IO 전용 gateway 파일(필요 시) | API-1 |
|
||||
|
||||
## 최종 검증
|
||||
|
||||
```bash
|
||||
bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all
|
||||
```
|
||||
|
||||
기대 결과: exit code 0, matrix 결과 파일의 최종 결과값 PASS.
|
||||
|
||||
모든 코드 변경 완료 후 반드시 `CODE_REVIEW-*-G??.md`의 구현 에이전트 소유 섹션을 채운다. 이 파일 작성이 구현의 마지막 단계다.
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
<!-- task=m-inbound-queue-ordering/04_dart_gateway plan=1 tag=REVIEW_API -->
|
||||
|
||||
# Dart Worker Gateway 최종 검증 회수 계획
|
||||
|
||||
## 이 파일을 읽는 구현 에이전트에게
|
||||
|
||||
구현 후 `CODE_REVIEW-cloud-G08.md`의 구현 에이전트 소유 섹션에 실제 변경 내용과 검증 stdout/stderr를 채운 뒤 active 파일을 그대로 두고 리뷰를 요청한다. 사용자 결정, 사용자 소유 환경, scope 충돌로 막히면 review stub의 `사용자 리뷰 요청` 섹션을 채우고 중단한다. `complete.log` 작성, archive 이동, 최종 판정은 code-review 전용이다.
|
||||
|
||||
## 배경
|
||||
|
||||
이전 루프의 Dart gateway 코드는 계획 범위에 맞게 구현된 것으로 보이나, 최종 검증 항목이 미완료 상태로 남았다. `CODE_REVIEW-cloud-G08.md`에는 `run_matrix.sh --all` 결과가 `(실행 중)` placeholder로 남아 있어 completeness와 verification trust를 만족하지 못했다.
|
||||
|
||||
## 사용자 리뷰 요청 흐름
|
||||
|
||||
구현 중 user-only blocker가 있으면 active `CODE_REVIEW-cloud-G08.md`의 `사용자 리뷰 요청` 섹션에 결정 필요 항목과 실행한 명령 출력을 기록한다. code-review가 정당성을 검토하고 실제 `USER_REVIEW.md` 작성 여부를 판단한다.
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- Task ids:
|
||||
- `dart-gateway`: Dart IO 구현에서 상시 isolate gateway를 두고 순수 bytes 작업을 분리한다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 분석 결과
|
||||
|
||||
### 이전 루프 결과
|
||||
|
||||
- Archived plan: `agent-task/m-inbound-queue-ordering/04_dart_gateway/plan_cloud_G08_0.log`
|
||||
- Archived review: `agent-task/m-inbound-queue-ordering/04_dart_gateway/code_review_cloud_G08_0.log`
|
||||
- Verdict: FAIL
|
||||
- Required: 최종 매트릭스 검증 미완료 및 실제 stdout/stderr 부재.
|
||||
|
||||
### 범위 결정 근거
|
||||
|
||||
- 새 기능을 확장하지 않는다.
|
||||
- 우선 `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 실제로 완료하고 결과를 기록한다.
|
||||
- 매트릭스가 Dart gateway 변경 때문에 실패하면 필요한 최소 코드/테스트 수정만 포함한다.
|
||||
- 외부 환경 문제라면 정확한 명령, stdout/stderr, `command -v` 등 확인 근거, 재개 조건을 `사용자 리뷰 요청`에 기록한다.
|
||||
|
||||
### 빌드 등급
|
||||
|
||||
- build: `cloud-G08`, review: `cloud-G08`. 이유: 전체 로컬 매트릭스 검증과 실패 시 크로스 언어/Dart gateway 경계 판단이 필요하다.
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [ ] `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 repo root에서 끝까지 실행하고 exit code, 실제 stdout/stderr, 결과 기록 파일 경로를 `CODE_REVIEW-cloud-G08.md`에 기록한다.
|
||||
- [ ] 매트릭스 실패가 Dart gateway 구현에서 비롯되면 최소 범위로 수정하고 관련 Dart 중간 검증과 전체 매트릭스를 다시 실행해 실제 stdout/stderr를 기록한다.
|
||||
- [ ] 외부 환경 또는 사용자 소유 전제 때문에 매트릭스를 완료할 수 없으면 `사용자 리뷰 요청`에 정확한 차단 근거, 실행한 명령 출력, 자동 후속 불가 이유, 재개 조건을 기록한다.
|
||||
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
### [REVIEW_API-1] 최종 매트릭스 검증 회수
|
||||
|
||||
#### 문제
|
||||
|
||||
- 이전 review stub의 최종 검증 항목이 미체크였고, `검증 결과`에도 실제 출력 대신 `(실행 중)` placeholder가 남았다.
|
||||
|
||||
#### 해결 방법
|
||||
|
||||
- repo root에서 고정 명령을 실행한다.
|
||||
- 성공하면 결과 파일 경로와 핵심 PASS 요약을 기록한다.
|
||||
- 실패하면 실패 원인이 코드 문제인지, 테스트 환경 문제인지, 기록 누락인지 분리한다.
|
||||
- 코드 문제면 Dart gateway 범위 내에서만 수정하고 검증을 재실행한다.
|
||||
|
||||
#### 수정 파일 및 체크리스트
|
||||
|
||||
- [ ] `agent-task/m-inbound-queue-ordering/04_dart_gateway/CODE_REVIEW-cloud-G08.md`
|
||||
- [ ] 실패 시 필요한 최소 Dart 파일
|
||||
|
||||
#### 테스트 작성
|
||||
|
||||
- 새 테스트 작성은 기본 범위가 아니다.
|
||||
- 매트릭스 실패가 기존 테스트 공백을 드러내는 경우에만 관련 Dart 테스트를 최소 추가한다.
|
||||
|
||||
#### 중간 검증
|
||||
|
||||
```bash
|
||||
cd dart && dart test test/communicator_test.dart && dart compile js test/browser_ws_import_compile.dart -o /tmp/proto_socket_browser_ws_import_compile.js
|
||||
```
|
||||
|
||||
기대 결과: Dart gateway 관련 communicator tests PASS, browser import compile PASS.
|
||||
|
||||
## 수정 파일 요약
|
||||
|
||||
| 파일 | 항목 |
|
||||
|------|------|
|
||||
| `agent-task/m-inbound-queue-ordering/04_dart_gateway/CODE_REVIEW-cloud-G08.md` | REVIEW_API-1 |
|
||||
| 실패 시 필요한 최소 Dart 파일 | REVIEW_API-1 |
|
||||
|
||||
## 최종 검증
|
||||
|
||||
```bash
|
||||
bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all
|
||||
```
|
||||
|
||||
기대 결과: exit code 0, matrix 결과 파일의 최종 결과값 PASS.
|
||||
|
||||
모든 작업 완료 후 반드시 `CODE_REVIEW-*-G??.md`의 구현 에이전트 소유 섹션을 채운다. 이 파일 작성이 구현의 마지막 단계다.
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<!-- task=m-inbound-queue-ordering/05_go_gateway plan=0 tag=API -->
|
||||
|
||||
# Code Review Reference - API
|
||||
|
||||
> **[IMPLEMENTING AGENT — READ FIRST]** 구현 후 이 파일의 구현 에이전트 소유 섹션을 실제 내용과 검증 출력으로 채우고 active 파일을 그대로 둔 채 리뷰를 요청한다. 최종화는 code-review 전용이다.
|
||||
|
||||
## 개요
|
||||
|
||||
date=2026-06-02
|
||||
task=m-inbound-queue-ordering/05_go_gateway, plan=0, tag=API
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- Task ids:
|
||||
- `go-gateway`: Go goroutine worker pool gateway 후보를 적용한다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 구현 항목별 완료 여부
|
||||
|
||||
| 항목 | 완료 여부 |
|
||||
|------|---------|
|
||||
| [API-1] Go gateway worker pool | [ ] |
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [ ] Go worker gateway 타입과 내부 `seq` 포함 input/output 구조를 추가한다.
|
||||
- [ ] worker pool은 raw bytes decode/순수 전처리만 수행하고, pending/listener/request/write queue 상태를 소유하지 않는다.
|
||||
- [ ] gateway 결과를 `seq` 기준으로 reorder한 뒤 기존 `EnqueueInbound`/receive coordinator로 전달한다.
|
||||
- [ ] Go tests에 대량 packet decode, out-of-order worker completion, race-safe dispatch 순서 검증을 추가한다.
|
||||
- [ ] 중간 검증으로 `cd go && go test -count=1 ./... && go test -race ./...`를 실행하고 실제 stdout/stderr를 기록한다.
|
||||
- [ ] 최종 검증으로 `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 실행하고 결과 기록 파일을 남긴다.
|
||||
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
## 코드리뷰 전용 체크리스트
|
||||
|
||||
- [ ] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
|
||||
- [ ] active review/plan을 `.log`로 아카이브한다.
|
||||
- [ ] PASS이면 `complete.log` 작성 후 task directory를 archive로 이동한다.
|
||||
- [ ] PASS이면 runtime completion metadata를 보고하고 roadmap은 직접 수정하지 않는다.
|
||||
|
||||
## 계획 대비 변경 사항
|
||||
|
||||
_구현 에이전트가 기록한다._
|
||||
|
||||
## 주요 설계 결정
|
||||
|
||||
_구현 에이전트가 기록한다._
|
||||
|
||||
## 사용자 리뷰 요청
|
||||
|
||||
- 상태: 없음
|
||||
- 사유 유형: 없음
|
||||
- 결정 필요: 없음
|
||||
- 차단 근거: 없음
|
||||
- 실행한 검증/명령: 없음
|
||||
- 자동 후속 불가 이유: 없음
|
||||
- 재개 조건: 없음
|
||||
|
||||
## 리뷰어를 위한 체크포인트
|
||||
|
||||
- gateway가 stateful dispatcher 책임을 갖지 않는지 확인한다.
|
||||
- `go test -race ./...` 결과가 실제 출력인지 확인한다.
|
||||
|
||||
## 검증 결과
|
||||
|
||||
### API-1 중간 검증
|
||||
```
|
||||
$ cd go && go test -count=1 ./... && go test -race ./...
|
||||
```
|
||||
|
||||
### 최종 검증
|
||||
```
|
||||
$ bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all
|
||||
```
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
<!-- task=m-inbound-queue-ordering/05_go_gateway plan=0 tag=API -->
|
||||
|
||||
# Go Worker Gateway 구현 계획
|
||||
|
||||
## 이 파일을 읽는 구현 에이전트에게
|
||||
|
||||
구현 후 `CODE_REVIEW-cloud-G08.md`의 구현 에이전트 소유 섹션에 실제 변경 내용과 검증 stdout/stderr를 채운 뒤 active 파일을 그대로 두고 리뷰를 요청한다. 최종 판정, 로그화, `complete.log`, archive 이동은 code-review 전용이다.
|
||||
|
||||
## 배경
|
||||
|
||||
`go-gateway`는 Go에서 goroutine worker pool과 bounded channel 기반 gateway 후보를 추가하는 concurrency 작업이다. 현재 Go는 inbound queue/receive loop와 fake gateway reorder test는 있지만 실제 gateway worker pool은 없다. gateway는 decode/순수 전처리만 수행하고 coordinator가 `seq` 순서 복원과 dispatch를 소유해야 한다.
|
||||
|
||||
## 사용자 리뷰 요청 흐름
|
||||
|
||||
구현 중 user-only blocker가 있으면 active `CODE_REVIEW-cloud-G08.md`의 `사용자 리뷰 요청` 섹션에 결정 필요 항목과 실행한 명령 출력을 기록한다.
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- Task ids:
|
||||
- `go-gateway`: Go goroutine worker pool gateway 후보를 적용한다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 분석 결과
|
||||
|
||||
### 읽은 파일
|
||||
|
||||
- `agent-roadmap/current.md`
|
||||
- `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- `agent-test/local/rules.md`
|
||||
- `agent-test/local/go-smoke.md`
|
||||
- `agent-test/local/proto-socket-full-matrix.md`
|
||||
- `go/communicator.go`
|
||||
- `go/test/communicator_test.go`
|
||||
|
||||
### 테스트 환경 규칙
|
||||
|
||||
- test_env: local. Go 변경 필수 검증은 `cd go && go test ./...`.
|
||||
- concurrency 공유 상태 검증이므로 중간 검증에 `go test -race ./...`를 포함한다.
|
||||
- 최종 검증은 전체 matrix `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`.
|
||||
|
||||
### 테스트 커버리지 공백
|
||||
|
||||
- fake gateway reorder test만 있고 실제 worker pool out-of-order completion, bounded queue, race detector 검증이 없다.
|
||||
|
||||
### 심볼 참조
|
||||
|
||||
- renamed/removed symbol: none.
|
||||
|
||||
### 분할 판단
|
||||
|
||||
- 언어별 gateway는 독립 작업이다. 이 plan은 `05_go_gateway`이며 dependency 없음.
|
||||
|
||||
### 범위 결정 근거
|
||||
|
||||
- Go communicator/gateway와 Go tests만 다룬다. proto schema, public wire field, app-level ordering key는 제외한다.
|
||||
|
||||
### 빌드 등급
|
||||
|
||||
- build/review: `cloud-G08`. 이유: goroutine, bounded channel, race-free state ownership이 핵심이다.
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [ ] Go worker gateway 타입과 내부 `seq` 포함 input/output 구조를 추가한다.
|
||||
- [ ] worker pool은 raw bytes decode/순수 전처리만 수행하고, pending/listener/request/write queue 상태를 소유하지 않는다.
|
||||
- [ ] gateway 결과를 `seq` 기준으로 reorder한 뒤 기존 `EnqueueInbound`/receive coordinator로 전달한다.
|
||||
- [ ] Go tests에 대량 packet decode, out-of-order worker completion, race-safe dispatch 순서 검증을 추가한다.
|
||||
- [ ] 중간 검증으로 `cd go && go test -count=1 ./... && go test -race ./...`를 실행하고 실제 stdout/stderr를 기록한다.
|
||||
- [ ] 최종 검증으로 `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 실행하고 결과 기록 파일을 남긴다.
|
||||
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
### [API-1] Go gateway worker pool
|
||||
|
||||
#### 문제
|
||||
|
||||
- `go/communicator.go`는 `inboundQueue`와 `receiveLoop`만 있고 gateway worker pool이 없다.
|
||||
|
||||
#### 해결 방법
|
||||
|
||||
- 내부 gateway input/output 타입에 `seq`, `typeName`, raw bytes를 둔다.
|
||||
- worker pool 결과를 collector가 `seq` 순서로 정렬/버퍼링한 뒤 coordinator에 넘긴다.
|
||||
|
||||
#### 수정 파일 및 체크리스트
|
||||
|
||||
- [ ] `go/communicator.go`
|
||||
- [ ] 필요 시 Go gateway 전용 파일
|
||||
- [ ] `go/test/communicator_test.go`
|
||||
|
||||
#### 테스트 작성
|
||||
|
||||
- worker 결과가 `seq=2` 먼저, `seq=1` 나중에 도착해도 dispatch는 `[1,2]`인지 확인한다.
|
||||
- `go test -race ./...`로 공유 상태 경합이 없는지 확인한다.
|
||||
|
||||
#### 중간 검증
|
||||
|
||||
```bash
|
||||
cd go && go test -count=1 ./... && go test -race ./...
|
||||
```
|
||||
|
||||
## 수정 파일 요약
|
||||
|
||||
| 파일 | 항목 |
|
||||
|------|------|
|
||||
| `go/communicator.go` | API-1 |
|
||||
| `go/test/communicator_test.go` | API-1 |
|
||||
|
||||
## 최종 검증
|
||||
|
||||
```bash
|
||||
bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all
|
||||
```
|
||||
|
||||
모든 코드 변경 완료 후 반드시 `CODE_REVIEW-*-G??.md`의 구현 에이전트 소유 섹션을 채운다. 이 파일 작성이 구현의 마지막 단계다.
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
<!-- task=m-inbound-queue-ordering/06_kotlin_gateway plan=0 tag=API -->
|
||||
|
||||
# Code Review Reference - API
|
||||
|
||||
> **[IMPLEMENTING AGENT — READ FIRST]** 구현 후 이 파일을 채우고 active 파일을 그대로 둔 채 리뷰를 요청한다. 최종화는 code-review 전용이다.
|
||||
|
||||
## 개요
|
||||
|
||||
date=2026-06-02
|
||||
task=m-inbound-queue-ordering/06_kotlin_gateway, plan=0, tag=API
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- Task ids:
|
||||
- `kotlin-gateway`: Kotlin coroutine worker gateway 후보를 적용한다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 구현 항목별 완료 여부
|
||||
|
||||
| 항목 | 완료 여부 |
|
||||
|------|---------|
|
||||
| [API-1] Kotlin coroutine gateway | [ ] |
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [ ] Kotlin gateway input/output에 내부 `seq`를 포함하고 coroutine worker pool 또는 제한 dispatcher를 추가한다.
|
||||
- [ ] gateway는 decode/전처리만 수행하고 pending/listener/request/write queue 상태를 소유하지 않는다.
|
||||
- [ ] 결과 collector가 `seq` 순서로 receive coordinator에 전달한다.
|
||||
- [ ] Kotlin tests에 out-of-order worker completion, 대량 packet 순서, close/cancel anchor를 추가한다.
|
||||
- [ ] 중간 검증으로 `cd kotlin && env JAVA_HOME=/config/opt/jdk/jdk-17.0.10+7 GRADLE_USER_HOME=/tmp/gradle ./gradlew test --tests com.tokilabs.proto_socket.CommunicatorTest --rerun-tasks`를 실행한다.
|
||||
- [ ] 최종 검증으로 `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 실행한다.
|
||||
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
## 코드리뷰 전용 체크리스트
|
||||
|
||||
- [ ] verdict append, log archive, PASS complete.log/archive move를 수행한다.
|
||||
|
||||
## 계획 대비 변경 사항
|
||||
|
||||
_구현 에이전트가 기록한다._
|
||||
|
||||
## 주요 설계 결정
|
||||
|
||||
_구현 에이전트가 기록한다._
|
||||
|
||||
## 사용자 리뷰 요청
|
||||
|
||||
- 상태: 없음
|
||||
- 사유 유형: 없음
|
||||
- 결정 필요: 없음
|
||||
- 차단 근거: 없음
|
||||
- 실행한 검증/명령: 없음
|
||||
- 자동 후속 불가 이유: 없음
|
||||
- 재개 조건: 없음
|
||||
|
||||
## 리뷰어를 위한 체크포인트
|
||||
|
||||
- gateway가 actor/coordinator state ownership을 침범하지 않는지 확인한다.
|
||||
|
||||
## 검증 결과
|
||||
|
||||
### API-1 중간 검증
|
||||
```
|
||||
$ cd kotlin && env JAVA_HOME=/config/opt/jdk/jdk-17.0.10+7 GRADLE_USER_HOME=/tmp/gradle ./gradlew test --tests com.tokilabs.proto_socket.CommunicatorTest --rerun-tasks
|
||||
```
|
||||
|
||||
### 최종 검증
|
||||
```
|
||||
$ bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all
|
||||
```
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
<!-- task=m-inbound-queue-ordering/06_kotlin_gateway plan=0 tag=API -->
|
||||
|
||||
# Kotlin Worker Gateway 구현 계획
|
||||
|
||||
## 이 파일을 읽는 구현 에이전트에게
|
||||
|
||||
구현 후 `CODE_REVIEW-cloud-G08.md`의 구현 에이전트 소유 섹션에 실제 변경 내용과 검증 stdout/stderr를 채운 뒤 active 파일을 그대로 두고 리뷰를 요청한다. 최종 판정과 archive는 code-review 전용이다.
|
||||
|
||||
## 배경
|
||||
|
||||
`kotlin-gateway`는 coroutine worker pool 또는 제한된 dispatcher 기반 gateway 후보를 추가하는 작업이다. 현재 Kotlin은 inbound `Channel`과 receive coroutine은 있지만 실제 gateway worker pool은 없다.
|
||||
|
||||
## 사용자 리뷰 요청 흐름
|
||||
|
||||
구현 중 user-only blocker가 있으면 active review stub의 `사용자 리뷰 요청` 섹션을 채운다.
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- Task ids:
|
||||
- `kotlin-gateway`: Kotlin coroutine worker gateway 후보를 적용한다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 분석 결과
|
||||
|
||||
### 읽은 파일
|
||||
|
||||
- `agent-roadmap/current.md`
|
||||
- `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- `agent-test/local/rules.md`
|
||||
- `agent-test/local/kotlin-smoke.md`
|
||||
- `agent-test/local/proto-socket-full-matrix.md`
|
||||
- `kotlin/src/main/kotlin/com/tokilabs/proto_socket/Communicator.kt`
|
||||
- `kotlin/src/test/kotlin/com/tokilabs/proto_socket/CommunicatorTest.kt`
|
||||
|
||||
### 테스트 환경 규칙
|
||||
|
||||
- Kotlin 변경 필수 검증: `cd kotlin && ./gradlew test`.
|
||||
- 최종 검증: 전체 matrix.
|
||||
|
||||
### 테스트 커버리지 공백
|
||||
|
||||
- fake gateway reorder는 있지만 coroutine worker pool out-of-order completion, actor/coordinator ownership, close/cancel 검증이 없다.
|
||||
|
||||
### 심볼 참조
|
||||
|
||||
- renamed/removed symbol: none.
|
||||
|
||||
### 분할 판단
|
||||
|
||||
- `06_kotlin_gateway`는 독립 언어 task이며 dependency 없음.
|
||||
|
||||
### 범위 결정 근거
|
||||
|
||||
- Kotlin communicator/gateway와 tests만 수정한다. OkHttp WS staging 정책, proto schema, app-level handler pool은 제외한다.
|
||||
|
||||
### 빌드 등급
|
||||
|
||||
- build/review: `cloud-G08`. 이유: coroutine worker/actor ownership과 ordering risk가 있다.
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [ ] Kotlin gateway input/output에 내부 `seq`를 포함하고 coroutine worker pool 또는 제한 dispatcher를 추가한다.
|
||||
- [ ] gateway는 decode/전처리만 수행하고 pending/listener/request/write queue 상태를 소유하지 않는다.
|
||||
- [ ] 결과 collector가 `seq` 순서로 receive coordinator에 전달한다.
|
||||
- [ ] Kotlin tests에 out-of-order worker completion, 대량 packet 순서, close/cancel anchor를 추가한다.
|
||||
- [ ] 중간 검증으로 `cd kotlin && env JAVA_HOME=/config/opt/jdk/jdk-17.0.10+7 GRADLE_USER_HOME=/tmp/gradle ./gradlew test --tests com.tokilabs.proto_socket.CommunicatorTest --rerun-tasks`를 실행한다.
|
||||
- [ ] 최종 검증으로 `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 실행한다.
|
||||
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
### [API-1] Kotlin coroutine gateway
|
||||
|
||||
#### 문제
|
||||
|
||||
- `Communicator.kt`는 receive coroutine만 있고 gateway worker candidate가 없다.
|
||||
|
||||
#### 해결 방법
|
||||
|
||||
- coroutine worker pool/collector를 두고 collector만 coordinator path에 결과를 넣는다.
|
||||
|
||||
#### 수정 파일 및 체크리스트
|
||||
|
||||
- [ ] `kotlin/src/main/kotlin/com/tokilabs/proto_socket/Communicator.kt`
|
||||
- [ ] `kotlin/src/test/kotlin/com/tokilabs/proto_socket/CommunicatorTest.kt`
|
||||
|
||||
#### 테스트 작성
|
||||
|
||||
- `seq=2`가 먼저 완료되어도 dispatch order는 `[1,2]`인지 확인한다.
|
||||
|
||||
#### 중간 검증
|
||||
|
||||
```bash
|
||||
cd kotlin && env JAVA_HOME=/config/opt/jdk/jdk-17.0.10+7 GRADLE_USER_HOME=/tmp/gradle ./gradlew test --tests com.tokilabs.proto_socket.CommunicatorTest --rerun-tasks
|
||||
```
|
||||
|
||||
## 수정 파일 요약
|
||||
|
||||
| 파일 | 항목 |
|
||||
|------|------|
|
||||
| `kotlin/src/main/kotlin/com/tokilabs/proto_socket/Communicator.kt` | API-1 |
|
||||
| `kotlin/src/test/kotlin/com/tokilabs/proto_socket/CommunicatorTest.kt` | API-1 |
|
||||
|
||||
## 최종 검증
|
||||
|
||||
```bash
|
||||
bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all
|
||||
```
|
||||
|
||||
모든 코드 변경 완료 후 반드시 `CODE_REVIEW-*-G??.md`의 구현 에이전트 소유 섹션을 채운다. 이 파일 작성이 구현의 마지막 단계다.
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
<!-- task=m-inbound-queue-ordering/07_python_gateway plan=0 tag=API -->
|
||||
|
||||
# Code Review Reference - API
|
||||
|
||||
> **[IMPLEMENTING AGENT — READ FIRST]** 구현 후 이 파일을 채우고 active 파일을 그대로 둔 채 리뷰를 요청한다. 최종화는 code-review 전용이다.
|
||||
|
||||
## 개요
|
||||
|
||||
date=2026-06-02
|
||||
task=m-inbound-queue-ordering/07_python_gateway, plan=0, tag=API
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- Task ids:
|
||||
- `python-gateway`: Python process/asyncio worker gateway 후보를 적용한다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 구현 항목별 완료 여부
|
||||
|
||||
| 항목 | 완료 여부 |
|
||||
|------|---------|
|
||||
| [API-1] Python gateway worker candidate | [ ] |
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [ ] Python gateway input/output에 내부 `seq`를 포함하고 asyncio worker 또는 process worker 후보를 추가한다.
|
||||
- [ ] gateway는 decode/전처리만 수행하고 pending/listener/request/write queue 상태를 소유하지 않는다.
|
||||
- [ ] 작은 packet에서는 gateway off fallback이 기존 receive coordinator path를 사용하도록 한다.
|
||||
- [ ] Python tests에 out-of-order worker completion, fallback, close/cancel 순서 검증을 추가한다.
|
||||
- [ ] 중간 검증으로 `cd python && python3 -m pytest -q test/test_communicator.py`를 실행한다.
|
||||
- [ ] 최종 검증으로 `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 실행한다.
|
||||
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
## 코드리뷰 전용 체크리스트
|
||||
|
||||
- [ ] verdict append, log archive, PASS complete.log/archive move를 수행한다.
|
||||
|
||||
## 계획 대비 변경 사항
|
||||
|
||||
_구현 에이전트가 기록한다._
|
||||
|
||||
## 주요 설계 결정
|
||||
|
||||
_구현 에이전트가 기록한다._
|
||||
|
||||
## 사용자 리뷰 요청
|
||||
|
||||
- 상태: 없음
|
||||
- 사유 유형: 없음
|
||||
- 결정 필요: 없음
|
||||
- 차단 근거: 없음
|
||||
- 실행한 검증/명령: 없음
|
||||
- 자동 후속 불가 이유: 없음
|
||||
- 재개 조건: 없음
|
||||
|
||||
## 리뷰어를 위한 체크포인트
|
||||
|
||||
- process/async worker가 stateful dispatch를 소유하지 않는지 확인한다.
|
||||
- fallback path가 기존 coordinator path인지 확인한다.
|
||||
|
||||
## 검증 결과
|
||||
|
||||
### API-1 중간 검증
|
||||
```
|
||||
$ cd python && python3 -m pytest -q test/test_communicator.py
|
||||
```
|
||||
|
||||
### 최종 검증
|
||||
```
|
||||
$ bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all
|
||||
```
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
<!-- task=m-inbound-queue-ordering/07_python_gateway plan=0 tag=API -->
|
||||
|
||||
# Python Worker Gateway 구현 계획
|
||||
|
||||
## 이 파일을 읽는 구현 에이전트에게
|
||||
|
||||
구현 후 `CODE_REVIEW-cloud-G08.md`의 구현 에이전트 소유 섹션에 실제 변경 내용과 검증 stdout/stderr를 채운 뒤 active 파일을 그대로 두고 리뷰를 요청한다. 최종화는 code-review 전용이다.
|
||||
|
||||
## 배경
|
||||
|
||||
`python-gateway`는 Python에서 CPU-bound decode는 process worker 후보로, 경량 전처리는 asyncio worker 후보로 분리하는 작업이다. 현재 Python은 `asyncio.Queue` receive task와 fake gateway reorder test만 있고 실제 gateway on/off 후보가 없다.
|
||||
|
||||
## 사용자 리뷰 요청 흐름
|
||||
|
||||
구현 중 user-only blocker가 있으면 active review stub의 `사용자 리뷰 요청` 섹션을 채운다.
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- Task ids:
|
||||
- `python-gateway`: Python process/asyncio worker gateway 후보를 적용한다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 분석 결과
|
||||
|
||||
### 읽은 파일
|
||||
|
||||
- `agent-roadmap/current.md`
|
||||
- `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- `agent-test/local/rules.md`
|
||||
- `agent-test/local/python-smoke.md`
|
||||
- `agent-test/local/proto-socket-full-matrix.md`
|
||||
- `python/proto_socket/communicator.py`
|
||||
- `python/test/test_communicator.py`
|
||||
|
||||
### 테스트 환경 규칙
|
||||
|
||||
- Python 변경 필수 검증: `cd python && python3 -m pytest -q`.
|
||||
- 최종 검증: 전체 matrix.
|
||||
|
||||
### 테스트 커버리지 공백
|
||||
|
||||
- 실제 gateway on/off, out-of-order worker completion, close/cancel, small packet fallback 검증이 없다.
|
||||
|
||||
### 심볼 참조
|
||||
|
||||
- renamed/removed symbol: none.
|
||||
|
||||
### 분할 판단
|
||||
|
||||
- `07_python_gateway`는 독립 언어 task이며 dependency 없음.
|
||||
|
||||
### 범위 결정 근거
|
||||
|
||||
- Python communicator/gateway와 tests만 수정한다. 외부 dependency 추가는 피하고 standard library `asyncio`/`concurrent.futures`를 우선한다.
|
||||
|
||||
### 빌드 등급
|
||||
|
||||
- build/review: `cloud-G08`. 이유: process/async worker와 close/cancel/order 경계가 있다.
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [ ] Python gateway input/output에 내부 `seq`를 포함하고 asyncio worker 또는 process worker 후보를 추가한다.
|
||||
- [ ] gateway는 decode/전처리만 수행하고 pending/listener/request/write queue 상태를 소유하지 않는다.
|
||||
- [ ] 작은 packet에서는 gateway off fallback이 기존 receive coordinator path를 사용하도록 한다.
|
||||
- [ ] Python tests에 out-of-order worker completion, fallback, close/cancel 순서 검증을 추가한다.
|
||||
- [ ] 중간 검증으로 `cd python && python3 -m pytest -q test/test_communicator.py`를 실행한다.
|
||||
- [ ] 최종 검증으로 `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 실행한다.
|
||||
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
### [API-1] Python gateway worker candidate
|
||||
|
||||
#### 문제
|
||||
|
||||
- `python/proto_socket/communicator.py`에는 실제 gateway 후보가 없다.
|
||||
|
||||
#### 해결 방법
|
||||
|
||||
- asyncio worker path와 CPU-bound process worker 후보를 표준 라이브러리로 구성한다.
|
||||
- 결과 collector가 `seq` 순서로 기존 `enqueue_inbound`/coordinator path에 넘긴다.
|
||||
|
||||
#### 수정 파일 및 체크리스트
|
||||
|
||||
- [ ] `python/proto_socket/communicator.py`
|
||||
- [ ] `python/test/test_communicator.py`
|
||||
|
||||
#### 테스트 작성
|
||||
|
||||
- out-of-order worker result가 `[1,2]`로 dispatch되는지 검증한다.
|
||||
- gateway off fallback이 기존 테스트와 동일 path를 사용하는지 검증한다.
|
||||
|
||||
#### 중간 검증
|
||||
|
||||
```bash
|
||||
cd python && python3 -m pytest -q test/test_communicator.py
|
||||
```
|
||||
|
||||
## 수정 파일 요약
|
||||
|
||||
| 파일 | 항목 |
|
||||
|------|------|
|
||||
| `python/proto_socket/communicator.py` | API-1 |
|
||||
| `python/test/test_communicator.py` | API-1 |
|
||||
|
||||
## 최종 검증
|
||||
|
||||
```bash
|
||||
bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all
|
||||
```
|
||||
|
||||
모든 코드 변경 완료 후 반드시 `CODE_REVIEW-*-G??.md`의 구현 에이전트 소유 섹션을 채운다. 이 파일 작성이 구현의 마지막 단계다.
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<!-- task=m-inbound-queue-ordering/08_typescript_gateway plan=0 tag=API -->
|
||||
|
||||
# Code Review Reference - API
|
||||
|
||||
> **[IMPLEMENTING AGENT — READ FIRST]** 구현 후 이 파일을 채우고 active 파일을 그대로 둔 채 리뷰를 요청한다. 최종화는 code-review 전용이다.
|
||||
|
||||
## 개요
|
||||
|
||||
date=2026-06-02
|
||||
task=m-inbound-queue-ordering/08_typescript_gateway, plan=0, tag=API
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- Task ids:
|
||||
- `typescript-gateway`: Node/browser worker gateway 후보를 적용한다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 구현 항목별 완료 여부
|
||||
|
||||
| 항목 | 완료 여부 |
|
||||
|------|---------|
|
||||
| [API-1] TypeScript worker gateway | [ ] |
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [ ] TypeScript gateway input/output에 내부 `seq`를 포함하고 Node worker_threads 후보를 추가한다.
|
||||
- [ ] browser target은 Web Worker 또는 safe fallback을 사용하며 unsupported 환경에서 기존 coordinator path를 유지한다.
|
||||
- [ ] transferable `ArrayBuffer` 사용 여부를 검토하고 복사 비용을 줄인다.
|
||||
- [ ] worker result를 `seq` 기준으로 reorder한 뒤 기존 `enqueueInbound`/coordinator path로 전달한다.
|
||||
- [ ] TypeScript tests에 Node gateway on, fallback, out-of-order completion 검증을 추가한다.
|
||||
- [ ] 중간 검증으로 `cd typescript && npm run check && npm test -- communicator`를 실행한다.
|
||||
- [ ] 최종 검증으로 `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 실행한다.
|
||||
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
## 코드리뷰 전용 체크리스트
|
||||
|
||||
- [ ] verdict append, log archive, PASS complete.log/archive move를 수행한다.
|
||||
|
||||
## 계획 대비 변경 사항
|
||||
|
||||
_구현 에이전트가 기록한다._
|
||||
|
||||
## 주요 설계 결정
|
||||
|
||||
_구현 에이전트가 기록한다._
|
||||
|
||||
## 사용자 리뷰 요청
|
||||
|
||||
- 상태: 없음
|
||||
- 사유 유형: 없음
|
||||
- 결정 필요: 없음
|
||||
- 차단 근거: 없음
|
||||
- 실행한 검증/명령: 없음
|
||||
- 자동 후속 불가 이유: 없음
|
||||
- 재개 조건: 없음
|
||||
|
||||
## 리뷰어를 위한 체크포인트
|
||||
|
||||
- Node/browser worker 경계가 package/runtime import를 깨지 않는지 확인한다.
|
||||
- fallback 모드가 기존 coordinator path를 유지하는지 확인한다.
|
||||
|
||||
## 검증 결과
|
||||
|
||||
### API-1 중간 검증
|
||||
```
|
||||
$ cd typescript && npm run check && npm test -- communicator
|
||||
```
|
||||
|
||||
### 최종 검증
|
||||
```
|
||||
$ bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all
|
||||
```
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
<!-- task=m-inbound-queue-ordering/08_typescript_gateway plan=0 tag=API -->
|
||||
|
||||
# TypeScript Worker Gateway 구현 계획
|
||||
|
||||
## 이 파일을 읽는 구현 에이전트에게
|
||||
|
||||
구현 후 `CODE_REVIEW-cloud-G08.md`의 구현 에이전트 소유 섹션에 실제 변경 내용과 검증 stdout/stderr를 채운 뒤 active 파일을 그대로 두고 리뷰를 요청한다. 최종화는 code-review 전용이다.
|
||||
|
||||
## 배경
|
||||
|
||||
`typescript-gateway`는 Node `worker_threads`와 browser Web Worker/fallback 후보를 추가하는 runtime 작업이다. 현재 TypeScript는 inbound queue/async worker와 fake gateway reorder test만 있고 실제 gateway on/off 후보가 없다.
|
||||
|
||||
## 사용자 리뷰 요청 흐름
|
||||
|
||||
구현 중 user-only blocker가 있으면 active review stub의 `사용자 리뷰 요청` 섹션을 채운다.
|
||||
|
||||
## Roadmap Targets
|
||||
|
||||
- Milestone: `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- Task ids:
|
||||
- `typescript-gateway`: Node/browser worker gateway 후보를 적용한다.
|
||||
- Completion mode: check-on-pass
|
||||
|
||||
## 분석 결과
|
||||
|
||||
### 읽은 파일
|
||||
|
||||
- `agent-roadmap/current.md`
|
||||
- `agent-roadmap/milestones/inbound-queue-ordering.md`
|
||||
- `agent-test/local/rules.md`
|
||||
- `agent-test/local/typescript-smoke.md`
|
||||
- `agent-test/local/proto-socket-full-matrix.md`
|
||||
- `typescript/src/communicator.ts`
|
||||
- `typescript/test/communicator.test.ts`
|
||||
|
||||
### 테스트 환경 규칙
|
||||
|
||||
- TypeScript 변경 필수 검증: `cd typescript && npm run check && npm test`.
|
||||
- 최종 검증: 전체 matrix.
|
||||
|
||||
### 테스트 커버리지 공백
|
||||
|
||||
- 실제 Node worker_threads gateway, browser worker/fallback, transferable ArrayBuffer, out-of-order completion 검증이 없다.
|
||||
|
||||
### 심볼 참조
|
||||
|
||||
- renamed/removed symbol: none.
|
||||
|
||||
### 분할 판단
|
||||
|
||||
- `08_typescript_gateway`는 독립 언어 task이며 dependency 없음.
|
||||
|
||||
### 범위 결정 근거
|
||||
|
||||
- TypeScript communicator/gateway와 tests만 수정한다. 패킷 wire schema와 app-level handler pool은 제외한다.
|
||||
|
||||
### 빌드 등급
|
||||
|
||||
- build/review: `cloud-G08`. 이유: Node/browser runtime split과 worker/fallback 경계가 있다.
|
||||
|
||||
## 구현 체크리스트
|
||||
|
||||
- [ ] TypeScript gateway input/output에 내부 `seq`를 포함하고 Node worker_threads 후보를 추가한다.
|
||||
- [ ] browser target은 Web Worker 또는 safe fallback을 사용하며 unsupported 환경에서 기존 coordinator path를 유지한다.
|
||||
- [ ] transferable `ArrayBuffer` 사용 여부를 검토하고 복사 비용을 줄인다.
|
||||
- [ ] worker result를 `seq` 기준으로 reorder한 뒤 기존 `enqueueInbound`/coordinator path로 전달한다.
|
||||
- [ ] TypeScript tests에 Node gateway on, fallback, out-of-order completion 검증을 추가한다.
|
||||
- [ ] 중간 검증으로 `cd typescript && npm run check && npm test -- communicator`를 실행한다.
|
||||
- [ ] 최종 검증으로 `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`을 실행한다.
|
||||
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.
|
||||
|
||||
### [API-1] TypeScript worker gateway
|
||||
|
||||
#### 문제
|
||||
|
||||
- `typescript/src/communicator.ts`에는 실제 worker gateway 후보가 없다.
|
||||
|
||||
#### 해결 방법
|
||||
|
||||
- Node worker_threads gateway와 browser fallback 경계를 분리한다.
|
||||
- worker result collector가 `seq` 순서로 coordinator path에 넣는다.
|
||||
|
||||
#### 수정 파일 및 체크리스트
|
||||
|
||||
- [ ] `typescript/src/communicator.ts`
|
||||
- [ ] 필요 시 gateway 전용 파일
|
||||
- [ ] `typescript/test/communicator.test.ts`
|
||||
|
||||
#### 테스트 작성
|
||||
|
||||
- worker result가 out-of-order로 완료되어도 dispatch order가 `[1,2]`인지 검증한다.
|
||||
- fallback 모드가 기존 coordinator path를 사용하는지 검증한다.
|
||||
|
||||
#### 중간 검증
|
||||
|
||||
```bash
|
||||
cd typescript && npm run check && npm test -- communicator
|
||||
```
|
||||
|
||||
## 수정 파일 요약
|
||||
|
||||
| 파일 | 항목 |
|
||||
|------|------|
|
||||
| `typescript/src/communicator.ts` | API-1 |
|
||||
| `typescript/test/communicator.test.ts` | API-1 |
|
||||
| gateway 전용 파일(필요 시) | API-1 |
|
||||
|
||||
## 최종 검증
|
||||
|
||||
```bash
|
||||
bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all
|
||||
```
|
||||
|
||||
모든 코드 변경 완료 후 반드시 `CODE_REVIEW-*-G??.md`의 구현 에이전트 소유 섹션을 채운다. 이 파일 작성이 구현의 마지막 단계다.
|
||||
|
|
@ -2,6 +2,9 @@ library proto_socket;
|
|||
|
||||
export 'src/communicator.dart';
|
||||
export 'src/transport.dart';
|
||||
export 'src/inbound_gateway.dart';
|
||||
export 'src/inbound_gateway_io.dart'
|
||||
if (dart.library.html) 'src/inbound_gateway_web.dart';
|
||||
export 'src/base_client.dart';
|
||||
export 'src/protobuf_client.dart'
|
||||
if (dart.library.html) 'src/protobuf_client_web.dart';
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
import 'dart:async';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:protobuf/protobuf.dart';
|
||||
import 'inbound_gateway.dart';
|
||||
import 'packets/message_common.pb.dart';
|
||||
import 'transport.dart';
|
||||
|
||||
|
|
@ -39,6 +40,13 @@ abstract class Communicator {
|
|||
bool _isClosing = false;
|
||||
Completer<void>? _queueWaiter;
|
||||
|
||||
/// Optional worker gateway. When attached, raw frames are decoded off the
|
||||
/// coordinator and reordered by [seq] before reaching [onReceivedData].
|
||||
/// Defaults to null: frames decode inline on the main isolate.
|
||||
InboundGateway? _inboundGateway;
|
||||
StreamSubscription<DecodedFrame>? _gatewaySubscription;
|
||||
int _frameSeq = 0;
|
||||
|
||||
/// Monotonically increasing nonce. Shared by send / sendRequest / response.
|
||||
int _nonce = 0;
|
||||
int get nonce => _nonce;
|
||||
|
|
@ -223,6 +231,47 @@ abstract class Communicator {
|
|||
};
|
||||
}
|
||||
|
||||
/// Attaches a worker [gateway] in front of the receive coordinator.
|
||||
///
|
||||
/// Decoded results are forwarded to [onReceivedData] in input [seq] order, so
|
||||
/// the coordinator keeps its FIFO dispatch and sole ownership of stateful
|
||||
/// handling. Attaching is opt-in; without it [onReceivedFrame] decodes inline.
|
||||
@protected
|
||||
void attachInboundGateway(InboundGateway gateway) {
|
||||
_inboundGateway = gateway;
|
||||
_gatewaySubscription = gateway.results.listen((frame) {
|
||||
onReceivedData(
|
||||
frame.typeName,
|
||||
frame.data,
|
||||
incomingNonce: frame.incomingNonce,
|
||||
responseNonce: frame.responseNonce,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
int _nextFrameSeq() {
|
||||
_frameSeq += 1;
|
||||
return _frameSeq;
|
||||
}
|
||||
|
||||
/// Receives a raw [PacketBase] frame from a transport.
|
||||
///
|
||||
/// When a gateway is attached the frame is submitted with an internal [seq]
|
||||
/// for off-coordinator decode + reorder; otherwise it is decoded inline and
|
||||
/// forwarded to [onReceivedData].
|
||||
@protected
|
||||
Future<void> onReceivedFrame(List<int> frame) async {
|
||||
if (!isAlive || _isClosing) return;
|
||||
final gateway = _inboundGateway;
|
||||
if (gateway != null) {
|
||||
gateway.submit(InboundFrame(seq: _nextFrameSeq(), bytes: frame));
|
||||
return;
|
||||
}
|
||||
final common = PacketBase.fromBuffer(frame);
|
||||
await onReceivedData(common.typeName, common.data,
|
||||
incomingNonce: common.nonce, responseNonce: common.responseNonce);
|
||||
}
|
||||
|
||||
/// Enqueues an inbound packet for serial dispatch.
|
||||
///
|
||||
/// The receive worker processes items one at a time, preserving FIFO order
|
||||
|
|
@ -272,6 +321,7 @@ abstract class Communicator {
|
|||
_queueWaiter!.complete();
|
||||
_queueWaiter = null;
|
||||
}
|
||||
await _closeInboundGateway();
|
||||
cancelPendingRequests();
|
||||
}
|
||||
|
||||
|
|
@ -285,9 +335,19 @@ abstract class Communicator {
|
|||
_queueWaiter!.complete();
|
||||
_queueWaiter = null;
|
||||
}
|
||||
unawaited(_closeInboundGateway());
|
||||
cancelPendingRequests();
|
||||
}
|
||||
|
||||
Future<void> _closeInboundGateway() async {
|
||||
final subscription = _gatewaySubscription;
|
||||
final gateway = _inboundGateway;
|
||||
_gatewaySubscription = null;
|
||||
_inboundGateway = null;
|
||||
await subscription?.cancel();
|
||||
await gateway?.close();
|
||||
}
|
||||
|
||||
/// Dispatches a single inbound item sequentially.
|
||||
Future<void> _dispatchInbound(_InboundItem item) async {
|
||||
if (item.responseNonce > 0) {
|
||||
|
|
|
|||
126
dart/lib/src/inbound_gateway.dart
Normal file
126
dart/lib/src/inbound_gateway.dart
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'packets/message_common.pb.dart';
|
||||
|
||||
/// A raw inbound frame queued for gateway preprocessing.
|
||||
///
|
||||
/// [seq] is an internal monotonically increasing sequence assigned by the
|
||||
/// receive side before submitting to the gateway. It is used only to restore
|
||||
/// input order after parallel/asynchronous decoding and never touches the wire
|
||||
/// format or any public protocol field.
|
||||
class InboundFrame {
|
||||
final int seq;
|
||||
final List<int> bytes;
|
||||
|
||||
const InboundFrame({required this.seq, required this.bytes});
|
||||
}
|
||||
|
||||
/// Result of decoding a [PacketBase] envelope inside a gateway.
|
||||
///
|
||||
/// Carries the same envelope fields that [Communicator.onReceivedData] expects,
|
||||
/// plus the originating [seq] so results can be reordered before dispatch.
|
||||
class DecodedFrame {
|
||||
final int seq;
|
||||
final String typeName;
|
||||
final List<int> data;
|
||||
final int incomingNonce;
|
||||
final int responseNonce;
|
||||
|
||||
const DecodedFrame({
|
||||
required this.seq,
|
||||
required this.typeName,
|
||||
required this.data,
|
||||
required this.incomingNonce,
|
||||
required this.responseNonce,
|
||||
});
|
||||
}
|
||||
|
||||
/// Worker gateway contract.
|
||||
///
|
||||
/// A gateway performs only pure raw-bytes work (envelope decode / lightweight
|
||||
/// preprocessing) off the receive coordinator. It must NOT own stateful
|
||||
/// dispatch, the pending-request map, listeners, or the outbound write queue —
|
||||
/// those stay on the main isolate's receive coordinator. Results are emitted on
|
||||
/// [results] in input [seq] order so the coordinator can dispatch
|
||||
/// deterministically.
|
||||
abstract interface class InboundGateway {
|
||||
/// Reordered decode results, emitted in input [InboundFrame.seq] order.
|
||||
Stream<DecodedFrame> get results;
|
||||
|
||||
/// Prepares the gateway (e.g. spawns a long-running isolate). Idempotent.
|
||||
Future<void> start();
|
||||
|
||||
/// Submits a raw frame for decoding. Fire-and-forget; the decoded result is
|
||||
/// later emitted on [results].
|
||||
void submit(InboundFrame frame);
|
||||
|
||||
/// Releases gateway resources and closes [results].
|
||||
Future<void> close();
|
||||
}
|
||||
|
||||
/// Restores input order from results that may arrive out of order.
|
||||
///
|
||||
/// Sequences are expected to be contiguous starting at 1. A submitted frame is
|
||||
/// buffered until every earlier sequence has been released, then it and any
|
||||
/// now-contiguous successors are returned in order.
|
||||
class FrameReorderBuffer {
|
||||
int _nextSeq = 1;
|
||||
final Map<int, DecodedFrame> _pending = {};
|
||||
|
||||
/// Buffers [frame] and returns the frames now releasable in seq order.
|
||||
List<DecodedFrame> release(DecodedFrame frame) {
|
||||
if (frame.seq < _nextSeq) {
|
||||
// Already released (or duplicate); ignore to avoid emitting twice.
|
||||
return const [];
|
||||
}
|
||||
_pending[frame.seq] = frame;
|
||||
final ready = <DecodedFrame>[];
|
||||
while (_pending.containsKey(_nextSeq)) {
|
||||
ready.add(_pending.remove(_nextSeq)!);
|
||||
_nextSeq++;
|
||||
}
|
||||
return ready;
|
||||
}
|
||||
}
|
||||
|
||||
/// In-process gateway that decodes synchronously on the calling isolate.
|
||||
///
|
||||
/// Used as the web fallback (where worker isolates are unavailable) and as a
|
||||
/// lightweight default where isolate hand-off cost is not worth it. It still
|
||||
/// emits results in [seq] order via a [FrameReorderBuffer], so callers see the
|
||||
/// same ordering contract as the isolate-backed gateway.
|
||||
class SyncInboundGateway implements InboundGateway {
|
||||
final StreamController<DecodedFrame> _controller =
|
||||
StreamController<DecodedFrame>.broadcast();
|
||||
final FrameReorderBuffer _reorder = FrameReorderBuffer();
|
||||
bool _closed = false;
|
||||
|
||||
@override
|
||||
Stream<DecodedFrame> get results => _controller.stream;
|
||||
|
||||
@override
|
||||
Future<void> start() async {}
|
||||
|
||||
@override
|
||||
void submit(InboundFrame frame) {
|
||||
if (_closed) return;
|
||||
final common = PacketBase.fromBuffer(frame.bytes);
|
||||
final decoded = DecodedFrame(
|
||||
seq: frame.seq,
|
||||
typeName: common.typeName,
|
||||
data: common.data,
|
||||
incomingNonce: common.nonce,
|
||||
responseNonce: common.responseNonce,
|
||||
);
|
||||
for (final ready in _reorder.release(decoded)) {
|
||||
if (!_controller.isClosed) _controller.add(ready);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> close() async {
|
||||
if (_closed) return;
|
||||
_closed = true;
|
||||
await _controller.close();
|
||||
}
|
||||
}
|
||||
108
dart/lib/src/inbound_gateway_io.dart
Normal file
108
dart/lib/src/inbound_gateway_io.dart
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
import 'dart:async';
|
||||
import 'dart:isolate';
|
||||
|
||||
import 'inbound_gateway.dart';
|
||||
import 'packets/message_common.pb.dart';
|
||||
|
||||
/// Long-running isolate worker gateway for Dart IO targets.
|
||||
///
|
||||
/// A single isolate is spawned once via [start] and kept alive to avoid
|
||||
/// repeating spawn cost per frame. Raw frames are sent over a [SendPort] with
|
||||
/// their [InboundFrame.seq]; the isolate decodes the [PacketBase] envelope
|
||||
/// (pure work only) and sends the fields back. Results are reordered by [seq]
|
||||
/// and emitted on [results] for the main-isolate coordinator to dispatch.
|
||||
///
|
||||
/// The gateway deliberately owns no stateful dispatch: listeners, request
|
||||
/// handlers, the pending-request map, and the outbound write queue all remain
|
||||
/// on the main isolate's receive coordinator.
|
||||
class IsolateInboundGateway implements InboundGateway {
|
||||
final StreamController<DecodedFrame> _controller =
|
||||
StreamController<DecodedFrame>.broadcast();
|
||||
final FrameReorderBuffer _reorder = FrameReorderBuffer();
|
||||
|
||||
Isolate? _isolate;
|
||||
SendPort? _toWorker;
|
||||
ReceivePort? _fromWorker;
|
||||
Completer<void>? _ready;
|
||||
bool _closed = false;
|
||||
|
||||
@override
|
||||
Stream<DecodedFrame> get results => _controller.stream;
|
||||
|
||||
@override
|
||||
Future<void> start() async {
|
||||
if (_isolate != null || _closed) return;
|
||||
final ready = Completer<void>();
|
||||
_ready = ready;
|
||||
final fromWorker = ReceivePort();
|
||||
_fromWorker = fromWorker;
|
||||
fromWorker.listen(_onWorkerMessage);
|
||||
_isolate = await Isolate.spawn(_gatewayEntry, fromWorker.sendPort);
|
||||
await ready.future;
|
||||
}
|
||||
|
||||
void _onWorkerMessage(dynamic message) {
|
||||
if (message is SendPort) {
|
||||
_toWorker = message;
|
||||
_ready?.complete();
|
||||
_ready = null;
|
||||
return;
|
||||
}
|
||||
if (message is List) {
|
||||
final decoded = DecodedFrame(
|
||||
seq: message[0] as int,
|
||||
typeName: message[1] as String,
|
||||
data: (message[2] as List).cast<int>(),
|
||||
incomingNonce: message[3] as int,
|
||||
responseNonce: message[4] as int,
|
||||
);
|
||||
for (final ready in _reorder.release(decoded)) {
|
||||
if (!_controller.isClosed) _controller.add(ready);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void submit(InboundFrame frame) {
|
||||
if (_closed) return;
|
||||
_toWorker?.send([frame.seq, frame.bytes]);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> close() async {
|
||||
if (_closed) return;
|
||||
_closed = true;
|
||||
_toWorker = null;
|
||||
_isolate?.kill(priority: Isolate.immediate);
|
||||
_isolate = null;
|
||||
_fromWorker?.close();
|
||||
_fromWorker = null;
|
||||
await _controller.close();
|
||||
}
|
||||
}
|
||||
|
||||
/// Isolate entry point: decodes [PacketBase] envelopes and returns fields.
|
||||
///
|
||||
/// Runs only pure decode work. The first message back is the worker's
|
||||
/// [SendPort]; subsequent messages are `[seq, bytes]` decode requests.
|
||||
void _gatewayEntry(SendPort toMain) {
|
||||
final fromMain = ReceivePort();
|
||||
toMain.send(fromMain.sendPort);
|
||||
fromMain.listen((dynamic message) {
|
||||
if (message == null) {
|
||||
fromMain.close();
|
||||
return;
|
||||
}
|
||||
final request = message as List;
|
||||
final seq = request[0] as int;
|
||||
final bytes = (request[1] as List).cast<int>();
|
||||
final common = PacketBase.fromBuffer(bytes);
|
||||
toMain.send([
|
||||
seq,
|
||||
common.typeName,
|
||||
common.data,
|
||||
common.nonce,
|
||||
common.responseNonce,
|
||||
]);
|
||||
});
|
||||
}
|
||||
12
dart/lib/src/inbound_gateway_web.dart
Normal file
12
dart/lib/src/inbound_gateway_web.dart
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import 'inbound_gateway.dart';
|
||||
|
||||
/// Web fallback for [IsolateInboundGateway].
|
||||
///
|
||||
/// Worker isolates (`dart:isolate` spawn) are unavailable on web targets, so
|
||||
/// this stub decodes synchronously in-process via [SyncInboundGateway] while
|
||||
/// preserving the same `seq`-ordered [InboundGateway] contract. This keeps the
|
||||
/// `dart.library.html` conditional export building without pulling `dart:io`
|
||||
/// or `dart:isolate` into the web bundle.
|
||||
class IsolateInboundGateway extends SyncInboundGateway {
|
||||
IsolateInboundGateway();
|
||||
}
|
||||
|
|
@ -1,7 +1,15 @@
|
|||
import 'package:proto_socket/proto_socket.dart';
|
||||
|
||||
void main() {
|
||||
final types = <Type>[WsProtobufClient, PacketBase, Transport];
|
||||
final types = <Type>[
|
||||
WsProtobufClient,
|
||||
PacketBase,
|
||||
Transport,
|
||||
// Anchors that the IO worker gateway's conditional export resolves to a
|
||||
// web-safe stub without pulling dart:io / dart:isolate into the web build.
|
||||
InboundGateway,
|
||||
IsolateInboundGateway,
|
||||
];
|
||||
if (types.isEmpty) {
|
||||
throw StateError('unreachable');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,22 @@ class _FakeCommunicator extends Communicator {
|
|||
void setNonceForTest(int value) {
|
||||
nonce = value;
|
||||
}
|
||||
|
||||
void attachGatewayForTest(InboundGateway gateway) =>
|
||||
attachInboundGateway(gateway);
|
||||
|
||||
Future<void> receiveFrameForTest(List<int> frame) => onReceivedFrame(frame);
|
||||
}
|
||||
|
||||
/// Builds a raw `PacketBase` frame buffer carrying a `TestData` payload.
|
||||
List<int> _frameBytes(int index,
|
||||
{int incomingNonce = 0, int responseNonce = 0}) {
|
||||
return (PacketBase()
|
||||
..typeName = TestData.getDefault().info_.qualifiedMessageName
|
||||
..nonce = incomingNonce
|
||||
..responseNonce = responseNonce
|
||||
..data = (TestData()..index = index).writeToBuffer())
|
||||
.writeToBuffer();
|
||||
}
|
||||
|
||||
class _FakeTransport implements Transport {
|
||||
|
|
@ -465,6 +481,88 @@ void main() {
|
|||
|
||||
expect(received, [1, 2]);
|
||||
});
|
||||
|
||||
test('FrameReorderBuffer: out-of-order seq를 입력 순서로 release한다', () {
|
||||
final buffer = FrameReorderBuffer();
|
||||
DecodedFrame frame(int seq) => DecodedFrame(
|
||||
seq: seq,
|
||||
typeName: 'T',
|
||||
data: const [],
|
||||
incomingNonce: seq,
|
||||
responseNonce: 0,
|
||||
);
|
||||
|
||||
// seq=2가 먼저 도착하면 아직 release되지 않는다.
|
||||
expect(buffer.release(frame(2)), isEmpty);
|
||||
// seq=1 도착 시 1, 2가 순서대로 release된다.
|
||||
expect(buffer.release(frame(1)).map((f) => f.seq), [1, 2]);
|
||||
// 이어지는 seq=3은 즉시 release된다.
|
||||
expect(buffer.release(frame(3)).map((f) => f.seq), [3]);
|
||||
// 이미 release된 seq는 중복 emit하지 않는다.
|
||||
expect(buffer.release(frame(1)), isEmpty);
|
||||
});
|
||||
|
||||
test('SyncInboundGateway: onReceivedFrame이 디코드 후 입력 순서로 dispatch한다',
|
||||
() async {
|
||||
final communicator = _FakeCommunicator();
|
||||
final received = <int>[];
|
||||
communicator.addListener<TestData>((data) => received.add(data.index));
|
||||
communicator.attachGatewayForTest(SyncInboundGateway());
|
||||
|
||||
for (var i = 1; i <= 5; i++) {
|
||||
await communicator.receiveFrameForTest(_frameBytes(i, incomingNonce: i));
|
||||
}
|
||||
|
||||
for (var i = 0; i < 40; i++) {
|
||||
if (received.length == 5) break;
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
}
|
||||
|
||||
expect(received, [1, 2, 3, 4, 5]);
|
||||
await communicator.close();
|
||||
});
|
||||
|
||||
test('SyncInboundGateway: responseNonce 프레임이 pending sendRequest를 완료한다',
|
||||
() async {
|
||||
final communicator = _FakeCommunicator();
|
||||
communicator.attachGatewayForTest(SyncInboundGateway());
|
||||
|
||||
final future = communicator.sendRequest<TestData, TestData>(
|
||||
TestData()..index = 1,
|
||||
);
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
final requestNonce = communicator.transport.sentPackets.single.nonce;
|
||||
|
||||
await communicator.receiveFrameForTest(
|
||||
_frameBytes(2, incomingNonce: 999, responseNonce: requestNonce),
|
||||
);
|
||||
|
||||
expect((await future).index, 2);
|
||||
await communicator.close();
|
||||
});
|
||||
|
||||
test('IsolateInboundGateway: 상시 isolate 디코드 후 수신/응답 순서가 유지된다',
|
||||
() async {
|
||||
final communicator = _FakeCommunicator();
|
||||
final received = <int>[];
|
||||
communicator.addListener<TestData>((data) => received.add(data.index));
|
||||
|
||||
final gateway = IsolateInboundGateway();
|
||||
await gateway.start();
|
||||
communicator.attachGatewayForTest(gateway);
|
||||
|
||||
for (var i = 1; i <= 5; i++) {
|
||||
await communicator.receiveFrameForTest(_frameBytes(i, incomingNonce: i));
|
||||
}
|
||||
|
||||
for (var i = 0; i < 200; i++) {
|
||||
if (received.length == 5) break;
|
||||
await Future<void>.delayed(const Duration(milliseconds: 5));
|
||||
}
|
||||
|
||||
expect(received, [1, 2, 3, 4, 5]);
|
||||
await communicator.close();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue