Skip to content

iter57 cluster-067: 删 projection actorId ensure surfaces + Inspector cleanup (#943)#944

Merged
loning merged 2 commits into
auto-refact-devfrom
refactor/iter57-cluster-067-projection-ensure-delete
May 24, 2026
Merged

iter57 cluster-067: 删 projection actorId ensure surfaces + Inspector cleanup (#943)#944
loning merged 2 commits into
auto-refact-devfrom
refactor/iter57-cluster-067-projection-ensure-delete

Conversation

@loning
Copy link
Copy Markdown
Contributor

@loning loning commented May 24, 2026

摘要

iter57 cluster-067(severity:medium)— 删 internal projection actorId ensure surfaces + Inspector cleanup + 强化 guard

  • Old:StudioCurrentStateProjectionPort + scripting 模块的内部 actorId-based ensure helpers 仍可被生产代码用作"读 actor 现态"侧门,违反 "Projection 只消费 committed 事实" + "查询始终走 readmodel"
  • New:删 production projection-port actorId ensure helpers;集成测试改用 typed IProjectionScopeActivationService<TLease> bootstrap;Inspector stale registration 清理;guard 加强防回流

违反:CLAUDE.md「权威状态 / ReadModel / Projection」「禁止侧读冒充 query」「禁止 query-time replay/priming」

Phase 9 共识链路

Round Verdict
r1 converge:choose exact deletion boundary + regression test scope
r2 converge:Inspector demo cleanup + C# regression-test scope
r3 META_JUDGE_DONE:consensus:delete:delete internal actorId projection ensure surfaces, include Inspector stale registration cleanup, use strengthened guard plus existing behavior tests

详见 issue #943

Scope

  • StudioCurrentStateProjectionPort + DI registrations
  • 删 scripting 内部 actorId-based ensure helpers
  • 集成测试 bootstrap → typed IProjectionScopeActivationService<TLease>
  • Inspector stale registration cleanup
  • tools/ci/public_projection_ensure_ports_guard.sh 加强

local PASS:architecture_guards + test_stability_guards + dotnet build

closes #943

🤖 Generated with Claude Code via codex-refactor-loop iter57

⟦AI:AUTO-LOOP⟧

移除 Studio/Scripting projection port 内部 ensure helper,并将测试激活迁移到 typed activation service。

补充 Inspector stale registration cleanup 与 guard 防回流。

⟦AI:AUTO-LOOP⟧
@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 24, 2026

📊 状态卡片 — reviewer 派出

维度
阶段 派出 codex(role=reviewer)
codex log review-pr944-omnibus-r1.log
工作目录 /Users/auric/aevatar
timeout 5400s(~90 min 上限)
上下文 omnibus 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 24, 2026

📊 状态卡片 — fix 派出

维度
阶段 派出 codex(role=fix)
codex log fix-pr944-r2.log
工作目录 /Users/auric/aevatar
timeout 5400s(~90 min 上限)
上下文 r1 reject 2 blockers(guard awk 漏 internal + Inspector test fail)→ fix r2
下一步自动会做 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 24, 2026

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

exec
/bin/zsh -lc 'git status --short --branch' in /Users/auric/aevatar
 succeeded in 0ms:
## pr-944

codex
**Findings**

1. `tools/ci/public_projection_ensure_ports_guard.sh` does not catch the exact regression it claims to prevent. I temporarily reintroduced a multi-line `internal EnsureActorProjectionAsync(string actorId, ...)` helper in `ScriptExecutionProjectionPort.cs`; the guard still printed `public_projection_ensure_ports_guard: ok`. The current regex misses `internal` in `ensure_declaration_hits` and the new actorId check requires the actorId parameter on the same line as the method declaration. See [public_projection_ensure_ports_guard.sh](/Users/auric/aevatar/tools/ci/public_projection_ensure_ports_guard.sh:16) and [public_projection_ensure_ports_guard.sh](/Users/auric/aevatar/tools/ci/public_projection_ensure_ports_guard.sh:52).

2. The new Inspector cleanup test fails on PR head. `dotnet test test/Aevatar.Demos.Inspector.Tests/Aevatar.Demos.Inspector.Tests.csproj --no-restore --nologo` fails because `ActorsEndpoint_ShouldReflectInspectorUnregisterCleanup` gets an empty `Groups` collection immediately after register/unregister. The assertion at [InspectorEndpointsTests.cs](/Users/auric/aevatar/test/Aevatar.Demos.Inspector.Tests/InspectorEndpointsTests.cs:73) is currently not verified by the test run.

Other targeted guards passed: `public_projection_ensure_ports_guard.sh`, `query_projection_priming_guard.sh`, and `test_stability_guards.sh`. The production deletion itself looks directionally clean, but the stated guard strengthening and test coverage are not actually reliable yet.

REVIEW_DONE:944:omnibus:reject
⟦AI:AUTO-LOOP⟧
tokens used
95,781
**Findings**

1. `tools/ci/public_projection_ensure_ports_guard.sh` does not catch the exact regression it claims to prevent. I temporarily reintroduced a multi-line `internal EnsureActorProjectionAsync(string actorId, ...)` helper in `ScriptExecutionProjectionPort.cs`; the guard still printed `public_projection_ensure_ports_guard: ok`. The current regex misses `internal` in `ensure_declaration_hits` and the new actorId check requires the actorId parameter on the same line as the method declaration. See [public_projection_ensure_ports_guard.sh](/Users/auric/aevatar/tools/ci/public_projection_ensure_ports_guard.sh:16) and [public_projection_ensure_ports_guard.sh](/Users/auric/aevatar/tools/ci/public_projection_ensure_ports_guard.sh:52).

2. The new Inspector cleanup test fails on PR head. `dotnet test test/Aevatar.Demos.Inspector.Tests/Aevatar.Demos.Inspector.Tests.csproj --no-restore --nologo` fails because `ActorsEndpoint_ShouldReflectInspectorUnregisterCleanup` gets an empty `Groups` collection immediately after register/unregister. The assertion at [InspectorEndpointsTests.cs](/Users/auric/aevatar/test/Aevatar.Demos.Inspector.Tests/InspectorEndpointsTests.cs:73) is currently not verified by the test run.

Other targeted guards passed: `public_projection_ensure_ports_guard.sh`, `query_projection_priming_guard.sh`, and `test_stability_guards.sh`. The production deletion itself looks directionally clean, but the stated guard strengthening and test coverage are not actually reliable yet.

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

…or test 确定性 await

PR #944 r1 reject 2 blockers:
- public_projection_ensure_ports_guard.sh 漏 internal/多行 method signature
- InspectorEndpointsTests.ActorsEndpoint_ShouldReflectInspectorUnregisterCleanup 实际 fail

修:
- guard awk 覆盖 internal + multi-line method signature(actorId 后续行也算)
- Inspector test 用 deterministic await(non Task.Delay),等 cleanup 实际生效
- 临时探针验证 guard 拦得住,移除后 pass
- Inspector test 8/8 passed

⟦AI:AUTO-LOOP⟧
@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 24, 2026

📊 状态卡片 — reviewer 派出

维度
阶段 派出 codex(role=reviewer)
codex log review-pr944-omnibus-r3.log
工作目录 /Users/auric/aevatar
timeout 5400s(~90 min 上限)
上下文 fix r2 done → omnibus r3 验证 guard + Inspector test
下一步自动会做 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 24, 2026

📊 codex 进展 fix-pr944-r2 (⏳ 进行中; 已跑 11 min)

     -g '*CurrentStateProjectionPort.cs' \
     -g '*MaterializationPort.cs' \
     -g '!**/bin/**' \
-    -g '!**/obj/**' \
+    -g '!**/obj/**') \
     || true
 )"
 

tokens used
112,924
Fixed both blockers.

Changed:
- `tools/ci/public_projection_ensure_ports_guard.sh`
  - Covers `internal` Ensure methods.
  - Uses awk signature accumulation so multi-line `actorId/sessionActorId/rootActorId` parameters are caught.
- `test/Aevatar.Demos.Inspector.Tests/InspectorEndpointsTests.cs`
  - Test now waits deterministically for readmodel upsert activity and verifies registration state before unregister cleanup, then verifies cleanup after the next materialized state.

Verified:
- Temporary `internal EnsureActorProjectionAsync(` with `actorId` on the next line failed the guard.
- Removed temporary helper, guard passes.
- `dotnet test test/Aevatar.Demos.Inspector.Tests/Aevatar.Demos.Inspector.Tests.csproj --no-restore --nologo` passes: 8/8.
- `bash tools/ci/test_stability_guards.sh` passes.

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

@loning
Copy link
Copy Markdown
Contributor Author

loning commented May 24, 2026

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

 succeeded in 431ms:
972c981984aee1e85b45d64580839415039308b3

codex
approve

Verified PR #944 head `972c981984aee1e85b45d64580839415039308b3`.

- Guard negative check: temporary `internal Task EnsureProjectionAsync(... string actorId ...)` with multi-line signature correctly failed `tools/ci/public_projection_ensure_ports_guard.sh`.
- Guard clean check: passed after removing the temporary fixture.
- Inspector tests: `dotnet test test/Aevatar.Demos.Inspector.Tests/Aevatar.Demos.Inspector.Tests.csproj --nologo` passed `8/8`.
- No review edits left in the worktree; production projection delete was not touched.

REVIEW_DONE:944:omnibus:approve
⟦AI:AUTO-LOOP⟧
tokens used
94,456
approve

Verified PR #944 head `972c981984aee1e85b45d64580839415039308b3`.

- Guard negative check: temporary `internal Task EnsureProjectionAsync(... string actorId ...)` with multi-line signature correctly failed `tools/ci/public_projection_ensure_ports_guard.sh`.
- Guard clean check: passed after removing the temporary fixture.
- Inspector tests: `dotnet test test/Aevatar.Demos.Inspector.Tests/Aevatar.Demos.Inspector.Tests.csproj --nologo` passed `8/8`.
- No review edits left in the worktree; production projection delete was not touched.

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

@codecov
Copy link
Copy Markdown

codecov Bot commented May 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.53%. Comparing base (f82a239) to head (972c981).
⚠️ Report is 36 commits behind head on auto-refact-dev.

@@                 Coverage Diff                 @@
##           auto-refact-dev     #944      +/-   ##
===================================================
+ Coverage            82.83%   83.53%   +0.69%     
===================================================
  Files                  998      987      -11     
  Lines                63092    63614     +522     
  Branches              8161     8220      +59     
===================================================
+ Hits                 52261    53138     +877     
+ Misses                7304     6914     -390     
- Partials              3527     3562      +35     
Flag Coverage Δ
ci 83.53% <ø> (+0.69%) ⬆️

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

Files with missing lines Coverage Δ
...ion/Orchestration/ScriptEvolutionProjectionPort.cs 80.00% <ø> (-6.05%) ⬇️
...ion/Orchestration/ScriptExecutionProjectionPort.cs 85.71% <ø> (-8.41%) ⬇️
...DependencyInjection/ServiceCollectionExtensions.cs 95.23% <ø> (-4.77%) ⬇️

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant