-
Notifications
You must be signed in to change notification settings - Fork 0
Project First Refactor Log
uplusplus edited this page Apr 14, 2026
·
3 revisions
最后更新: 2026-04-14 14:27 GMT+8
把 Catown 从以 chatroom/message + pipeline 为中心的旧架构,重构为以 Project / Asset / Decision / StageRun 为中心的新内核。
核心目标:
- 让
Project成为真正的业务主语 - 让
Asset承载核心产出和上下文 - 让
Decision成为显式 gate - 让
StageRun成为统一的推进记录 - 让旧
chatroom和pipeline降级为协作层/执行层,而不是产品主骨架
- 完成现状审计,确认旧系统主轴仍是
chatroom/message + pipeline - 形成完整 ADR 链,锁定新核心模型、主 API、迁移映射、Schema、服务层拆分方向
- 在后端新增
/api/v2,与 legacy API 并行 - 在数据库中补齐项目优先的核心模型与关系模型
- 跑通最小可运行主链:
- 创建项目
- 生成
project_brief scope_confirmationproduct_definitionbuild_executionqa_validationrelease_preparationrelease_approvalreleased
- 持久化资产、阶段、决策之间的关系:
StageRunAssetDecisionAssetAssetLink
- 补齐
v2读模型:GET /api/v2/dashboardGET /api/v2/projects/{id}/overviewGET /api/v2/assets/{id}GET /api/v2/stage-runs/{id}
- 标准化 dashboard 卡片协议:
project_cards.release_readinessrelease_readiness.next_gate-
awaiting_release_approval等更明确状态
- 抽出第一批 coordinator / read-model builder:
backend/orchestration/project_flow_coordinator.pybackend/orchestration/decision_effects.pybackend/read_models/project_views.py
- 抽出初始项目启动 coordinator:
backend/orchestration/project_bootstrap_coordinator.py-
create_project()的首轮briefing -> project_brief -> scope_confirmation初始化不再内联在ProjectService
- 统一 stage lifecycle 基础语义:
phaseis_activeis_terminalrequires_attention
- 收紧 v2 资产依赖链:
build_artifact <- prd + ux_blueprint + tech_specrelease_pack <- build_artifact + test_report
- 建立新的 project-first execution kernel:
backend/execution/stage_execution_kernel.pybackend/execution/bootstrap_stage_executor.py
- 明确
legacy_pipeline_adapter不再是默认路线;旧pipeline/改为待审查资产 - 完成
pipeline文件级去留审计:保留 / 改造 / 废弃 - 抽出第一批 runtime primitive:
backend/execution/workspace_guard.pybackend/execution/event_log.py
- 为新内核补最小执行 contract:
StageExecutionResult - 为
StageRun补最小事件/指令入口:GET /api/v2/stage-runs/{id}/eventsPOST /api/v2/stage-runs/{id}/instructions
- 让
Event初步挂到 project-first 语义:project_idstage_run_idasset_id
- 继续把可复用 runtime primitive 从
backend/pipeline/engine.py抽成独立薄模块 - 明确 autopilot / checkpoint 在新 kernel 层的分流点
- 为真实 stage executor 设计完整输入/输出 contract
- 为新内核补
tasks / agent_runs / audit的挂接策略 - 前端逐步去 pipeline 化,Mission Board 替代旧 pipeline dashboard 主视图
- 本地环境缺少完整运行依赖,无法做完整回归:
pytest: command not found/usr/bin/python3: No module named pytestModuleNotFoundError: No module named 'openai'
- 当前主要依赖静态校验:
python3 -m py_compile ...
-
1e4a9aaTighten asset dependency flow for v2 stages -
3640d19Introduce a project-first stage execution kernel -
056b5d8Audit legacy pipeline and extract workspace guards -
541d17eAdd project-first stage events and executor contract -
e58539eLog refactor progress and extract shared event sink -
3935398Standardize v2 dashboard cards and extract flow coordinator -
97e87fdExtract decision effects and normalize stage lifecycle -
2381a45Extract stage execution and project read models -
40ca886Extract initial project bootstrap coordinator
这些提交意味着:
- 新主轴已经从“给旧 pipeline 做桥”切换到“建设新的 stage execution kernel”
- stage 执行、资产关系、事件记录已经开始围绕
Project / Asset / Decision / StageRun重新组织 - 旧
pipeline/engine.py正在被拆成可回收的薄能力,而不是继续作为默认继承对象 -
continue_project()已不再直接把推进逻辑塞在ProjectService中 -
resolve_decision()的 scope/release 副作用已经拆进独立 coordinator -
create_project()的首轮 bootstrap 也已经拆进独立 coordinator - stage bootstrap / asset generation 已经从 service 主体中抽离
-
dashboard / overview聚合已经转入 read-model builder
docs/ADR-015-current-architecture-gap-analysis.mddocs/ADR-020-service-layer-and-implementation-plan.mddocs/ADR-021-pipeline-disposition-and-stage-execution-kernel.mddocs/pipeline-file-audit.mddocs/worklog-2026-04-14-project-first-refactor.md
- 新建
asset_service,下沉:- 资产创建/换版
- 资产依赖链接
- 审批状态更新
- 新建
decision_service,下沉:- 决策创建
- 决策读取
- resolve 前置校验
- 新建
stage_run_service,下沉:- stage run 排队
- stage run 状态迁移
- stage input/output 关系补写
- 继续把
create_project / continue_project / resolve_decision三条主路径收束成更薄的 application service 入口
- 评估旧
pipeline执行引擎中可复用能力 - 设计
legacy_pipeline_adapter/stage_execution_adapter - 把 bootstrap 产物生成逐步替换为真实执行接线
- 先把
bootstrap_stage_executor.py内联的阶段产物描述拆成更清晰的 stage spec / asset recipe
- 固化
project_cards字段集,避免继续漂移 - 固化
overview中:release_readinessrecommended_next_actionstage_summaryrecent_activity
- 规划前端主入口从 legacy 项目壳迁移到
v2项目中心视图
- 设计 legacy 数据到新模型的迁移脚本
- 在依赖补齐后运行真实 route/API 测试
- 增加更细的 service/coordinator 层回归测试
- 当前环境恢复
pytest后,补一次backend/tests/test_api_routes.py的完整回归
这次重构最重要的进展,不只是“多了几个接口”,而是业务骨架已经开始真正脱离旧 chatroom/pipeline 世界观。
当前状态可以概括为:
- 新内核已立住
- 最小闭环已能跑
- 执行层边界开始清晰
- 当前重点转为:继续抽离旧 runtime primitive,补真实 executor contract,并逐步去 pipeline 化前端主视图