[refactor-impl] #1485 first-slice: 类型化 control 字段删除 JSON parsers#1497
Conversation
🤖 architect review: approveTL;DR
详细说明本次 diff 严格落在 #1485 first-slice scope:4 个 production 文件 + 1 个 endpoint 测试文件。 我也对 diff 跑了架构反模式 grep:未发现 production 📎 完整 codex 原始输出(存档备查)---
pr: 1497
role: architect
verdict: approve
---
## Verdict
Approve: no architectural concerns from the CLAUDE/AGENTS compliance angle.
## Evidence
- `agents/Aevatar.GAgents.Household/household_messages.proto:156`: the refactor comment states the old `payload_json` actor-boundary bag and the new typed admission principle; lines 160-175 reserve field/tag 5 and expose typed Protobuf `oneof payload` cases, matching CLAUDE “核心语义强类型” and AGENTS “protobuf 字段演进是默认路径”.
- `agents/Aevatar.GAgents.Device/DeviceEventEndpoints.cs:196`: the Host/Adapter boundary explicitly terminates NyxID callback JSON and allowlists known events before dispatch, matching CLAUDE “外部协议必须 JSON 时,仅在 Host/Adapter 边界做协议转换;进入应用/领域/运行时层后恢复为 Protobuf.”
- `agents/Aevatar.GAgents.Household/HouseholdEntity.cs:195`: the actor consumes `DeviceInbound.PayloadCase` typed Protobuf payloads and no longer relies on raw callback JSON control flow, matching CLAUDE “状态镜像契约面向查询…稳定强类型契约,非 actor 内部 state 的原样 dump” and the top-level strong-typing rule.
- `agents/Aevatar.GAgents.Device/DeviceCommandFacades.cs:244`: the existing command facade remains the single envelope factory and packs `command.Inbound` once into `EventEnvelope`, preserving CLAUDE “`EventEnvelope` 是唯一投影传输壳” / “命令骨架内聚”.
- `test/Aevatar.GAgents.ChannelRuntime.Tests/DeviceEventEndpointsTests.cs:263`: added tests build callback JSON only as adapter input; assertions at lines 281-290 verify typed dispatch and absence of `payload_json`, while lines 293-319 verify unknown event types do not dispatch.
- Scope check: diff files are limited to the #1485 declared `scope_paths` subset: `DeviceCommandFacades.cs`, `DeviceEventEndpoints.cs`, `HouseholdEntity.cs`, `household_messages.proto`, and `DeviceEventEndpointsTests.cs`.
- Anti-pattern scan: no added production `Task.Delay`, `GetAwaiter().GetResult()`, `TypeUrl.Contains(...)`, `actor.HandleEventAsync(`, host/application `SubscribeAsync<EventEnvelope>`, cross-request fact `Dictionary<>` fields, raw `HttpClient` constructor, or `[Skip]` / disabled tests.
## What would change your verdict (only if comment or reject)
N/AREVIEW_DONE:1485:architect:approve ⟦AI:AUTO-LOOP⟧ |
🤖 tests review: approveTL;DR
详细说明本次 production diff 基本是注释语义更新; 测试侧新增了 另一个新增测试 📎 完整 codex 原始输出(存档备查)---
pr: 1497
role: tests
verdict: approve
---
## Verdict
Test coverage and quality are adequate for this diff.
## Evidence
- `test/Aevatar.GAgents.ChannelRuntime.Tests/DeviceEventEndpointsTests.cs:245` adds `HandleDeviceCallbackAsync_known_event_type_dispatches_typed_inbound_without_raw_payload`, which exercises the endpoint through the accepted callback path and asserts the business outcome: HTTP 202, accepted body, registration id, device id, typed sensor payload, and no `payload_json` field.
- `test/Aevatar.GAgents.ChannelRuntime.Tests/DeviceEventEndpointsTests.cs:389` adds `DeviceCallbackCommandFacade_ShouldPackDeviceInboundOnceInSingleEventEnvelopePayload`, a source-regression guard that checks the callback facade packs `command.Inbound` into the single `EventEnvelope` and rejects a second callback envelope shape.
- Diff scan found no added `Task.Delay`, `Thread.Sleep`, `WaitUntilAsync`, `[Skip]`, manual traits, or `test_polling_allowlist.txt` changes.
REVIEW_DONE:1485:tests:approve |
🤖 quality review: approveTL;DR
详细说明我按三点检查了完整 touched files, 不只看 hunk:命名是否表达业务意图、是否有新增未使用 surface、是否出现不必要抽象或重复复杂度。这个 PR 的 production diff 是 4 处 self-doc comment 更新; 新增测试方法各自聚焦一个行为, 没有引入新的 public abstraction, 也没有把 unrelated cleanup 混进来。
📎 完整 codex 原始输出(存档备查)---
pr: 1497
role: quality
verdict: approve
---
## Verdict
Approve: the diff is focused, names stay domain-specific, refactor self-docs are present and clear, and I do not see dead code or unnecessary abstraction added.
## Evidence
- `agents/Aevatar.GAgents.Device/DeviceCommandFacades.cs:255` keeps the refactor Old/New block readable and explains why the existing command facade remains the single dispatch skeleton.
- `agents/Aevatar.GAgents.Device/DeviceEventEndpoints.cs:196` clearly states the Host/Adapter JSON boundary and typed Protobuf admission rule without filler commentary.
- `agents/Aevatar.GAgents.Household/HouseholdEntity.cs:195` documents the actor-side simplification in business terms: consume typed payload cases and keep control flow independent of callback JSON shape.
- `agents/Aevatar.GAgents.Household/household_messages.proto:156` preserves the removed `payload_json` field via `reserved` declarations and gives a clear contract-level explanation.
- `test/Aevatar.GAgents.ChannelRuntime.Tests/DeviceEventEndpointsTests.cs:245` adds a focused endpoint dispatch test with explicit naming and no new unused public surface.
- `test/Aevatar.GAgents.ChannelRuntime.Tests/DeviceEventEndpointsTests.cs:389` adds a targeted structural guard for the single-envelope behavior; the method remains small and directly tied to the refactor intent.
REVIEW_DONE:1485:quality:approveREVIEW_DONE:1485:quality:approve |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## auto-refact-dev #1497 +/- ##
================================================
Coverage 83.70% 83.70%
================================================
Files 1012 1012
Lines 68246 68246
Branches 8832 8832
================================================
+ Hits 57122 57124 +2
+ Misses 7231 7229 -2
Partials 3893 3893
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
摘要
来源:#1282 Phase 9 r1 split first-slice。
typed-control-fields-delete-json-parsers(主题:Device/Household command facades + endpoints typed pass-through 替代 JSON parser pattern)。范围
5 files changed (+75/-4):
agents/Aevatar.GAgents.Device/DeviceCommandFacades.csagents/Aevatar.GAgents.Device/DeviceEventEndpoints.csagents/Aevatar.GAgents.Household/HouseholdEntity.csagents/Aevatar.GAgents.Household/household_messages.prototest/Aevatar.GAgents.ChannelRuntime.Tests/DeviceEventEndpointsTests.cs(新增 71 行行为测试)实施 codex 本地通过
dotnet build aevatar.slnx --nologo+dotnet test aevatar.slnx --nologo --no-build。关联
Stacked-PR
base =
auto-refact-dev。🤖 Auto-loop / codex-refactor-loop
⟦AI:AUTO-LOOP⟧