Skip to content

[Channel RFC] Base class extraction (PerEntryDocumentProjector + ISchedulable) #259

@eanzhao

Description

@eanzhao

Parent RFC: #254

Scope

Base class 抽取消除现有 ChannelRuntime 里的重复代码。

Deliverables

PerEntryDocumentProjector<TEntry, TDocument> (Aevatar.GAgents.Channel.Abstractions):

  • 替代 3 个 verbatim projector: AgentRegistryProjector / ChannelBotRegistrationProjector / DeviceRegistrationProjector
  • Base class 负责 committed-state unpack、per-entry key/verdict loop、以及 upsert vs. IProjectionWriteDispatcher.DeleteAsync dispatch
  • 子类只保留 ExtractEntries + EntryKey + Materialize + optional Evaluate
  • State-level tombstone retention(§7.1.1 watermark coordination):
    • ExtractEntries 返回 including tombstoned entries(不物理移除)
    • EvaluateIsDeleted=true → 返 Tombstone
    • Loop 在 Tombstone verdict 调 IProjectionWriteDispatcher.DeleteAsync
    • Housekeeping job 清理 watermark 之前的 tombstoned entries

ISchedulable + ScheduleStateAevatar.GAgents.Channel.Abstractions):

  • 替代 SkillRunnerGAgentWorkflowAgentGAgent 里的 scheduler 重复
  • 组合不继承:ISchedulable marker interface + ScheduleState data container + extension methods / shared runner
  • 剩余代码只保留各自 GAgent 的状态转换、业务 dispatch 与 actor-specific glue
  • 硬编码 Platform = "lark" 一起清理(见 SkillRunnerGAgent.cs:321 / WorkflowAgentGAgent.cs:263

Out of scope (#260)

  • AgentRegistry → UserAgentCatalog 改名 → 独立 sub issue(9 个文件批量改 + caller 更新)

Acceptance

  • 3 个 projector 已共享 PerEntryDocumentProjector 主循环与 verdict dispatch;子类仅保留领域相关的 ExtractEntries / EntryKey / Materialize / Evaluate
  • 2 个 scheduler 已共享统一的 schedule / cancel 编排骨架;剩余差异代码仅保留各自 GAgent 的状态转换与业务语义
  • State-level tombstone retention 与 watermark-driven housekeeping 已端到端完成
  • 所有原有测试通过
  • Projector watermark coordination / housekeeping / delete confirmation 的单测与回归测试已覆盖

注:原先的 LOC 降幅(如 ≥ 40% / ≥ 70%)仅作为设计期的启发式目标,不再作为合并或关闭 issue 的硬性验收标准。验收以“重复控制流是否真正抽离、剩余代码是否主要为不可共享的领域语义、行为与测试是否成立”为准。

References

  • RFC §7.1 PerEntryDocumentProjector<TEntry, TDocument>
  • RFC §7.1.1 Tombstone retention 与 projector watermark 协调
  • RFC §7.2 ISchedulable + ScheduleState

Dependencies

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions