Skip to content

iter32 cluster-034: chat route policy 删 request-path projection priming#819

Merged
loning merged 2 commits into
auto-refact-devfrom
refactor/iter32-cluster-034-chat-route-policy-request-path-projection-activation
May 22, 2026
Merged

iter32 cluster-034: chat route policy 删 request-path projection priming#819
loning merged 2 commits into
auto-refact-devfrom
refactor/iter32-cluster-034-chat-route-policy-request-path-projection-activation

Conversation

@loning
Copy link
Copy Markdown
Contributor

@loning loning commented May 22, 2026

Summary

iter32 cluster-034 (high)。

  • Old:ChatRoutePolicyAdminEndpoints + VoiceDemoBootstrapEndpoints 在 request path 调 EnsureProjectionForActorAsync 同步 priming projection。违反 query-time priming forbidden + 命令骨架内聚。
  • New:committed-state hook 触发 — ChatRoutePolicyCommittedStateProjectionActivationPlanProvider 匹配 ChatRoutePolicyUpdated 自动 activate;删 request-path port;DI 注册 dispatcher/hook/provider;guard 加 endpoint 扫描。

违反 CLAUDE.md:禁止 query-time replay/priming + 命令骨架内聚

Scope

9 files changed (+166/-86 net +80)。17 ChatRouting tests pass,architecture+query_projection_priming guards green。

设计共识:issue #818 r1 consensus minimal

🤖 Auto-loop / codex-refactor-loop iter32

⟦AI:AUTO-LOOP⟧

…tion priming + 加 committed-state hook

违反 CLAUDE.md "禁止 query-time priming" + "命令骨架内聚":ChatRoutePolicyAdminEndpoints + VoiceDemoBootstrap 在 request path 调 EnsureProjectionForActorAsync 同步 priming。

变更(consensus minimal):
- 新 ChatRoutePolicyCommittedStateProjectionActivationPlanProvider(committed-state hook 触发,匹配 ChatRoutePolicyUpdated)
- 删 ChatRoutePolicyProjectionPort + EnsureProjectionForActorAsync request-path 调用
- DI 注册 ProjectionActivationPlanDispatcher + CommittedStateProjectionActivationHook + 新 provider
- query_projection_priming_guard 加 ChatRoutePolicyAdminEndpoints / VoiceDemoBootstrapEndpoints 扫描
- 新 tests:provider tests / DI registration tests;modify endpoint tests removing port fixture

Verification: 17 ChatRouting tests pass, architecture+priming guards green。
LOC: +166/-86 net +80。

Closes #818
⟦AI:AUTO-LOOP⟧

Co-Authored-By: codex-refactor-loop <noreply@aevatar>
@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

📊 状态卡片 — reviewer 派出

维度
阶段 派出 codex(role=reviewer)
codex log review-pr819-architect-r1.log
工作目录 /Users/auric/aevatar
timeout 3600s(~60 min 上限)
上下文 r1 architect
下一步自动会做 1. 三 reviewer 完成 verdict marker 2. controller 计算 consensus 3. unanimous → auto-merge / reject → fix r<N+1>
是否需要人介入 ❌ 否(自动推进)

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

📊 状态卡片 — reviewer 派出

维度
阶段 派出 codex(role=reviewer)
codex log review-pr819-tests-r1.log
工作目录 /Users/auric/aevatar
timeout 3600s(~60 min 上限)
上下文 r1 tests
下一步自动会做 1. 三 reviewer 完成 verdict marker 2. controller 计算 consensus 3. unanimous → auto-merge / reject → fix r<N+1>
是否需要人介入 ❌ 否(自动推进)

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

📊 状态卡片 — reviewer 派出

维度
阶段 派出 codex(role=reviewer)
codex log review-pr819-quality-r1.log
工作目录 /Users/auric/aevatar
timeout 3600s(~60 min 上限)
上下文 r1 quality
下一步自动会做 1. 三 reviewer 完成 verdict marker 2. controller 计算 consensus 3. unanimous → auto-merge / reject → fix r<N+1>
是否需要人介入 ❌ 否(自动推进)

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

🤖 Quality review approve

TL;DR

  • 这是什么: PR 819 的代码质量视角复核,重点看可读性、命名、简单性、死代码和范围控制。
  • 结论: approve,没有发现需要阻塞或评论修正的客观质量问题。
  • 下一步: controller 可以继续汇总其他角色结论。

详细说明

这次改动把 chat route policy 的 projection activation 从请求路径移到 committed-state hook。IProjectionActivationPlanProvider 是现有的投影激活计划接口,不是本 PR 新增的一次性抽象;新增的 ChatRoutePolicyCommittedStateProjectionActivationPlanProvider 名字较长,但准确表达了业务范围、触发边界和职责。

我打开了所有 touched files 全文检查。endpoint 和 voice bootstrap 的请求路径参数减少,测试里删除了 no-op activation fixture,guard 增量也只扫这两个相关 endpoint。cluster 要求的 Refactor (iter32/cluster-034...) Old/New 注释存在且内容具体,没有看到 dead code、过度抽象、重复复制、复杂度回退或 unrelated drive-by cleanup。


📎 完整 codex 原始输出(存档备查)
---
pr: 819
role: quality
verdict: approve
---

## Verdict
Approve: the PR is focused on moving chat route policy projection activation out of request paths, with readable naming, no introduced dead code, and clear mandated refactor self-docs.

## Evidence
- `agents/Aevatar.GAgents.ChatRouting/ChatRoutePolicyCommittedStateProjectionActivationPlanProvider.cs:13`: `ChatRoutePolicyCommittedStateProjectionActivationPlanProvider` is long but precise: it names the business scope, trigger boundary, and output responsibility; it also implements an existing multi-implementer abstraction rather than adding a one-off interface.
- `agents/Aevatar.GAgents.ChatRouting/DependencyInjection/ChatRoutingServiceCollectionExtensions.cs:70`: the new dispatcher/hook/provider registrations use existing projection activation plumbing and are covered by the service collection test, so there is no unreachable public surface.
- `src/Aevatar.Mainnet.Host.Api/ChatRouting/ChatRoutePolicyAdminEndpoints.cs:194` and `src/Aevatar.Mainnet.Host.Api/Voice/VoiceDemoBootstrapEndpoints.cs:153`: the modified request-path methods got simpler after removing projection priming parameters/calls; no new branchy control flow or oversized method was introduced.
- `test/Aevatar.Hosting.Tests/MainnetChatRoutePolicyAdminEndpointsTests.cs:175`: removing the no-op activation service fixture deletes now-dead test scaffolding and keeps the endpoint tests focused on dispatch/readmodel behavior.
- `tools/ci/query_projection_priming_guard.sh:43`: the added guard scan is scoped to the two affected endpoints and excludes only the required refactor self-doc text, so it is focused rather than a broad unrelated lint expansion.
- Refactor self-doc comments are present on the new provider, DI registration, endpoint removal sites, tests, and guard-related code; the Old/New wording is concrete enough for a non-audit reader.

⟦AI:AUTO-LOOP

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

🤖 tests 评审:拒绝,voice demo bootstrap 缺少行为覆盖

TL;DR

  • 这是什么: PR 819 的 tests 视角独立评审。
  • 结论: reject;新增 provider 测到了,但 VoiceDemoBootstrapEndpoints 的 request path 变更没有匹配测试。
  • 需要 maintainer 做什么: 补 /api/demo/voice/bootstrap 行为测试和 request-path priming 的源码回归断言后再合。

详细说明

这次变更删除了 VoiceDemoBootstrapEndpoints 里对 ChatRoutePolicyProjectionPort 的依赖,也就是去掉 request path 里同步激活 projection 的旧路径;但目前没有 VoiceDemoBootstrapEndpointsTests 或等价 endpoint 测试覆盖 /api/demo/voice/bootstrap。这会让 route-policy upsert 的命令形状、旧规则保留/替换、以及“不再做 request-path projection activation”都没有测试兜住。

另外,cluster 明确引入了“chat route policy endpoint/bootstrap 禁止 request-path projection priming”的 no-regression 规则;虽然 tools/ci/query_projection_priming_guard.sh 加了扫描,但测试里没有 source.Should().NotContain(...) 或等价源码断言来锁定 ChatRoutePolicyProjectionPort / EnsureProjectionForActorAsync 这些禁用 token。测试质量角度,这属于真实覆盖缺口,不是只需要评论的命名或断言风格问题。


📎 完整 codex 原始输出(存档备查)

pr: 819
role: tests
verdict: reject

Verdict

Reject: the new committed-state activation provider is covered, but the diff changes the voice demo bootstrap request path without any matching behavior test, and the cluster no-regression rule is not locked by a source-regression assertion.

Evidence

  • src/Aevatar.Mainnet.Host.Api/Voice/VoiceDemoBootstrapEndpoints.cs:45 / :153: the PR removes ChatRoutePolicyProjectionPort from HandleBootstrapAsync and EnsureVoiceRoutePolicyAsync, but there is no matching test/.../VoiceDemoBootstrapEndpointsTests.cs or new test covering /api/demo/voice/bootstrap; this leaves the changed bootstrap behavior unverified (policy upsert command shape, existing-rule preservation/replacement, and absence of request-path projection activation).
  • test/Aevatar.Hosting.Tests/MainnetChatRoutePolicyAdminEndpointsTests.cs:175: admin endpoint tests were updated only by deleting the ChatRoutePolicyProjectionPort fixture; they still cover PUT/DELETE/GET business outcomes, but they do not assert that request-path projection priming stays absent.
  • tools/ci/query_projection_priming_guard.sh:43: the static guard scans chat route policy endpoints, but no test contains source.Should().NotContain(...) / equivalent assertions for forbidden tokens such as ChatRoutePolicyProjectionPort or EnsureProjectionForActorAsync, despite this cluster introducing a no-regression rule.
  • No new Task.Delay, Thread.Sleep, [Skip], or manual-category trait was added in the touched tests; the existing test assertions were not loosened.

What would change your verdict (only if comment or reject)

Add behavior coverage for VoiceDemoBootstrapEndpoints that exercises /api/demo/voice/bootstrap with faked catalog/query/voice services and asserts the route-policy upsert is dispatched to chat-route-policy:{scopeId} with the voice-demo rule, preserving non-voice-demo existing rules and replacing any old voice-demo rule. Also add a source-regression test (or equivalent guard test) that reads ChatRoutePolicyAdminEndpoints.cs and VoiceDemoBootstrapEndpoints.cs and asserts they do not contain ChatRoutePolicyProjectionPort / EnsureProjectionForActorAsync outside comments.

REVIEW_DONE:819:tests:reject
⟦AI:AUTO-LOOP⟧

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

🤖 架构评审:comment-only,主链路合规,需补方法级 Refactor 注释

TL;DR

  • 这是什么:PR 819 的 architect 视角独立评审,重点看 CLAUDE/AGENTS 架构约束。
  • 结论是什么:不阻塞合并;请求路径里的 EnsureProjectionForActorAsync 已移除,改为 committed-state hook 激活投影。
  • 需要做什么:建议补齐几个被改动 endpoint handler 的 Old pattern / New principle 方法级注释。

📢 cc 原作者:@eanzhao 请 sanity-check chat-route-policy activation 的 ownership 表达是否符合预期。


详细说明

我没有发现新的 CLAUDE/AGENTS 架构违规:ChatRoutePolicyProjectionPort 被删除,没有保留兼容空壳;写接口现在只创建 actor、构造 envelope 并通过 IActorDispatchPort(actor 之间发命令的标准通道)dispatch;投影激活改由 ChatRoutePolicyCommittedStateProjectionActivationPlanProvider 在 committed-state publication hook 上生成 activation plan。

唯一评论项是 review checklist 的注释要求:HandleUpsertAsyncHandleRemoveRuleAsyncHandleBootstrapAsync 的签名/依赖都被改了,但方法本身没有 // Refactor (iter32/cluster-034...): Old pattern... New principle...。类级和 shared helper 上已有注释,所以这不是架构阻塞,只是评审规范的 comment-only。


📎 完整 codex 原始输出(存档备查)
---
pr: 819
role: architect
verdict: comment
---

## Verdict
comment-only - the PR removes request-path projection priming and moves chat-route-policy activation to the committed-state hook path, but several changed endpoint handlers are missing the required per-method Old/New pattern comment.

## Evidence
- `src/Aevatar.Mainnet.Host.Api/ChatRouting/ChatRoutePolicyAdminEndpoints.cs:71` and `src/Aevatar.Mainnet.Host.Api/ChatRouting/ChatRoutePolicyAdminEndpoints.cs:129` changed the write handler signatures/call path by removing `ChatRoutePolicyProjectionPort`, but neither method has the required review checklist comment: `Old/New pattern comment: each refactored type/method has // Refactor (iterN/cluster-XXX): Old pattern: … New principle: …`. The lower shared `DispatchAsync` helper is commented, so this is documentation compliance only, not a CLAUDE architecture violation.
- `src/Aevatar.Mainnet.Host.Api/Voice/VoiceDemoBootstrapEndpoints.cs:45` changed the bootstrap endpoint signature by removing `ChatRoutePolicyProjectionPort`, but the method itself lacks the same required Old/New pattern comment. `EnsureVoiceRoutePolicyAsync` has the comment at `src/Aevatar.Mainnet.Host.Api/Voice/VoiceDemoBootstrapEndpoints.cs:163`, so this is a narrow comment hygiene issue.
- No blocking CLAUDE/AGENTS regression found: `agents/Aevatar.GAgents.ChatRouting/ChatRoutePolicyCommittedStateProjectionActivationPlanProvider.cs:18` maps only committed `ChatRoutePolicyUpdated` state events to a durable materialization activation plan, satisfying CLAUDE: “持久投影 scope 的激活由 committed-state publication owner hook 触发…命令入口不得同步调用 projection activation facade,也不得新增 actor/lifecycle phase 来‘预热’读模型.”
- No blocking CLAUDE/AGENTS regression found: `src/Aevatar.Mainnet.Host.Api/ChatRouting/ChatRoutePolicyAdminEndpoints.cs:194` now builds and dispatches the command envelope without `EnsureProjectionForActorAsync`, aligning with CLAUDE: “命令骨架内聚:标准生命周期 `Normalize -> Resolve Target -> Build Context -> Build Envelope -> Dispatch -> Receipt -> Observe`;业务模块只负责目标解析与载荷/结果映射.”
- No blocking CLAUDE/AGENTS regression found: `agents/Aevatar.GAgents.ChatRouting/ChatRoutePolicyProjectionPort.cs` is deleted and no compat shim replaces it, aligning with CLAUDE: “删除优先:空转发、重复抽象、无业务价值代码直接删除,不保留兼容空壳.”
- Scope honesty is OK: the branch also changes `tools/ci/query_projection_priming_guard.sh:43`, which is outside the prompt's diff glob but inside the cluster's declared `scope_paths` and the implementation summary says no `SCOPE_EXTEND` was needed.
- No proto changes, no new `*WriteActor` / `*ReadActor` / `*Store` split, and no new NyxID / chrono-* external-repo dependency was introduced by the reviewed diff.

## What would change your verdict
Add the required `// Refactor (iter32/cluster-034-chat-route-policy-request-path-projection-activation): Old pattern… New principle…` comment to the changed endpoint methods themselves, or explicitly document that the class/helper-level comment is the accepted local convention for these thin handlers.

REVIEW_DONE:819:architect:comment

⟦AI:AUTO-LOOP

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

📊 状态卡片 — fix 派出

维度
阶段 派出 codex(role=fix)
codex log fix-pr819-r1.log
工作目录 /Users/auric/aevatar-wt-iter32-cluster-034-chat-route-policy-request-path-projection-activation
timeout 3600s(~60 min 上限)
上下文 r1 fix (tests: voice demo bootstrap behavior test + source regression assertion)
下一步自动会做 1. fix r 完成 marker FIX_DONE:... 2. controller commit + push 3. 派 reviewer r<N+1>
是否需要人介入 ❌ 否(自动推进)

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

🤖 PR 819 round 1 fixes applied

TL;DR

  • 这是什么: fix-codex round 1 已处理 architect comment 与 tests reject。
  • 现在到哪一步: 已补 3 处 endpoint 方法级 refactor 注释、1 个 voice bootstrap 行为测试、1 个 request-path source regression 测试。
  • 需要 maintainer 做什么: controller 可提交后重新派 Phase 8 review,预期 unanimous。

📢 cc 原作者:@eanzhao 请 sanity-check voice bootstrap 的 route-policy upsert 行为断言是否贴合 demo 预期。


详细说明

本轮修复集中在 PR 819 的两个 reject/comment 点:IActorDispatchPort 是 actor 之间发命令的标准通道,本 PR 的 request path 现在只负责构造并 dispatch command,不再注入或调用 ChatRoutePolicyProjectionPort 做投影预热。为防回归,新增测试会读取 ChatRoutePolicyAdminEndpoints.csVoiceDemoBootstrapEndpoints.cs,去掉 // 注释后断言没有 ChatRoutePolicyProjectionPort / EnsureProjectionForActorAsync

同时新增 /api/demo/voice/bootstrap 行为测试:伪造 catalog/query/voice services,验证 bootstrap 会创建 demo actor 与 chat-route-policy:{scopeId} actor,向后者 dispatch UpsertChatRoutePolicyRequested,保留非 voice-demo 规则、替换旧 voice-demo 规则,并让投影激活继续由 committed-state hook 负责。

验证结果:dotnet build aevatar.slnx --nologo 通过;Aevatar.Hosting.Tests 过滤 7 个相关测试通过;Aevatar.GAgents.ChatRouting.Tests 17 个测试通过;query_projection_priming_guard.shtest_stability_guards.sh 通过。


📎 完整 codex 原始输出(存档备查)
# Fix report for PR 819 round 1

## Applied
- (A) src/Aevatar.Mainnet.Host.Api/ChatRouting/ChatRoutePolicyAdminEndpoints.cs:78: added per-method refactor Old/New comment to `HandleUpsertAsync` (addresses reviewer:architect's evidence #1).
- (A) src/Aevatar.Mainnet.Host.Api/ChatRouting/ChatRoutePolicyAdminEndpoints.cs:140: added per-method refactor Old/New comment to `HandleRemoveRuleAsync` (addresses reviewer:architect's evidence #1).
- (A) src/Aevatar.Mainnet.Host.Api/Voice/VoiceDemoBootstrapEndpoints.cs:56: added per-method refactor Old/New comment to `HandleBootstrapAsync` (addresses reviewer:architect's evidence #2).
- (B) test/Aevatar.Hosting.Tests/VoiceDemoBootstrapEndpointsTests.cs:35: SCOPE_EXTEND same logical refactor because reviewer:tests rejected missing `/api/demo/voice/bootstrap` behavior coverage; added endpoint behavior test that dispatches the demo init and chat-route-policy upsert, preserves non-`voice-demo` rules, replaces stale `voice-demo`, and does not register/invoke request-path projection activation.
- (A) test/Aevatar.Hosting.Tests/MainnetChatRoutePolicyAdminEndpointsTests.cs:174: added source-regression assertion that strips line comments and verifies `ChatRoutePolicyAdminEndpoints.cs` + `VoiceDemoBootstrapEndpoints.cs` contain no `ChatRoutePolicyProjectionPort` or `EnsureProjectionForActorAsync` in executable request-path source (addresses reviewer:tests evidence #2/#3).

## Rejected as false positive
- None.

## Blocked (cannot fix this round)
- None.

## Build status
- build: pass (`dotnet build aevatar.slnx --nologo 2>&1 | tail -20`)
- tests: pass (`dotnet test test/Aevatar.Hosting.Tests/Aevatar.Hosting.Tests.csproj --nologo --no-build --filter "FullyQualifiedName~MainnetChatRoutePolicyAdminEndpointsTests|FullyQualifiedName~VoiceDemoBootstrapEndpointsTests"`; `dotnet test test/Aevatar.GAgents.ChatRouting.Tests/Aevatar.GAgents.ChatRouting.Tests.csproj --nologo --no-build`)
- guards: pass (`bash tools/ci/query_projection_priming_guard.sh`; `bash tools/ci/test_stability_guards.sh`)

## Recommendation for next round
- expect unanimous

⟦AI:AUTO-LOOP

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

📊 codex 进展 fix-pr819-r1 (⏳ 进行中; 已跑 8 min)

+                Action = new ChatRouteAction
+                {
+                    ForwardToModel = new ForwardToModel { ModelName = "fallback" },
+                },
+            };
+    }
+}

tokens used
133,154
Applied the PR 819 round 1 fixes.

Changed:
- Added method-level refactor comments to the changed admin PUT/DELETE handlers and voice bootstrap handler.
- Added `VoiceDemoBootstrapEndpointsTests` covering `/api/demo/voice/bootstrap` route-policy upsert behavior.
- Added source-regression coverage ensuring request-path source does not reintroduce `ChatRoutePolicyProjectionPort` / `EnsureProjectionForActorAsync`.
- Wrote `/Users/auric/aevatar/.refactor-loop/runs/fix-pr819-r1.md`.

Verified:
- `dotnet build aevatar.slnx --nologo` passed.
- `Aevatar.Hosting.Tests` focused filter passed: 7 tests.
- `Aevatar.GAgents.ChatRouting.Tests` passed: 17 tests.
- `query_projection_priming_guard.sh` passed.
- `test_stability_guards.sh` passed.

自动更新每 10 分钟;edit-in-place 不堆评论;codex 完成后此 comment 自动删除(per Auric "完成后删掉就好了 否则太占空间")。
🤖 controller progress reporter

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

📊 状态卡片 — reviewer 派出

维度
阶段 派出 codex(role=reviewer)
codex log review-pr819-architect-r2.log
工作目录 /Users/auric/aevatar
timeout 3600s(~60 min 上限)
上下文 r2 architect (fix r1)
下一步自动会做 1. 三 reviewer 完成 verdict marker 2. controller 计算 consensus 3. unanimous → auto-merge / reject → fix r<N+1>
是否需要人介入 ❌ 否(自动推进)

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

📊 状态卡片 — reviewer 派出

维度
阶段 派出 codex(role=reviewer)
codex log review-pr819-tests-r2.log
工作目录 /Users/auric/aevatar
timeout 3600s(~60 min 上限)
上下文 r2 tests (fix r1)
下一步自动会做 1. 三 reviewer 完成 verdict marker 2. controller 计算 consensus 3. unanimous → auto-merge / reject → fix r<N+1>
是否需要人介入 ❌ 否(自动推进)

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

📊 状态卡片 — reviewer 派出

维度
阶段 派出 codex(role=reviewer)
codex log review-pr819-quality-r2.log
工作目录 /Users/auric/aevatar
timeout 3600s(~60 min 上限)
上下文 r2 quality (fix r1)
下一步自动会做 1. 三 reviewer 完成 verdict marker 2. controller 计算 consensus 3. unanimous → auto-merge / reject → fix r<N+1>
是否需要人介入 ❌ 否(自动推进)

🤖 controller status banner

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

🤖 Quality review approve

TL;DR

  • 这是什么:PR 819 的 readability / simplicity 质量审查。
  • 结论:approve,没有发现死代码、无意义抽象、复杂度回退或跑题改动。
  • 下一步:maintainer 可把此角色结果作为质量维度通过信号。

详细说明

我按三点差异读取了 touched files,并打开了分支上的完整文件上下文。ChatRoutePolicyCommittedStateProjectionActivationPlanProvider 这个新增类型命名较长,但和仓库现有 *CommittedStateProjectionActivationPlanProvider 模式一致,表达的是“chat route policy 的 committed-state event 触发 projection activation plan”,不是泛化 helper/manager。

请求路径里的 ChatRoutePolicyProjectionPort 依赖被删除后,ChatRoutePolicyAdminEndpointsVoiceDemoBootstrapEndpoints 只保留构造/dispatch 命令的职责;新增 provider 在 DI 中有生产注册,测试也引用到 provider 和“request path 不再 priming”的约束。refactor self-doc 的 Old/New 块存在且可读,diff 范围集中在本 cluster。


📎 完整 codex 原始输出(存档备查)
---
pr: 819
role: quality
verdict: approve
---

## Verdict
Approve: the diff is focused, the new names describe the chat-route-policy committed-state activation path, and I found no dead code, unjustified abstraction, or readability regression.

## Evidence
- `agents/Aevatar.GAgents.ChatRouting/ChatRoutePolicyCommittedStateProjectionActivationPlanProvider.cs:13` adds a concrete provider whose long name matches the existing committed-state activation provider pattern and states the business trigger/scope instead of a generic helper/manager role.
- `agents/Aevatar.GAgents.ChatRouting/DependencyInjection/ChatRoutingServiceCollectionExtensions.cs:70` registers the new dispatcher/hook/provider, so the new public surface is reachable from production composition and is not dead code.
- `src/Aevatar.Mainnet.Host.Api/ChatRouting/ChatRoutePolicyAdminEndpoints.cs:71` and `src/Aevatar.Mainnet.Host.Api/ChatRouting/ChatRoutePolicyAdminEndpoints.cs:132` remove the projection-port parameter from request handlers; the endpoint methods are simpler and keep their existing dispatch-focused structure.
- `src/Aevatar.Mainnet.Host.Api/Voice/VoiceDemoBootstrapEndpoints.cs:45` keeps the pre-existing bootstrap shape and only removes the projection-port dependency from the request path; the method was already near the size threshold, but the PR does not add branches or a new complex flow.
- `test/Aevatar.GAgents.ChatRouting.Tests/ChatRoutePolicyCommittedStateProjectionActivationPlanProviderTests.cs:17` and `test/Aevatar.Hosting.Tests/MainnetChatRoutePolicyAdminEndpointsTests.cs:175` exercise the new provider and the absence of request-path priming, so the added test fixtures have clear reachability and purpose.
- `tools/ci/query_projection_priming_guard.sh:43` extends the existing guard in a narrow way to the two affected endpoint files; no unrelated cleanup or drive-by file changes showed up in the touched-file set.
- Refactor self-doc comments are present with Old/New blocks in the new provider, DI registration, endpoint changes, tests, and guard-facing request paths; they describe the old request-path priming pattern and the new committed-state hook path clearly enough for a non-audit reader.

REVIEW_DONE:819:quality:approve
⟦AI:AUTO-LOOP

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

🤖 tests review approve:测试覆盖足够

TL;DR

  • 这是什么: PR 819 的测试质量复核,聚焦删除 request-path projection priming 后的覆盖与稳定性。
  • 结论是什么: approve;新增测试覆盖 provider 映射、DI hook、admin/voice endpoint 行为和 source-regression guard。
  • 需要 maintainer 做什么: 无需为 tests 角度阻塞合并,保留现有 focused tests 与 guard 即可。

详细说明

我检查了三点:新增测试是否断言业务结果、是否引入 Task.Delay / [Skip] 这类测试稳定性风险、以及 cluster 的“禁止 request path projection priming”规则是否有 source-regression 断言。

覆盖面满足这次 diff:ChatRoutePolicyCommittedStateProjectionActivationPlanProviderTests 验证 committed-state event 到 durable materialization activation plan 的正反向映射;ChatRoutingServiceCollectionExtensionsTests 锁住 dispatcher、hook、provider 的 DI 注册;MainnetChatRoutePolicyAdminEndpointsTests 保留 PUT/DELETE dispatch 形状断言,并新增源码回归断言拒绝 ChatRoutePolicyProjectionPort / EnsureProjectionForActorAsync 回到请求路径;VoiceDemoBootstrapEndpointsTests 通过真实 endpoint 验证 voice route policy upsert 命令、保留旧规则、替换 stale voice-demo 规则和 dispatch-only 行为。

验证命令在 PR worktree 通过:ChatRouting focused tests 6 个、Hosting endpoint focused tests 7 个、test_stability_guards.shquery_projection_priming_guard.sh


📎 完整 codex 原始输出(存档备查)

pr: 819
role: tests
verdict: approve

Verdict

Test coverage and quality are adequate for this PR’s request-path projection priming removal and committed-state activation replacement.

Evidence

  • test/Aevatar.GAgents.ChatRouting.Tests/ChatRoutePolicyCommittedStateProjectionActivationPlanProviderTests.cs:17 covers the new provider’s positive behavior: ChatRoutePolicyUpdated from ChatRoutePolicyGAgent maps to one durable materialization activation plan with the expected lease type, root actor id, projection kind, and mode.
  • test/Aevatar.GAgents.ChatRouting.Tests/ChatRoutePolicyCommittedStateProjectionActivationPlanProviderTests.cs:36 covers negative routing behavior for unrelated actor/event inputs, so the provider is not only bump-line-count coverage.
  • test/Aevatar.GAgents.ChatRouting.Tests/ChatRoutingServiceCollectionExtensionsTests.cs:55 verifies the DI surface for ProjectionActivationPlanDispatcher, CommittedStateProjectionActivationHook, and the chat-route-policy plan provider.
  • test/Aevatar.Hosting.Tests/MainnetChatRoutePolicyAdminEndpointsTests.cs:40 and :110 keep business dispatch assertions for PUT/DELETE after removing ChatRoutePolicyProjectionPort from the endpoint request path.
  • test/Aevatar.Hosting.Tests/MainnetChatRoutePolicyAdminEndpointsTests.cs:175 adds a source-regression assertion that strips refactor comments and rejects ChatRoutePolicyProjectionPort / EnsureProjectionForActorAsync in the two request-path sources.
  • test/Aevatar.Hosting.Tests/VoiceDemoBootstrapEndpointsTests.cs:36 exercises the new voice bootstrap behavior through the real endpoint, asserting created actors, command dispatches, preserved existing route rules, replacement of the stale voice-demo rule, and the new voice route action.
  • No [Skip], [Trait("Category","Manual")], Thread.Sleep, or new Task.Delay test pacing was added in the PR diff; tools/ci/test_polling_allowlist.txt was unchanged.
  • Verified on the PR worktree: dotnet test test/Aevatar.GAgents.ChatRouting.Tests/Aevatar.GAgents.ChatRouting.Tests.csproj --nologo --filter "FullyQualifiedName~ChatRoutePolicyCommittedStateProjectionActivationPlanProviderTests|FullyQualifiedName~ChatRoutingServiceCollectionExtensionsTests" passed, 6 tests.
  • Verified on the PR worktree: dotnet test test/Aevatar.Hosting.Tests/Aevatar.Hosting.Tests.csproj --nologo --filter "FullyQualifiedName~MainnetChatRoutePolicyAdminEndpointsTests|FullyQualifiedName~VoiceDemoBootstrapEndpointsTests" passed, 7 tests.
  • Verified on the PR worktree: bash tools/ci/test_stability_guards.sh and bash tools/ci/query_projection_priming_guard.sh passed.

REVIEW_DONE:819:tests:approve

⟦AI:AUTO-LOOP⟧

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

🤖 架构评审:comment-only,生产路径合规,scope 记录需补齐

TL;DR

  • 这是什么: PR 819 的 architect 角度独立评审。
  • 结论: 不阻塞合并;request-path projection priming 已移到 committed-state hook,符合 CLAUDE 主线。
  • 需要处理: 补一条 SCOPE_EXTEND 记录,说明新增 VoiceDemoBootstrapEndpointsTests.cs 超出原始 scope。

详细说明

生产代码层面我没有发现新的 CLAUDE/AGENTS 架构违规:ChatRoutePolicyProjectionPort 被删除,ChatRoutePolicyAdminEndpointsVoiceDemoBootstrapEndpoints 不再在 HTTP 请求路径里调用 EnsureProjectionForActorAsync。新的 ChatRoutePolicyCommittedStateProjectionActivationPlanProvider 通过 committed-state hook 为 ChatRoutePolicyUpdated 生成 durable materialization activation plan,符合“committed domain event 必须可观察”和“命令入口不负责 projection/readmodel activation”的方向。

唯一评论项是 scope honesty:PR 新增了 test/Aevatar.Hosting.Tests/VoiceDemoBootstrapEndpointsTests.cs,但 cluster scope 里 test/Aevatar.Hosting.Tests/ 只列了 MainnetChatRoutePolicyAdminEndpointsTests.cs;同时 implement summary 写的是 “No scope expansion was needed / None”。这个测试本身是合理的回归覆盖,不构成生产架构问题;建议补充 SCOPE_EXTEND 记录或更新 cluster scope 元数据。

📎 完整 codex 原始输出(存档备查)
---
pr: 819
role: architect
verdict: comment
---

## Verdict
comment-only: production architecture moves chat route policy projection activation out of request paths and into the committed-state hook, but the PR has a scope-honesty drift in its internal implement summary.

## Evidence
- `test/Aevatar.Hosting.Tests/VoiceDemoBootstrapEndpointsTests.cs:1` is a new file in the PR, but the declared cluster scope only allowed `test/Aevatar.Hosting.Tests/MainnetChatRoutePolicyAdminEndpointsTests.cs` under `test/Aevatar.Hosting.Tests/`, and `.refactor-loop/runs/implement-cluster-034-chat-route-policy-request-path-projection-activation.md:24-33` says "No scope expansion was needed" / "None." This violates the review checklist item "Scope honesty: diff stays within the cluster's declared `scope_paths` (or has a documented SCOPE_EXTEND in implement summary)." I am treating this as comment-only because the added file is a targeted endpoint regression test, not a CLAUDE/AGENTS architectural regression.
- `agents/Aevatar.GAgents.ChatRouting/ChatRoutePolicyCommittedStateProjectionActivationPlanProvider.cs:13-38` maps committed `ChatRoutePolicyUpdated` publications to `ProjectionRuntimeMode.DurableMaterialization`; `agents/Aevatar.GAgents.ChatRouting/DependencyInjection/ChatRoutingServiceCollectionExtensions.cs:70-76` wires `ProjectionActivationPlanDispatcher`, `CommittedStateProjectionActivationHook`, and the provider. This aligns with CLAUDE.md "committed domain event 必须可观察:write-side 完成 committed event 后必须送入 projection 主链;禁止只落 event store 而不进入可观察流。" and "禁止 query-time replay/priming:`QueryPort/QueryService/ApplicationService` 不得在请求路径读 `IEventStore`、重放 events、临时重建 state mirror;不得在 query 方法内同步补投影或补跑 ES/materialization。刷新须通过正式 projection 会话、后台 materializer 或写侧预挂接 projection 完成。"
- `src/Aevatar.Mainnet.Host.Api/ChatRouting/ChatRoutePolicyAdminEndpoints.cs:71-231` and `src/Aevatar.Mainnet.Host.Api/Voice/VoiceDemoBootstrapEndpoints.cs:45-200` no longer inject `ChatRoutePolicyProjectionPort` or call `EnsureProjectionForActorAsync` before dispatch. This aligns with CLAUDE.md "命令骨架内聚:标准生命周期 `Normalize -> Resolve Target -> Build Context -> Build Envelope -> Dispatch -> Receipt -> Observe`;业务模块只负责目标解析与载荷/结果映射。"
- `agents/Aevatar.GAgents.ChatRouting/ChatRoutePolicyProjectionPort.cs` is deleted, so I did not find a new empty forwarding interface, compat shim, second projection pathway, `.proto` field churn, or new external NyxID/chrono-* dependency.

## What would change your verdict (only if comment or reject)
Document the `test/Aevatar.Hosting.Tests/VoiceDemoBootstrapEndpointsTests.cs` addition as an explicit `SCOPE_EXTEND` in the implement summary, or update the controller's cluster scope record to include this test file. No production architecture change is required from my angle.

REVIEW_DONE:819:architect:comment

⟦AI:AUTO-LOOP

⟦AI:AUTO-LOOP⟧

@loning loning merged commit 973971e into auto-refact-dev May 22, 2026
11 checks passed
@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

📊 codex 进展 review-pr819-architect-r2 (⏳ 进行中; 已跑 11 min)

+
+## Verdict
+comment-only: production architecture moves chat route policy projection activation out of request paths and into the committed-state hook, but the PR has a scope-honesty drift in its internal implement summary.
+
+## Evidence
+- `test/Aevatar.Hosting.Tests/VoiceDemoBootstrapEndpointsTests.cs:1` is a new file in the PR, but the declared cluster scope only allowed `test/Aevatar.Hosting.Tests/MainnetChatRoutePolicyAdminEndpointsTests.cs` under `test/Aevatar.Hosting.Tests/`, and `.refactor-loop/runs/implement-cluster-034-chat-route-policy-request-path-projection-activation.md:24-33` says "No scope expansion was needed" / "None." This violates the review checklist item "Scope honesty: diff stays within the cluster's declared `scope_paths` (or has a documented SCOPE_EXTEND in implement summary)." I am treating this as comment-only because the added file is a targeted endpoint regression test, not a CLAUDE/AGENTS architectural regression.
+- `agents/Aevatar.GAgents.ChatRouting/ChatRoutePolicyCommittedStateProjectionActivationPlanProvider.cs:13-38` maps committed `ChatRoutePolicyUpdated` publications to `ProjectionRuntimeMode.DurableMaterialization`; `agents/Aevatar.GAgents.ChatRouting/DependencyInjection/ChatRoutingServiceCollectionExtensions.cs:70-76` wires `ProjectionActivationPlanDispatcher`, `CommittedStateProjectionActivationHook`, and the provider. This aligns with CLAUDE.md "committed domain event 必须可观察:write-side 完成 committed event 后必须送入 projection 主链;禁止只落 event store 而不进入可观察流。" and "禁止 query-time replay/priming:`QueryPort/QueryService/ApplicationService` 不得在请求路径读 `IEventStore`、重放 events、临时重建 state mirror;不得在 query 方法内同步补投影或补跑 ES/materialization。刷新须通过正式 projection 会话、后台 materializer 或写侧预挂接 projection 完成。"
+- `src/Aevatar.Mainnet.Host.Api/ChatRouting/ChatRoutePolicyAdminEndpoints.cs:71-231` and `src/Aevatar.Mainnet.Host.Api/Voice/VoiceDemoBootstrapEndpoints.cs:45-200` no longer inject `ChatRoutePolicyProjectionPort` or call `EnsureProjectionForActorAsync` before dispatch. This aligns with CLAUDE.md "命令骨架内聚:标准生命周期 `Normalize -> Resolve Target -> Build Context -> Build Envelope -> Dispatch -> Receipt -> Observe`;业务模块只负责目标解析与载荷/结果映射。"
+- `agents/Aevatar.GAgents.ChatRouting/ChatRoutePolicyProjectionPort.cs` is deleted, so I did not find a new empty forwarding interface, compat shim, second projection pathway, `.proto` field churn, or new external NyxID/chrono-* dependency.
+
+## What would change your verdict (only if comment or reject)
+Document the `test/Aevatar.Hosting.Tests/VoiceDemoBootstrapEndpointsTests.cs` addition as an explicit `SCOPE_EXTEND` in the implement summary, or update the controller's cluster scope record to include this test file. No production architecture change is required from my angle.
+
+REVIEW_DONE:819:architect:comment
+
+⟦AI:AUTO-LOOP⟧

tokens used
118,044
Done.

Wrote the review artifact to [.refactor-loop/runs/review-pr819-architect-r2.md](/Users/auric/aevatar/.refactor-loop/runs/review-pr819-architect-r2.md) with verdict `comment`.

Posted the required GitHub PR comment:
https://github.com/aevatarAI/aevatar/pull/819#issuecomment-4519597877

自动更新每 10 分钟;edit-in-place 不堆评论;codex 完成后此 comment 自动删除(per Auric "完成后删掉就好了 否则太占空间")。
🤖 controller progress reporter

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

📊 codex 进展 review-pr819-quality-r2 (⏳ 进行中; 已跑 11 min)

+pr: 819
+role: quality
+verdict: approve
+---
+
+## Verdict
+Approve: the diff is focused, the new names describe the chat-route-policy committed-state activation path, and I found no dead code, unjustified abstraction, or readability regression.
+
+## Evidence
+- `agents/Aevatar.GAgents.ChatRouting/ChatRoutePolicyCommittedStateProjectionActivationPlanProvider.cs:13` adds a concrete provider whose long name matches the existing committed-state activation provider pattern and states the business trigger/scope instead of a generic helper/manager role.
+- `agents/Aevatar.GAgents.ChatRouting/DependencyInjection/ChatRoutingServiceCollectionExtensions.cs:70` registers the new dispatcher/hook/provider, so the new public surface is reachable from production composition and is not dead code.
+- `src/Aevatar.Mainnet.Host.Api/ChatRouting/ChatRoutePolicyAdminEndpoints.cs:71` and `src/Aevatar.Mainnet.Host.Api/ChatRouting/ChatRoutePolicyAdminEndpoints.cs:132` remove the projection-port parameter from request handlers; the endpoint methods are simpler and keep their existing dispatch-focused structure.
+- `src/Aevatar.Mainnet.Host.Api/Voice/VoiceDemoBootstrapEndpoints.cs:45` keeps the pre-existing bootstrap shape and only removes the projection-port dependency from the request path; the method was already near the size threshold, but the PR does not add branches or a new complex flow.
+- `test/Aevatar.GAgents.ChatRouting.Tests/ChatRoutePolicyCommittedStateProjectionActivationPlanProviderTests.cs:17` and `test/Aevatar.Hosting.Tests/MainnetChatRoutePolicyAdminEndpointsTests.cs:175` exercise the new provider and the absence of request-path priming, so the added test fixtures have clear reachability and purpose.
+- `tools/ci/query_projection_priming_guard.sh:43` extends the existing guard in a narrow way to the two affected endpoint files; no unrelated cleanup or drive-by file changes showed up in the touched-file set.
+- Refactor self-doc comments are present with Old/New blocks in the new provider, DI registration, endpoint changes, tests, and guard-facing request paths; they describe the old request-path priming pattern and the new committed-state hook path clearly enough for a non-audit reader.
+
+REVIEW_DONE:819:quality:approve
+⟦AI:AUTO-LOOP⟧

tokens used
95,348
Done.

Wrote the internal artifact at [.refactor-loop/runs/review-pr819-quality-r2.md](/Users/auric/aevatar/.refactor-loop/runs/review-pr819-quality-r2.md) with verdict `approve`.

自动更新每 10 分钟;edit-in-place 不堆评论;codex 完成后此 comment 自动删除(per Auric "完成后删掉就好了 否则太占空间")。
🤖 controller progress reporter

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 22, 2026

📊 codex 进展 review-pr819-tests-r2 (⏳ 进行中; 已跑 11 min)

+- `test/Aevatar.Hosting.Tests/MainnetChatRoutePolicyAdminEndpointsTests.cs:175` adds a source-regression assertion that strips refactor comments and rejects `ChatRoutePolicyProjectionPort` / `EnsureProjectionForActorAsync` in the two request-path sources.
+- `test/Aevatar.Hosting.Tests/VoiceDemoBootstrapEndpointsTests.cs:36` exercises the new voice bootstrap behavior through the real endpoint, asserting created actors, command dispatches, preserved existing route rules, replacement of the stale `voice-demo` rule, and the new voice route action.
+- No `[Skip]`, `[Trait("Category","Manual")]`, `Thread.Sleep`, or new `Task.Delay` test pacing was added in the PR diff; `tools/ci/test_polling_allowlist.txt` was unchanged.
+- Verified on the PR worktree: `dotnet test test/Aevatar.GAgents.ChatRouting.Tests/Aevatar.GAgents.ChatRouting.Tests.csproj --nologo --filter "FullyQualifiedName~ChatRoutePolicyCommittedStateProjectionActivationPlanProviderTests|FullyQualifiedName~ChatRoutingServiceCollectionExtensionsTests"` passed, 6 tests.
+- Verified on the PR worktree: `dotnet test test/Aevatar.Hosting.Tests/Aevatar.Hosting.Tests.csproj --nologo --filter "FullyQualifiedName~MainnetChatRoutePolicyAdminEndpointsTests|FullyQualifiedName~VoiceDemoBootstrapEndpointsTests"` passed, 7 tests.
+- Verified on the PR worktree: `bash tools/ci/test_stability_guards.sh` and `bash tools/ci/query_projection_priming_guard.sh` passed.
+
+REVIEW_DONE:819:tests:approve
+
+⟦AI:AUTO-LOOP⟧

tokens used
97,922
Wrote the tests review artifact:

[review-pr819-tests-r2.md](/Users/auric/aevatar/.refactor-loop/runs/review-pr819-tests-r2.md)

Verdict: `approve`

Verified on the PR worktree:
- ChatRouting focused tests: passed, 6 tests
- Hosting endpoint focused tests: passed, 7 tests
- `bash tools/ci/test_stability_guards.sh`: passed
- `bash tools/ci/query_projection_priming_guard.sh`: passed

自动更新每 10 分钟;edit-in-place 不堆评论;codex 完成后此 comment 自动删除(per Auric "完成后删掉就好了 否则太占空间")。
🤖 controller progress reporter

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.08%. Comparing base (2c06737) to head (0497561).
⚠️ Report is 1 commits behind head on auto-refact-dev.

@@               Coverage Diff                @@
##           auto-refact-dev     #819   +/-   ##
================================================
  Coverage            83.07%   83.08%           
================================================
  Files                  982      982           
  Lines                61782    61782           
  Branches              8061     8061           
================================================
+ Hits                 51328    51334    +6     
+ Misses                6981     6978    -3     
+ Partials              3473     3470    -3     
Flag Coverage Δ
ci 83.08% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-loop Created by codex-refactor-loop skill 🎉 phase:merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant