Skip to content

iter56 cluster-911: Studio Store → query/command ports + CQRS Core dispatch#919

Merged
loning merged 2 commits into
auto-refact-devfrom
refactor/iter56-cluster-911-studio-store-query-command
May 23, 2026
Merged

iter56 cluster-911: Studio Store → query/command ports + CQRS Core dispatch#919
loning merged 2 commits into
auto-refact-devfrom
refactor/iter56-cluster-911-studio-store-query-command

Conversation

@loning
Copy link
Copy Markdown
Contributor

@loning loning commented May 23, 2026

摘要

iter56 cluster-911 — Phase 9 r2 unanimous(narrowed scope:保留 Studio 行为 + 拆 Store):

  • I*Store → split:I*QueryPort(读)+ I*CommandPort/CommandService(写)
  • ActorCommandDispatcher 删除:被 CQRS Core dispatch 替代(IActorDispatchPort + 标准 EventEnvelope)
  • 写路径不再手拼 EventEnvelope,统一走命令骨架
  • Studio 行为完全保留(catalog / workspace / history / team / member 接口语义不变)
  • 涉及 IChatHistoryStore / IRoleCatalogStore / IConnectorCatalogStore + ActorBacked 实现 + Studio Projection CommandServices

边界

影响范围

src/Aevatar.Studio.Application/Studio/Abstractions/ (Store → QueryPort + CommandPort/Service split)
src/Aevatar.Studio.Infrastructure/ActorBacked/ (- ActorCommandDispatcher + StudioActorCommandDispatch)
src/Aevatar.Studio.Projection/CommandServices/ (CQRS Core dispatch + StudioProjectionActorCommandDispatch)
test/Aevatar.Studio.Tests/* + test/Aevatar.Tools.Cli.Tests/* + test/Aevatar.AI.Tests/*

LOC +827/-490 net +337(含拆分新建文件)

验证

  • bash tools/ci/test_stability_guards.sh PASS
  • bash tools/ci/architecture_guards.sh PASS
  • Studio 602 / CLI 107 / workspace 9 / NyxID chat endpoint coverage 72 = ALL PASS
  • dotnet build aevatar.slnx --nologo PASS

Closes #911

🤖 Auto-loop / codex-refactor-loop iter56

⟦AI:AUTO-LOOP⟧

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 23, 2026

📊 状态卡片 — reviewer 派出

维度
阶段 派出 codex(role=reviewer)
codex log review-pr919-omnibus-r1.log
工作目录 /Users/auric/aevatar
timeout 5400s(~90 min 上限)
上下文 omnibus r1 派出(architect+tests+quality;Studio Store cleanup,LOC +827/-490 net +337)
下一步自动会做 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 23, 2026

📊 状态卡片 — fix 派出

维度
阶段 派出 codex(role=fix)
codex log fix-pr919-r2.log
工作目录 /Users/auric/aevatar-wt-iter56-cluster-911-studio-store-query-command
timeout 5400s(~90 min 上限)
上下文 r1 reject(QueryPort 含 mutate method ImportLocalCatalog)→ fix r2 移到 CommandPort
下一步自动会做 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 23, 2026

📊 codex 进展 review-pr919-omnibus-r1 (⏳ 进行中; 已跑 9 min)


⟦AI:AUTO-LOOP⟧
tokens used
131,856
**Decision: Reject**

Finding: `IConnectorCatalogQueryPort` and `IRoleCatalogQueryPort` still contain `ImportLocalCatalogAsync`, but both implementations mutate state by ensuring the write actor and dispatching `*CatalogSavedEvent`. That means a `QueryPort` is not read-only, violating the CLAUDE.md application contract and the requested Tests check for “查询 port 只读”.

Refs:
- [IConnectorCatalogQueryPort.cs](/Users/auric/aevatar-wt-iter56-cluster-911-studio-store-query-command/src/Aevatar.Studio.Application/Studio/Abstractions/IConnectorCatalogQueryPort.cs:10)
- [ActorBackedConnectorCatalogStore.cs](/Users/auric/aevatar-wt-iter56-cluster-911-studio-store-query-command/src/Aevatar.Studio.Infrastructure/ActorBacked/ActorBackedConnectorCatalogStore.cs:96)
- [IRoleCatalogQueryPort.cs](/Users/auric/aevatar-wt-iter56-cluster-911-studio-store-query-command/src/Aevatar.Studio.Application/Studio/Abstractions/IRoleCatalogQueryPort.cs:10)
- [ActorBackedRoleCatalogStore.cs](/Users/auric/aevatar-wt-iter56-cluster-911-studio-store-query-command/src/Aevatar.Studio.Infrastructure/ActorBacked/ActorBackedRoleCatalogStore.cs:85)

Verification run:
- `test_stability_guards.sh`: pass
- `architecture_guards.sh`: pass
- `dotnet test test/Aevatar.Studio.Tests/Aevatar.Studio.Tests.csproj --nologo`: pass, 602/602
- Extra CLI check: pass, 496/496 locally, not 107/107
- `coverage-quality`: still pending in GitHub checks, so patch coverage ≥80% is not locally verified here

`ActorCommandDispatcher` is deleted from the Studio production diff, old `IChatHistoryStore/IConnectorCatalogStore/IRoleCatalogStore` refs are gone, and CQRS Core itself was not changed. The blocker is the query/command boundary leak.

REVIEW_DONE:919:omnibus:reject

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

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 23, 2026

📊 状态卡片 — reviewer 派出

维度
阶段 派出 codex(role=reviewer)
codex log review-pr919-omnibus-r3.log
工作目录 /Users/auric/aevatar
timeout 5400s(~90 min 上限)
上下文 omnibus r3 派出 verify r2 fix(ImportLocalCatalog 移到 CommandPort)
下一步自动会做 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 23, 2026

📊 codex 进展 review-pr919-omnibus-r3 (⏳ 进行中; 已跑 9 min)

+++ b//tmp/aevatar-guard-negative-r3/src/Aevatar.Studio.Application/Studio/Abstractions/IConnectorCatalogQueryPort.cs
@@ -7,5 +7,7 @@
 {
     Task<StoredConnectorCatalog> GetConnectorCatalogAsync(CancellationToken cancellationToken = default);
 
+    Task<StoredConnectorCatalog> SaveForbiddenAsync(CancellationToken cancellationToken = default);
+
     Task<StoredConnectorDraft> GetConnectorDraftAsync(CancellationToken cancellationToken = default);
 }

tokens used
120,399
Findings: none.

Verified r2 fix:
- `IConnectorCatalogQueryPort` / `IRoleCatalogQueryPort` are read-only: only `Get*` methods.
- `IConnectorCatalogCommandPort` / `IRoleCatalogCommandPort` own `ImportLocalCatalogAsync`, `Save*`, and `Delete*`.
- `ConnectorService` and `RoleCatalogService` now call `_commandPort.ImportLocalCatalogAsync(...)`.
- Negative guard probe: injected `SaveForbiddenAsync` into `IConnectorCatalogQueryPort`; `architecture_guards.sh` rejected it with `Studio catalog query ports must remain read-only`.
- Studio behavior covered by tests: `Aevatar.Studio.Tests` passed, 602 tests.

Local verification:
- `bash $REPO_ROOT/tools/ci/test_stability_guards.sh`: passed
- `bash $REPO_ROOT/tools/ci/architecture_guards.sh`: passed
- `dotnet test test/Aevatar.Studio.Tests/Aevatar.Studio.Tests.csproj --nologo`: passed

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

@codecov
Copy link
Copy Markdown

codecov Bot commented May 23, 2026

Codecov Report

❌ Patch coverage is 83.95062% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.22%. Comparing base (edc3b9c) to head (aefed23).
⚠️ Report is 1 commits behind head on auto-refact-dev.

Files with missing lines Patch % Lines
...ndServices/StudioProjectionActorCommandDispatch.cs 81.69% 10 Missing and 3 partials ⚠️
@@               Coverage Diff                @@
##           auto-refact-dev     #919   +/-   ##
================================================
  Coverage            83.21%   83.22%           
================================================
  Files                  990      991    +1     
  Lines                63408    63453   +45     
  Branches              8205     8209    +4     
================================================
+ Hits                 52768    52806   +38     
- Misses                7098     7106    +8     
+ Partials              3542     3541    -1     
Flag Coverage Δ
ci 83.22% <83.95%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ervices/ActorDispatchStudioMemberCommandService.cs 91.96% <100.00%> (-0.69%) ⬇️
...dServices/ActorDispatchStudioTeamCommandService.cs 97.00% <100.00%> (-0.20%) ⬇️
...DependencyInjection/ServiceCollectionExtensions.cs 95.28% <100.00%> (+0.09%) ⬆️
...ndServices/StudioProjectionActorCommandDispatch.cs 81.69% <81.69%> (ø)

... and 3 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.

loning added 2 commits May 24, 2026 02:43
…spatch

- I*Store → I*QueryPort + I*CommandPort/CommandService split
- ActorCommandDispatcher 删除(被 CQRS Core dispatch 替代)
- IChatHistoryStore / IRoleCatalogStore / IConnectorCatalogStore + ActorBacked 实现 + Studio Projection CommandServices 重构
- Studio 行为完全保留(catalog/workspace/history/team/member 接口语义不变)
- 写路径走 IActorDispatchPort + 标准 EventEnvelope 构造(不再手拼)
- 不新增 Core types / pipeline phase / docs/canon vocabulary

LOC +827/-490 net +337
Studio tests 602/602 PASS + CLI 107 + workspace 9 + NyxID chat 72 = all PASS
test_stability_guards.sh + architecture_guards.sh PASS

⟦AI:AUTO-LOOP⟧
omnibus r1 reject:
- ImportLocalCatalogAsync 在 QueryPort 但实现 mutate state(违反"查询 port 只读")

修复:
- 移到 IConnectorCatalogCommandPort + IRoleCatalogCommandPort
- ConnectorService + RoleCatalogService 改走 _commandPort
- 加 architecture guard 验证 Studio catalog query port 拒绝 mutate verb

local PASS: test_stability_guards.sh + architecture_guards.sh + Studio 602/602

⟦AI:AUTO-LOOP⟧
@loning loning force-pushed the refactor/iter56-cluster-911-studio-store-query-command branch from a1cdf42 to aefed23 Compare May 23, 2026 18:45
@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 23, 2026

📊 状态卡片 — reviewer 派出

维度
阶段 派出 codex(role=reviewer)
codex log review-pr919-omnibus-r4.log
工作目录 /Users/auric/aevatar
timeout 5400s(~90 min 上限)
上下文 post-rebase + force-push → omnibus r4 派出 verify consensus boundary 仍守
下一步自动会做 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 23, 2026

📊 codex 进展 review-pr919-omnibus-r4 (⏳ 进行中; 已跑 9 min)


Worktree stayed clean.

REVIEW_DONE:919:omnibus:approve
⟦AI:AUTO-LOOP⟧
tokens used
157,319
**Findings**

No blocking findings. The post-rebase diff keeps the consensus boundaries intact:

- Query ports remain read-only: catalog and chat query ports expose only `Get*` methods.
- Command ports own mutation: `Import/Save/Delete` moved to command ports.
- No new Core types were added; new dispatch wrappers are Studio-scoped.
- Studio behavior is covered by existing controller/service/store tests.
- #916 committed-state activation remains registered through `CommittedStateProjectionActivationHook` and `StudioCommittedStateProjectionActivationPlanProvider`.

**Verification**

Passed:
- `bash $REPO_ROOT/tools/ci/test_stability_guards.sh`
- `bash $REPO_ROOT/tools/ci/architecture_guards.sh`
- `dotnet test test/Aevatar.Studio.Tests/Aevatar.Studio.Tests.csproj --nologo` → 604 passed

Worktree stayed clean.

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

@loning loning merged commit 6d9aea2 into auto-refact-dev May 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant