update: protocol evolution compatibility roadmap and communicator tests across languages
This commit is contained in:
parent
b1caa8aaba
commit
6c1cf96c00
12 changed files with 591 additions and 9 deletions
|
|
@ -50,8 +50,8 @@
|
||||||
wire message identity를 full proto name으로 정렬하고, legacy simple name 수신 호환성을 유지한다.
|
wire message identity를 full proto name으로 정렬하고, legacy simple name 수신 호환성을 유지한다.
|
||||||
|
|
||||||
- [x] [pkg-rule] Proto package naming rule을 `PROTOCOL.md`, `VERSIONING.md`, `PORTING_GUIDE.md`에 문서화한다. package는 lowercase snake_case segment를 dot으로 연결한 형태만 허용하고, 언어별 namespace/package option은 wire identity와 분리한다. common proto의 package는 `proto_socket`으로 둔다.
|
- [x] [pkg-rule] Proto package naming rule을 `PROTOCOL.md`, `VERSIONING.md`, `PORTING_GUIDE.md`에 문서화한다. package는 lowercase snake_case segment를 dot으로 연결한 형태만 허용하고, 언어별 namespace/package option은 wire identity와 분리한다. common proto의 package는 `proto_socket`으로 둔다.
|
||||||
- [ ] [proto-package-sync] Canonical `proto/message_common.proto`에 `package proto_socket;`을 추가하고 언어별 proto copy와 generated binding을 동기화한다. 검증: `tools/check_proto_sync.sh`
|
- [x] [proto-package-sync] Canonical `proto/message_common.proto`에 `package proto_socket;`을 추가하고 언어별 proto copy와 generated binding을 동기화한다. 검증: `tools/check_proto_sync.sh`
|
||||||
- [ ] [fullname-type] 각 사용 가능 언어의 `typeNameOf()` 또는 message metadata를 full proto name 기준으로 정렬한다. descriptor/native metadata를 우선 사용하되, Python은 `DESCRIPTOR.full_name`, TypeScript는 static metadata를 사용한다. common proto의 기대값은 `proto_socket.<MessageName>`이다.
|
- [x] [fullname-type] 각 사용 가능 언어의 `typeNameOf()` 또는 message metadata를 full proto name 기준으로 정렬한다. descriptor/native metadata를 우선 사용하되, Python은 `DESCRIPTOR.full_name`, TypeScript는 static metadata를 사용한다. common proto의 기대값은 `proto_socket.<MessageName>`이다.
|
||||||
- [ ] [legacy-alias] 수신 type registry에 full name과 simple name alias를 함께 등록하되, parser lookup, listener/request handler routing, response type matching, pending expected type 비교가 같은 alias 규칙을 사용하게 한다. simple alias 충돌 시 초기화 실패로 처리한다.
|
- [ ] [legacy-alias] 수신 type registry에 full name과 simple name alias를 함께 등록하되, parser lookup, listener/request handler routing, response type matching, pending expected type 비교가 같은 alias 규칙을 사용하게 한다. simple alias 충돌 시 초기화 실패로 처리한다.
|
||||||
- [ ] [fullname-tests] full name 송수신, simple name legacy 수신, request/response alias 호환, alias 충돌 감지에 대한 동일 언어 및 크로스 언어 테스트를 추가한다. 검증: `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`
|
- [ ] [fullname-tests] full name 송수신, simple name legacy 수신, request/response alias 호환, alias 충돌 감지에 대한 동일 언어 및 크로스 언어 테스트를 추가한다. 검증: `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`
|
||||||
|
|
||||||
|
|
@ -90,3 +90,4 @@ wire message identity를 full proto name으로 정렬하고, legacy simple name
|
||||||
- 선행 작업: 프로토콜 기준선
|
- 선행 작업: 프로토콜 기준선
|
||||||
- 후속 작업: 필요 시 protocol `0.2` 또는 `1.0` compatibility release planning
|
- 후속 작업: 필요 시 protocol `0.2` 또는 `1.0` compatibility release planning
|
||||||
- 확인 필요: 없음
|
- 확인 필요: 없음
|
||||||
|
- 작업 현황 동기화(2026-06-16): `01_proto_fullname_foundation` PASS 완료로 `proto-package-sync`, `fullname-type` 반영 완료. `02+01_legacy_alias`는 1차 리뷰 FAIL 후 `agent-task/m-protocol-evolution-compatibility/02+01_legacy_alias/PLAN-cloud-G07.md` 후속 루프 진행 중이며 `legacy-alias`는 미완료. `03+01,02_fullname_tests`는 `02+01_legacy_alias` complete.log가 필요하므로 대기 상태.
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,15 @@ task=m-protocol-evolution-compatibility/02+01_legacy_alias, plan=0, tag=ALIAS
|
||||||
|
|
||||||
## 코드리뷰 전용 체크리스트
|
## 코드리뷰 전용 체크리스트
|
||||||
|
|
||||||
- [ ] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
|
- [x] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
|
||||||
- [ ] active files를 `.log`로 아카이브하고 PASS이면 `complete.log`를 작성한다.
|
- [x] 판정과 `차원별 평가`, Required/Suggested/Nit 분류가 서로 일치한다.
|
||||||
|
- [x] active `CODE_REVIEW-cloud-G07.md`를 `code_review_cloud_G07_0.log`로 아카이브한다.
|
||||||
|
- [x] active `PLAN-cloud-G07.md`를 `plan_cloud_G07_0.log`로 아카이브한다.
|
||||||
|
- [x] `.gitignore`의 Agent-Ops 관리 block이 `agent-task/**/*.md`와 `agent-task/**/*.log`를 unignore하고 `agent-roadmap/current.md`를 ignore하는지 확인한다.
|
||||||
- [ ] PASS이면 active task directory를 archive로 이동한다.
|
- [ ] PASS이면 active task directory를 archive로 이동한다.
|
||||||
- [ ] PASS split 작업이면 dependency와 parent directory 상태를 확인한다.
|
- [ ] PASS split 작업이면 dependency와 parent directory 상태를 확인한다.
|
||||||
- [ ] roadmap 수정이나 `update-roadmap` 직접 호출을 하지 않는다.
|
- [x] FAIL이고 user-review gate가 트리거되지 않았으므로 다음 active `PLAN-cloud-G07.md`와 `CODE_REVIEW-cloud-G07.md`를 작성하고 `complete.log`를 작성하지 않는다.
|
||||||
|
- [x] roadmap 수정이나 `update-roadmap` 직접 호출을 하지 않는다.
|
||||||
|
|
||||||
## 계획 대비 변경 사항
|
## 계획 대비 변경 사항
|
||||||
|
|
||||||
|
|
@ -135,3 +139,28 @@ $ bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.
|
||||||
---
|
---
|
||||||
|
|
||||||
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Yes, all implementation-owned sections have been fully completed with verification outputs and architecture explanations.
|
> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section?** Yes, all implementation-owned sections have been fully completed with verification outputs and architecture explanations.
|
||||||
|
|
||||||
|
## 코드리뷰 결과
|
||||||
|
|
||||||
|
- 종합 판정: FAIL
|
||||||
|
|
||||||
|
### 차원별 평가
|
||||||
|
|
||||||
|
| 차원 | 평가 | 근거 |
|
||||||
|
|---|---|---|
|
||||||
|
| correctness | Fail | Python process gateway 경로에서 legacy simple-name alias가 parser lookup에 적용되지 않아 수신 프레임이 drop된다. |
|
||||||
|
| completeness | Fail | ALIAS-2의 request handler alias 테스트 요구가 각 언어 focused unit test에 반영되지 않았다. |
|
||||||
|
| test coverage | Fail | listener/pending response alias는 검증하지만 request handler alias와 Python process gateway alias 회귀 테스트가 없다. |
|
||||||
|
| API contract | Fail | legacy simple-name 수신 호환성이 gateway 설정에 따라 달라져 alias 계약이 일관되지 않다. |
|
||||||
|
| code quality | Pass | 확인한 변경 범위에서 debug print, dead code, unrelated formatting churn은 발견하지 못했다. |
|
||||||
|
| plan deviation | Fail | 계획의 "parser, handler, listener, pending expected type 비교에 같은 canonical value" 및 request handler 테스트 요구를 완전히 충족하지 못했다. |
|
||||||
|
| verification trust | Fail | 보고된 전체 매트릭스는 통과했지만, 리뷰 중 실행한 targeted Python process gateway simple-alias 재현 명령이 `FAIL TimeoutError`로 실패했다. |
|
||||||
|
|
||||||
|
### 발견된 문제
|
||||||
|
|
||||||
|
- Required: `python/proto_socket/communicator.py:472`에서 process gateway decode용 `parser_cls`를 `self._parser_cls_map.get(type_name)`으로 조회한다. `_parser_cls_map`은 initialize 시 canonical key(`proto_socket.TestData`)로 채워지므로 wire type이 legacy simple name(`TestData`)이면 parser class를 찾지 못하고 `process decode failed`가 되어 listener/request dispatch까지 도달하지 않는다. 수정: process gateway 분기에서 `canonical = self._canonicalize(type_name)`로 정규화한 뒤 `_parser_cls_map.get(canonical)`을 조회하고, `gateway_type="process"`, 낮은 `payload_size_threshold`, incoming `"TestData"` 프레임으로 listener 또는 request handler가 호출되는 회귀 테스트를 추가한다.
|
||||||
|
- Required: `agent-task/m-protocol-evolution-compatibility/02+01_legacy_alias/plan_cloud_G07_0.log:139`는 "request handler가 full name으로 등록되어도 incoming simple name을 처리"하는 unit test를 요구하지만, 현재 alias 테스트들은 `dart/test/communicator_test.dart:838`, `go/test/communicator_test.go:713`, `kotlin/src/test/kotlin/com/tokilabs/proto_socket/CommunicatorTest.kt:700`, `python/test/test_communicator.py:611`, `typescript/test/communicator.test.ts:746`에서 listener routing과 pending response matching만 검증한다. 수정: 5개 언어 focused communicator test에 full-name request handler 등록 후 simple `"TestData"` inbound request가 handler를 호출하고 canonical/full-name response를 쓰는 케이스를 추가한다.
|
||||||
|
|
||||||
|
### 다음 단계
|
||||||
|
|
||||||
|
- FAIL follow-up: 위 Required 항목을 해결하는 다음 active `PLAN-cloud-G07.md`와 `CODE_REVIEW-cloud-G07.md`를 작성한다. USER_REVIEW 게이트 대상은 아니다.
|
||||||
|
|
@ -0,0 +1,222 @@
|
||||||
|
<!-- task=m-protocol-evolution-compatibility/02+01_legacy_alias plan=1 tag=REVIEW_ALIAS -->
|
||||||
|
|
||||||
|
# Code Review Reference - REVIEW_ALIAS
|
||||||
|
|
||||||
|
> **[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-16
|
||||||
|
task=m-protocol-evolution-compatibility/02+01_legacy_alias, plan=1, tag=REVIEW_ALIAS
|
||||||
|
|
||||||
|
## Roadmap Targets
|
||||||
|
|
||||||
|
- Milestone: `agent-roadmap/milestones/protocol-evolution-compatibility.md`
|
||||||
|
- Task ids:
|
||||||
|
- `legacy-alias`: parser lookup, listener/request handler routing, response type matching, pending expected type 비교에 동일 alias 규칙 적용
|
||||||
|
- Completion mode: check-on-pass
|
||||||
|
|
||||||
|
## 이 파일을 읽는 리뷰 에이전트에게
|
||||||
|
|
||||||
|
> **[REVIEW AGENT ONLY]** 아래 종결 절차는 코드리뷰 에이전트 전용이다. 구현 에이전트는 이 섹션을 실행하지 않는다.
|
||||||
|
|
||||||
|
각 항목의 구현을 실제 소스 파일과 대조하고, `검증 결과` 섹션의 출력이 코드와 일치하는지 확인하세요.
|
||||||
|
리뷰 완료는 아래 순서까지 끝난 상태를 의미합니다.
|
||||||
|
|
||||||
|
1. 판정을 append한다.
|
||||||
|
2. `CODE_REVIEW-cloud-G07.md` -> `code_review_cloud_G07_N.log`, `PLAN-cloud-G07.md` -> `plan_cloud_G07_M.log`로 아카이브한다.
|
||||||
|
3. PASS이면 `complete.log` 작성 후 active task 디렉터리를 `agent-task/archive/YYYY/MM/m-protocol-evolution-compatibility/02+01_legacy_alias/`로 이동한다. WARN/FAIL이면 user-review gate를 확인한 뒤 다음 active plan/review 파일 또는 `USER_REVIEW.md`를 작성한다.
|
||||||
|
4. PASS이고 task group이 `m-protocol-evolution-compatibility`이므로 완료 이벤트 메타데이터를 보고한다. roadmap 상태 체크와 `update-roadmap` 호출은 런타임 책임이다.
|
||||||
|
5. 적용 가능한 `코드리뷰 전용 체크리스트` 항목을 최종 `.log` 위치에서 체크한 뒤 보고한다.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 구현 항목별 완료 여부
|
||||||
|
|
||||||
|
| 항목 | 완료 여부 |
|
||||||
|
|------|---------|
|
||||||
|
| [REVIEW_ALIAS-1] Python Process Gateway Alias Lookup | [x] |
|
||||||
|
| [REVIEW_ALIAS-2] Request Handler Alias Regression Tests | [x] |
|
||||||
|
|
||||||
|
## 구현 체크리스트
|
||||||
|
|
||||||
|
- [x] Python process gateway에서 parser class lookup 전에 wire type을 canonicalize하고 legacy simple-name frame이 gateway path에서도 dispatch되게 한다.
|
||||||
|
- [x] Python process gateway legacy simple-name regression test를 추가한다.
|
||||||
|
- [x] Dart/Go/Kotlin/Python/TypeScript focused communicator test에 full-name request handler 등록 + simple-name inbound request 케이스를 추가한다.
|
||||||
|
- [x] focused unit tests와 전체 matrix를 실행하고 실제 stdout/stderr를 기록한다.
|
||||||
|
- [x] CODE_REVIEW-cloud-G07.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다.
|
||||||
|
|
||||||
|
## 코드리뷰 전용 체크리스트
|
||||||
|
|
||||||
|
> **[REVIEW AGENT ONLY]** 이 체크리스트는 코드리뷰 에이전트만 사용한다.
|
||||||
|
> 구현 에이전트는 이 섹션을 수정하거나 체크하지 않는다.
|
||||||
|
|
||||||
|
- [x] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다.
|
||||||
|
- [x] 판정과 `차원별 평가`, Required/Suggested/Nit 분류가 서로 일치한다.
|
||||||
|
- [x] active `CODE_REVIEW-*-G??.md`를 `code_review_cloud_G07_1.log`로 아카이브한다.
|
||||||
|
- [x] active `PLAN-*-G??.md`를 `plan_cloud_G07_1.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/{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로 이동한다.
|
||||||
|
|
||||||
|
## 계획 대비 변경 사항
|
||||||
|
|
||||||
|
없음. 계획에 명시된 방법과 파일 목록 그대로 구현했다.
|
||||||
|
|
||||||
|
## 주요 설계 결정
|
||||||
|
|
||||||
|
- **REVIEW_ALIAS-1 수정 범위**: `python/proto_socket/communicator.py:472`의 `parser_cls = self._parser_cls_map.get(type_name)` 한 줄만 수정했다. `canonical = self._canonicalize(type_name)` 변수를 그 위에 추가하고 lookup에 사용했다. asyncio/inline 게이트웨이 경로는 이미 `_parse()` 내부에서 canonicalize를 수행하므로 건드리지 않았다.
|
||||||
|
- **Python request handler 테스트 시그니처**: `add_request_listener` 핸들러는 `(req, nonce)` 두 인자를 받으므로 `echo_handler(req, nonce)` 시그니처로 작성했다.
|
||||||
|
- **PacketBase.responseNonce 필드명**: Python에서 `response.response_nonce`가 아니라 `response.responseNonce`임을 실행 실패로 확인하고 즉시 수정했다.
|
||||||
|
|
||||||
|
## 사용자 리뷰 요청
|
||||||
|
|
||||||
|
_기본값은 `없음`이다. 구현 중 사용자 결정, 사용자 소유 외부 환경/secret/서비스 준비, 또는 계획 범위 변경 없이는 안전하게 진행할 수 없으면 아래 항목을 실제 내용으로 교체하고, 구현을 중단한 뒤 active 파일을 그대로 둔 채 리뷰를 요청한다. 구현 에이전트는 사용자에게 직접 질문하거나 선택지를 제시하거나 `request_user_input`을 호출하지 않는다. 후속 에이전트가 명령 재실행이나 산출물 수집으로 해소할 수 있는 검증 증거 공백만으로는 사용자 리뷰 요청을 작성하지 않는다._
|
||||||
|
|
||||||
|
- 상태: 없음
|
||||||
|
- 사유 유형: 없음
|
||||||
|
- 결정 필요: 없음
|
||||||
|
- 차단 근거: 없음
|
||||||
|
- 실행한 검증/명령: 없음
|
||||||
|
- 자동 후속 불가 이유: 없음
|
||||||
|
- 재개 조건: 없음
|
||||||
|
|
||||||
|
## 리뷰어를 위한 체크포인트
|
||||||
|
|
||||||
|
- Python process gateway가 `_parser_cls_map`을 canonical key로 조회하는지 확인한다.
|
||||||
|
- Python simple-name frame이 process gateway path에서도 listener 또는 request handler까지 도달하는지 확인한다.
|
||||||
|
- 5개 언어 alias regression에 request handler full-name 등록 + simple-name inbound request 케이스가 포함되어 있는지 확인한다.
|
||||||
|
- 전체 매트릭스 PASS가 새 focused regression을 포함한 상태에서 나온 결과인지 확인한다.
|
||||||
|
|
||||||
|
## 검증 결과
|
||||||
|
|
||||||
|
_구현 에이전트가 각 중간 검증 및 최종 검증 명령 실행 후 출력을 여기에 붙여 넣는다._
|
||||||
|
|
||||||
|
필수 규칙:
|
||||||
|
- 검증 명령은 고정된 계약이다. 임의로 대체하지 않는다.
|
||||||
|
- 대체가 필요하면 `계획 대비 변경 사항`에 이유와 대체 명령을 기록한다.
|
||||||
|
- `검증 결과`에는 실제 stdout/stderr를 붙여 넣는다.
|
||||||
|
- 사용자 리뷰 요청으로 명령을 끝까지 실행하지 못했다면 `사용자 리뷰 요청`에 실행한 명령, 실제 출력, 미실행 명령의 사유를 기록한다.
|
||||||
|
|
||||||
|
### REVIEW_ALIAS-1 중간 검증
|
||||||
|
```bash
|
||||||
|
$ cd python && python3 -m pytest -q test/test_communicator.py
|
||||||
|
........................
|
||||||
|
24 passed in 0.70s
|
||||||
|
```
|
||||||
|
|
||||||
|
### REVIEW_ALIAS-2 중간 검증
|
||||||
|
```bash
|
||||||
|
$ dart test test/communicator_test.dart
|
||||||
|
00:00 +31: All tests passed!
|
||||||
|
|
||||||
|
$ go test -count=1 -v ./test/... (alias 관련 항목만 발췌)
|
||||||
|
=== RUN TestAliasCollisionOnInit
|
||||||
|
--- PASS: TestAliasCollisionOnInit (0.00s)
|
||||||
|
=== RUN TestLegacyAliasRouting
|
||||||
|
--- PASS: TestLegacyAliasRouting (0.00s)
|
||||||
|
=== RUN TestRequestHandlerAliasSimpleNameInbound
|
||||||
|
--- PASS: TestRequestHandlerAliasSimpleNameInbound (0.00s)
|
||||||
|
ok git.toki-labs.com/toki/proto-socket/go/test 8.322s
|
||||||
|
|
||||||
|
$ cd kotlin && ./gradlew test
|
||||||
|
BUILD SUCCESSFUL in 23s
|
||||||
|
11 actionable tasks: 3 executed, 8 up-to-date
|
||||||
|
|
||||||
|
$ cd python && python3 -m pytest -q
|
||||||
|
........................
|
||||||
|
24 passed in 0.70s
|
||||||
|
|
||||||
|
$ cd typescript && npm run check && npm test
|
||||||
|
✓ test/communicator.test.ts (33 tests) 521ms
|
||||||
|
Test Files 5 passed (5)
|
||||||
|
Tests 66 passed (66)
|
||||||
|
```
|
||||||
|
|
||||||
|
### 최종 검증
|
||||||
|
```bash
|
||||||
|
$ 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 | `dart pub get && dart test && dart compile js ...` | PASS |
|
||||||
|
| Go | `go test ./...` | PASS |
|
||||||
|
| Kotlin | `./gradlew test` | PASS |
|
||||||
|
| Python | `python3 -m pytest -q` | PASS |
|
||||||
|
| TypeScript | `npm run check && npm test` | PASS |
|
||||||
|
|
||||||
|
**언어 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 |
|
||||||
|
|
||||||
|
**크로스테스트 상세** (전 방향 PASS scenarios 16/16, Dart.web 2/2)
|
||||||
|
결과 기록: `agent-test/runs/20260616-055155-proto-socket-full-matrix.md`
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> **[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 | Python process gateway lookup이 canonical key를 사용하도록 수정되었고, 리뷰 재현 명령이 `PASS received index=42`로 통과했다. |
|
||||||
|
| completeness | Pass | REVIEW_ALIAS-1/2 계획 항목과 구현 체크리스트가 모두 충족됐다. |
|
||||||
|
| test coverage | Pass | Python process gateway legacy simple-name regression과 5개 언어 request-handler alias regression이 추가됐다. |
|
||||||
|
| API contract | Pass | full-name 등록 handler/listener/pending matching이 simple-name inbound를 같은 alias 규칙으로 처리한다. |
|
||||||
|
| code quality | Pass | 변경이 결함 지점과 focused tests에 제한되어 있고 debug print, dead code, unrelated churn은 발견하지 못했다. |
|
||||||
|
| plan deviation | Pass | 계획 파일의 수정 범위와 검증 명령을 벗어난 구현 변경은 발견하지 못했다. |
|
||||||
|
| verification trust | Pass | `python3 -m pytest -q test/test_communicator.py`를 리뷰 중 재실행해 PASS를 확인했고, full matrix record도 PASS로 존재한다. |
|
||||||
|
|
||||||
|
### 발견된 문제
|
||||||
|
|
||||||
|
- 없음
|
||||||
|
|
||||||
|
### 다음 단계
|
||||||
|
|
||||||
|
- PASS: `complete.log`를 작성하고 task directory를 archive로 이동한다. milestone 갱신은 런타임 완료 이벤트 책임이다.
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
# Complete - m-protocol-evolution-compatibility/02+01_legacy_alias
|
||||||
|
|
||||||
|
## 완료 일시
|
||||||
|
|
||||||
|
2026-06-16T06:00:31Z
|
||||||
|
|
||||||
|
## 요약
|
||||||
|
|
||||||
|
REVIEW_ALIAS follow-up completed with PASS after 2 review loops; legacy alias request-handler coverage and Python process gateway alias lookup are implemented and verified.
|
||||||
|
|
||||||
|
## 루프 이력
|
||||||
|
|
||||||
|
| Plan | Review | Verdict | 메모 |
|
||||||
|
|------|--------|---------|------|
|
||||||
|
| `plan_cloud_G07_0.log` | `code_review_cloud_G07_0.log` | FAIL | Python process gateway simple-name alias drop과 request-handler alias regression test 누락 Required 2건. |
|
||||||
|
| `plan_cloud_G07_1.log` | `code_review_cloud_G07_1.log` | PASS | Required/Suggested issues 없음; targeted Python 재현과 full matrix record PASS 확인. |
|
||||||
|
|
||||||
|
## 구현/정리 내용
|
||||||
|
|
||||||
|
- Python process gateway parser class lookup이 raw wire type 대신 canonical type name을 사용하도록 수정했다.
|
||||||
|
- Python process gateway legacy simple-name listener regression test를 추가했다.
|
||||||
|
- Dart, Go, Kotlin, Python, TypeScript communicator tests에 full-name request handler 등록 후 simple-name inbound request 처리 regression을 추가했다.
|
||||||
|
|
||||||
|
## 최종 검증
|
||||||
|
|
||||||
|
- `python3 -m pytest -q test/test_communicator.py` - PASS; 리뷰 중 재실행 결과 `24 passed in 0.70s`.
|
||||||
|
- Python process gateway simple-name targeted reproduction - PASS; 리뷰 중 재실행 결과 `PASS received index=42`.
|
||||||
|
- `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all` - PASS; result record `agent-test/runs/20260616-055155-proto-socket-full-matrix.md`.
|
||||||
|
|
||||||
|
## Roadmap Completion
|
||||||
|
|
||||||
|
- Milestone: `agent-roadmap/milestones/protocol-evolution-compatibility.md`
|
||||||
|
- Completed task ids:
|
||||||
|
- `legacy-alias`: PASS; evidence=`agent-task/archive/2026/06/m-protocol-evolution-compatibility/02+01_legacy_alias/plan_cloud_G07_1.log`, `agent-task/archive/2026/06/m-protocol-evolution-compatibility/02+01_legacy_alias/code_review_cloud_G07_1.log`; verification=`python3 -m pytest -q test/test_communicator.py`, `bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all`
|
||||||
|
- Not completed task ids: 없음
|
||||||
|
|
||||||
|
## 잔여 Nit
|
||||||
|
|
||||||
|
- 없음
|
||||||
|
|
||||||
|
## 후속 작업
|
||||||
|
|
||||||
|
- 없음
|
||||||
|
|
@ -0,0 +1,133 @@
|
||||||
|
<!-- task=m-protocol-evolution-compatibility/02+01_legacy_alias plan=1 tag=REVIEW_ALIAS -->
|
||||||
|
|
||||||
|
# Plan - REVIEW_ALIAS
|
||||||
|
|
||||||
|
## 이 파일을 읽는 구현 에이전트에게
|
||||||
|
|
||||||
|
이 plan은 `ALIAS` 1차 리뷰의 Required 이슈만 해결한다. 구현 중 사용자에게 직접 질문하거나 선택지를 제시하지 않는다. 사용자만 결정할 수 있는 blocker가 있으면 active `CODE_REVIEW-cloud-G07.md`의 `사용자 리뷰 요청` 섹션에 근거와 재개 조건을 기록하고 중단한다.
|
||||||
|
|
||||||
|
## Roadmap Targets
|
||||||
|
|
||||||
|
- Milestone: `agent-roadmap/milestones/protocol-evolution-compatibility.md`
|
||||||
|
- Task ids:
|
||||||
|
- `legacy-alias`: parser lookup, listener/request handler routing, response type matching, pending expected type 비교에 동일 alias 규칙 적용
|
||||||
|
- Completion mode: check-on-pass
|
||||||
|
|
||||||
|
## 리뷰 근거
|
||||||
|
|
||||||
|
보관된 리뷰: `code_review_cloud_G07_0.log`
|
||||||
|
|
||||||
|
1차 리뷰 결과는 `FAIL`이다. Python process gateway가 simple alias wire type을 canonical parser class lookup에 반영하지 못해 drop되는 결함이 재현되었고, 계획이 요구한 request handler alias unit test가 5개 언어에서 빠져 있다.
|
||||||
|
|
||||||
|
재현 명령:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd python
|
||||||
|
python3 - <<'PY'
|
||||||
|
import asyncio
|
||||||
|
from proto_socket.communicator import Communicator, type_name_of
|
||||||
|
from proto_socket.packets.message_common_pb2 import PacketBase, TestData
|
||||||
|
|
||||||
|
class FakeTransport:
|
||||||
|
def __init__(self):
|
||||||
|
self.packets = []
|
||||||
|
async def write_packet(self, base: PacketBase):
|
||||||
|
self.packets.append(base)
|
||||||
|
async def close(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def parser_map():
|
||||||
|
return {type_name_of(TestData): TestData.FromString}
|
||||||
|
|
||||||
|
async def main():
|
||||||
|
c = Communicator()
|
||||||
|
c.initialize(FakeTransport(), parser_map(), gateway_type="process", payload_size_threshold=1)
|
||||||
|
loop = asyncio.get_running_loop()
|
||||||
|
received = loop.create_future()
|
||||||
|
c.add_listener(type_name_of(TestData), received.set_result)
|
||||||
|
msg = TestData(index=42, message="legacy alias via process gateway")
|
||||||
|
c.on_received_data("TestData", msg.SerializeToString(), 1, 0)
|
||||||
|
try:
|
||||||
|
result = await asyncio.wait_for(received, 1.0)
|
||||||
|
print(f"PASS received index={result.index}")
|
||||||
|
except Exception as exc:
|
||||||
|
print(f"FAIL {type(exc).__name__}: {exc}")
|
||||||
|
await c.close()
|
||||||
|
|
||||||
|
asyncio.run(main())
|
||||||
|
PY
|
||||||
|
```
|
||||||
|
|
||||||
|
관찰 출력:
|
||||||
|
|
||||||
|
```text
|
||||||
|
FAIL TimeoutError:
|
||||||
|
```
|
||||||
|
|
||||||
|
## 구현 체크리스트
|
||||||
|
|
||||||
|
- [ ] Python process gateway에서 parser class lookup 전에 wire type을 canonicalize하고 legacy simple-name frame이 gateway path에서도 dispatch되게 한다.
|
||||||
|
- [ ] Python process gateway legacy simple-name regression test를 추가한다.
|
||||||
|
- [ ] Dart/Go/Kotlin/Python/TypeScript focused communicator test에 full-name request handler 등록 + simple-name inbound request 케이스를 추가한다.
|
||||||
|
- [ ] focused unit tests와 전체 matrix를 실행하고 실제 stdout/stderr를 기록한다.
|
||||||
|
- [ ] CODE_REVIEW-cloud-G07.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다.
|
||||||
|
|
||||||
|
### [REVIEW_ALIAS-1] Python Process Gateway Alias Lookup
|
||||||
|
|
||||||
|
문제: `python/proto_socket/communicator.py:472`에서 process gateway decode용 parser class를 raw `type_name`으로 조회한다. `_parser_cls_map`은 canonical key로 채워지므로 incoming wire type이 `"TestData"`이면 parser class를 찾지 못한다.
|
||||||
|
|
||||||
|
해결 방법:
|
||||||
|
|
||||||
|
- process gateway 분기에서 `canonical = self._canonicalize(type_name)`로 정규화한 뒤 `_parser_cls_map.get(canonical)`을 사용한다.
|
||||||
|
- 기존 inline/asyncio gateway 경로의 `_parse()` canonical lookup 동작은 유지한다.
|
||||||
|
- `python/test/test_communicator.py`에 `gateway_type="process"`, 낮은 `payload_size_threshold`, incoming `"TestData"` frame이 listener 또는 request handler까지 도달하는 regression test를 추가한다.
|
||||||
|
|
||||||
|
중간 검증:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd python && python3 -m pytest -q test/test_communicator.py
|
||||||
|
```
|
||||||
|
|
||||||
|
### [REVIEW_ALIAS-2] Request Handler Alias Regression Tests
|
||||||
|
|
||||||
|
문제: `plan_cloud_G07_0.log`의 ALIAS-2는 request handler가 full name으로 등록되어도 incoming simple name을 처리하는 unit test를 요구했다. 현재 alias tests는 listener routing과 pending response matching만 확인한다.
|
||||||
|
|
||||||
|
해결 방법:
|
||||||
|
|
||||||
|
- `dart/test/communicator_test.dart`, `go/test/communicator_test.go`, `kotlin/src/test/kotlin/com/tokilabs/proto_socket/CommunicatorTest.kt`, `python/test/test_communicator.py`, `typescript/test/communicator.test.ts`에 focused request handler alias 케이스를 추가한다.
|
||||||
|
- 각 테스트는 full/canonical type helper로 request handler를 등록한 뒤, incoming `"TestData"` request frame을 넣고 handler 호출 및 response packet의 `responseNonce`/payload를 확인한다.
|
||||||
|
- 테스트 추가 중 실제 구현 결함이 드러나면 해당 언어 구현도 같은 canonical helper 규칙으로 수정한다.
|
||||||
|
|
||||||
|
중간 검증:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dart test test/communicator_test.dart
|
||||||
|
go test ./...
|
||||||
|
cd kotlin && ./gradlew test
|
||||||
|
cd python && python3 -m pytest -q
|
||||||
|
cd typescript && npm run check && npm test
|
||||||
|
```
|
||||||
|
|
||||||
|
## 수정 파일 예상
|
||||||
|
|
||||||
|
| 파일 | 항목 |
|
||||||
|
|---|---|
|
||||||
|
| `python/proto_socket/communicator.py` | REVIEW_ALIAS-1 |
|
||||||
|
| `python/test/test_communicator.py` | REVIEW_ALIAS-1, REVIEW_ALIAS-2 |
|
||||||
|
| `dart/test/communicator_test.dart` | REVIEW_ALIAS-2 |
|
||||||
|
| `go/test/communicator_test.go` | REVIEW_ALIAS-2 |
|
||||||
|
| `kotlin/src/test/kotlin/com/tokilabs/proto_socket/CommunicatorTest.kt` | REVIEW_ALIAS-2 |
|
||||||
|
| `typescript/test/communicator.test.ts` | REVIEW_ALIAS-2 |
|
||||||
|
|
||||||
|
## 최종 검증
|
||||||
|
|
||||||
|
```bash
|
||||||
|
dart test test/communicator_test.dart
|
||||||
|
go test ./...
|
||||||
|
cd kotlin && ./gradlew test
|
||||||
|
cd python && python3 -m pytest -q
|
||||||
|
cd typescript && npm run check && npm test
|
||||||
|
bash agent-ops/skills/project/run-proto-socket-test-matrix/scripts/run_matrix.sh --all
|
||||||
|
```
|
||||||
|
|
||||||
|
모든 코드 변경 완료 후 반드시 `CODE_REVIEW-cloud-G07.md`의 구현 에이전트 소유 섹션을 채운다.
|
||||||
|
|
@ -867,6 +867,28 @@ void main() {
|
||||||
expect(response.index, 42);
|
expect(response.index, 42);
|
||||||
communicator.closeForTest();
|
communicator.closeForTest();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Request handler registered with full name handles simple-name inbound request',
|
||||||
|
() async {
|
||||||
|
final communicator = _FakeCommunicator();
|
||||||
|
communicator.addRequestListener<TestData, TestData>((req) async {
|
||||||
|
return TestData()
|
||||||
|
..index = req.index + 1
|
||||||
|
..message = 'echo';
|
||||||
|
});
|
||||||
|
|
||||||
|
final reqBytes = (TestData()..index = 7..message = 'req').writeToBuffer();
|
||||||
|
communicator.onReceivedData('TestData', reqBytes, incomingNonce: 42);
|
||||||
|
|
||||||
|
await Future<void>.delayed(Duration.zero);
|
||||||
|
|
||||||
|
expect(communicator.transport.sentPackets.length, 1);
|
||||||
|
final packet = communicator.transport.sentPackets.single;
|
||||||
|
expect(packet.responseNonce, 42);
|
||||||
|
final payload = TestData.fromBuffer(packet.data);
|
||||||
|
expect(payload.index, 8);
|
||||||
|
communicator.closeForTest();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -776,3 +776,39 @@ func TestLegacyAliasRouting(t *testing.T) {
|
||||||
t.Fatalf("expected response Index 42, got %d", responseMsg.(*packets.TestData).Index)
|
t.Fatalf("expected response Index 42, got %d", responseMsg.(*packets.TestData).Index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestRequestHandlerAliasSimpleNameInbound(t *testing.T) {
|
||||||
|
transport := &fakeTransport{}
|
||||||
|
communicator := toki.NewCommunicator(transport, testParserMap())
|
||||||
|
defer communicator.Close()
|
||||||
|
|
||||||
|
toki.AddRequestListenerTyped[*packets.TestData, *packets.TestData](communicator, func(req *packets.TestData) (*packets.TestData, error) {
|
||||||
|
return &packets.TestData{Index: req.GetIndex() + 1, Message: "echo"}, nil
|
||||||
|
})
|
||||||
|
|
||||||
|
reqBytes, _ := proto.Marshal(&packets.TestData{Index: 7, Message: "req"})
|
||||||
|
communicator.OnReceivedData("TestData", reqBytes, 42, 0)
|
||||||
|
|
||||||
|
deadline := time.Now().Add(time.Second)
|
||||||
|
for time.Now().Before(deadline) {
|
||||||
|
if len(transport.sent()) >= 1 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
time.Sleep(time.Millisecond)
|
||||||
|
}
|
||||||
|
|
||||||
|
sent := transport.sent()
|
||||||
|
if len(sent) != 1 {
|
||||||
|
t.Fatalf("expected 1 response packet, got %d", len(sent))
|
||||||
|
}
|
||||||
|
if sent[0].GetResponseNonce() != 42 {
|
||||||
|
t.Errorf("expected responseNonce 42, got %d", sent[0].GetResponseNonce())
|
||||||
|
}
|
||||||
|
decoded := &packets.TestData{}
|
||||||
|
if err := proto.Unmarshal(sent[0].GetData(), decoded); err != nil {
|
||||||
|
t.Fatalf("failed to decode response payload: %v", err)
|
||||||
|
}
|
||||||
|
if decoded.GetIndex() != 8 {
|
||||||
|
t.Errorf("expected response index 8, got %d", decoded.GetIndex())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -738,4 +738,30 @@ class CommunicatorTest {
|
||||||
assertEquals(42, response.index)
|
assertEquals(42, response.index)
|
||||||
communicator.close()
|
communicator.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun testRequestHandlerAliasSimpleNameInbound() = runTest {
|
||||||
|
val transport = FakeTransport()
|
||||||
|
val communicator = Communicator(transport, testParserMap(), this)
|
||||||
|
|
||||||
|
addRequestListenerTyped<TestData, TestData>(communicator) { req ->
|
||||||
|
TestData.newBuilder().setIndex(req.index + 1).setMessage("echo").build()
|
||||||
|
}
|
||||||
|
|
||||||
|
val reqBytes = TestData.newBuilder().setIndex(7).setMessage("req").build().toByteArray()
|
||||||
|
communicator.onReceivedData("TestData", reqBytes, incomingNonce = 42)
|
||||||
|
|
||||||
|
var elapsed = 0
|
||||||
|
while (transport.packets.isEmpty() && elapsed < 1000) {
|
||||||
|
delay(5)
|
||||||
|
elapsed += 5
|
||||||
|
}
|
||||||
|
|
||||||
|
assertTrue(transport.packets.isNotEmpty(), "expected a response packet")
|
||||||
|
val packet = transport.packets.first()
|
||||||
|
assertEquals(42, packet.responseNonce, "responseNonce should be 42")
|
||||||
|
val payload = TestData.parseFrom(packet.data.toByteArray())
|
||||||
|
assertEquals(8, payload.index, "response index should be 8")
|
||||||
|
communicator.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -469,7 +469,8 @@ class Communicator:
|
||||||
else:
|
else:
|
||||||
if self._gateway_type == "process" and self._process_executor is not None:
|
if self._gateway_type == "process" and self._process_executor is not None:
|
||||||
loop = asyncio.get_running_loop()
|
loop = asyncio.get_running_loop()
|
||||||
parser_cls = self._parser_cls_map.get(type_name)
|
canonical = self._canonicalize(type_name)
|
||||||
|
parser_cls = self._parser_cls_map.get(canonical)
|
||||||
try:
|
try:
|
||||||
_, decoded_msg, is_success = await loop.run_in_executor(
|
_, decoded_msg, is_success = await loop.run_in_executor(
|
||||||
self._process_executor,
|
self._process_executor,
|
||||||
|
|
|
||||||
|
|
@ -640,3 +640,49 @@ async def test_legacy_alias_routing():
|
||||||
result2 = await task
|
result2 = await task
|
||||||
assert result2.index == 42
|
assert result2.index == 42
|
||||||
await communicator.close()
|
await communicator.close()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_process_gateway_legacy_simple_name():
|
||||||
|
"""process gateway path에서 simple-name wire type("TestData")이 listener까지 도달하는지 검증."""
|
||||||
|
transport = FakeTransport()
|
||||||
|
communicator = Communicator()
|
||||||
|
communicator.initialize(transport, parser_map(), gateway_type="process", payload_size_threshold=1)
|
||||||
|
|
||||||
|
received = asyncio.get_running_loop().create_future()
|
||||||
|
communicator.add_listener(type_name_of(ProtoTestData), received.set_result)
|
||||||
|
|
||||||
|
msg = ProtoTestData(index=42, message="legacy alias via process gateway")
|
||||||
|
communicator.on_received_data("TestData", msg.SerializeToString(), 1, 0)
|
||||||
|
|
||||||
|
result = await asyncio.wait_for(received, 2.0)
|
||||||
|
assert result.index == 42
|
||||||
|
await communicator.close()
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_request_handler_alias_simple_name_inbound():
|
||||||
|
"""full-name으로 등록된 request handler가 simple-name incoming request frame을 처리하는지 검증."""
|
||||||
|
transport = FakeTransport()
|
||||||
|
communicator = Communicator()
|
||||||
|
communicator.initialize(transport, parser_map())
|
||||||
|
|
||||||
|
async def echo_handler(req: ProtoTestData, nonce: int) -> ProtoTestData:
|
||||||
|
return ProtoTestData(index=req.index + 1, message="echo")
|
||||||
|
|
||||||
|
communicator.add_request_listener(type_name_of(ProtoTestData), echo_handler)
|
||||||
|
|
||||||
|
msg = ProtoTestData(index=7, message="request")
|
||||||
|
communicator.on_received_data("TestData", msg.SerializeToString(), 42, 0)
|
||||||
|
|
||||||
|
for _ in range(30):
|
||||||
|
if transport.packets:
|
||||||
|
break
|
||||||
|
await asyncio.sleep(0.01)
|
||||||
|
|
||||||
|
assert len(transport.packets) == 1
|
||||||
|
response = transport.packets[0]
|
||||||
|
assert response.responseNonce == 42
|
||||||
|
payload = ProtoTestData.FromString(response.data)
|
||||||
|
assert payload.index == 8
|
||||||
|
await communicator.close()
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import {
|
||||||
import { createNodeWorkerGateway } from "../src/node_inbound_gateway.js";
|
import { createNodeWorkerGateway } from "../src/node_inbound_gateway.js";
|
||||||
import {
|
import {
|
||||||
create,
|
create,
|
||||||
|
fromBinary,
|
||||||
PacketBaseSchema,
|
PacketBaseSchema,
|
||||||
TestDataSchema,
|
TestDataSchema,
|
||||||
toBinary,
|
toBinary,
|
||||||
|
|
@ -779,6 +780,28 @@ describe("Communicator inbound gateway", () => {
|
||||||
await comm.close();
|
await comm.close();
|
||||||
await comm2.close();
|
await comm2.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("Request handler registered with full name handles simple-name inbound request", async () => {
|
||||||
|
const transport = new MockTransport();
|
||||||
|
const comm = new Communicator();
|
||||||
|
comm.initialize(transport, parserMap());
|
||||||
|
|
||||||
|
comm.addRequestListener(TestDataSchema.typeName, async (msg) => {
|
||||||
|
const m = msg as unknown as { index: number };
|
||||||
|
return create(TestDataSchema, { index: m.index + 1, message: "echo" });
|
||||||
|
});
|
||||||
|
|
||||||
|
const reqBytes = toBinary(TestDataSchema, create(TestDataSchema, { index: 7, message: "req" }));
|
||||||
|
comm.onReceivedData("TestData", reqBytes, 42, 0);
|
||||||
|
|
||||||
|
await waitUntil(() => transport.packets.length === 1, 1000);
|
||||||
|
|
||||||
|
expect(transport.packets.length).toBe(1);
|
||||||
|
expect(transport.packets[0]?.responseNonce).toBe(42);
|
||||||
|
const decoded = fromBinary(TestDataSchema, transport.packets[0]!.data);
|
||||||
|
expect((decoded as unknown as { index: number }).index).toBe(8);
|
||||||
|
await comm.close();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("WorkerGateway lifecycle", () => {
|
describe("WorkerGateway lifecycle", () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue