建立日期:2026-05-15 撰寫:raymond(透過 Claude Opus 4.7 session) 接手對象:stg 部署執行者 + 後續 bug fix / BDD 階段 狀態:spec 4 全範圍開發完成(BE / FE / 內部套件 / 文件齊全),等 stg deploy + smoke
review 階段 + 範本方向性驗證 + 全 stage 共用留言feature/project-flow-engine-review(未 push)design.md v1.5(§16.1–§16.8 reconciliation 完整)docs/conversation-history/2026-05-13-review-stage-and-flow-validation/SUMMARY.md(gitignored 本地檔)按 design.md / implementation-plan.md 完整 ship:
| Milestone | 範圍 |
|---|---|
| M0 | Pre-flight verification |
| M1 | compliance.stage_objects 加 4 欄方向性驗證 + seed review row |
| M2 | Domain entity / mapper / model 對應 |
| M3 | BpmnTopologyValidator 純函式 + 22 條 unit test |
| M4 | Builtin BPMN seed (builtin-full-audit-with-review) + 既有 builtin-full-audit reverse patch |
| M5 | Error code + FlowTemplate validator 整合 |
| M6 | POST /flow-engine/flow-templates/validate endpoint |
| M7 | StageAdvanceRequestSchema 加 decision/comment + ReviewDecisionHandler |
| M8 | StageAdvanceService 接 decision/comment + JobComment 整合 |
| M9 | Integration test(service mock + HTTP smoke) |
| M10 | FE Banner 雙按鈕 + ConfirmDialog comment + BPMN editor inline validator |
| M11.1 | dev manual smoke + 4 個 root cause bug fix |
| M11.3 | 10 條 changelog 齊全 |
| Bug | Commit | Fix |
|---|---|---|
| task_execution → review 提前改 AP.status='auditing' | 5fba3bf |
拆 launch_audit / 加 submit_for_review,TaskExecutionHandler review-aware 分流 |
| 執行任務階段按鈕寫死「啟動稽核」 | 1c8d08c |
stage_objects 加 entry_button_label_i18n,BE peek 下一個 stage 動態決定 button |
| 退回後 BPMN 走錯 → 走到稽核 | jedi-flow-engine 67e979f (0.0.29) |
_fmt(str) 改用單引號(Camunda FEEL 標準) |
| reviewer 角色 launch_audit 403 | 1c8d08c |
launch_audit 加 trusted_caller flag 跳過冗餘角色二次驗 |
| 範圍 | Commit |
|---|---|
| flow_templates.status draft/published 狀態機 + publish/unpublish endpoint | BE 3ff38d9 |
| BPMN editor writeCamundaProp fix(modeling.updateModdleProperties)+ smart Gateway condition UI + Toolbar 發布按鈕 | FE bef1cc4 |
教訓(已寫進
docs/claude/feature-development-workflow.md):這部分該開新 spec 不該塞回 spec 4 branch。後續 spec 遵守「衍生 feature 離開本 spec scope」規則。
9625a8f docs(claude): feature-development-workflow 加 Spec Sizing 4 規則 + Phase 1 walkthrough
b95e8ac fix(deploy): verify SELECT 欄位名 sort_order → sort
88b608e chore(deploy): BPMN 整合 feature 單一 SQL 入口 — \ir 整合 6 個 migration
72f27e5 chore(deploy): spec 1+2+3 整合性部署 SQL(idempotent,stg/prod 用)
0613750 chore: bump jedi-flow-engine 0.0.28 → 0.0.29
c945c12 docs(spec4): design.md v1.5 — §16.4–§16.8 reconciliation
3ff38d9 feat(flow-template): draft/publish 狀態機 + unpublish + topology 規則放寬
1c8d08c fix(spec4): review stage 三 bug 修復 + multi-review 架構支援
5fba3bf fix(spec4-be): task_execution → review 不再提前改 AP.status='auditing'
5bb4754 docs(spec4): handoff-v2
... (M0–M9 commits 略,見 SUMMARY.md §2)
bef1cc4 feat(flow-template): BPMN editor writeCamundaProp fix + smart gateway + draft/publish UI
e65a626 fix(spec4-fe): review reject 成功 toast 區分「已退回」非「已推進」
50821bb tweak(spec4-fe): code review 反饋 — readonly guard / 空白範本跳過初始 validate / 移除 silent return
317c36b fix(spec4-fe): i18n key spread overwrite + 補 3 條 validator rule i18n
bdc6c59 feat(spec4-fe): review stage 雙按鈕 + BPMN editor inline validator
67e979f chore: bump 0.0.28 → 0.0.29
537ad2d fix: review fix H3+M2 — BPMN gateway no-match warning + sub_workflow missing raise
?? scripts/sql/spec3_phase6_pr1_audit_completed_projects.sql
→ spec 3 PR1 髒資料審計工具(純 SELECT + commented UPDATE template),stg/prod 部署時手動跑 audit query;不該入 spec 4 branch。
# 在 terminal 互動跑(GitLab 認證需要互動 prompt)
cd ~/Projects/Billows/Audit-Manager/compliance-manager-be
git push origin feature/project-flow-engine-review
cd ~/Projects/Billows/Audit-Manager/compliance-manager-fe
git push origin feature/project-flow-engine-review# 密碼透過 ~/.pgpass 或 PGPASSWORD env var(不寫進 SQL 檔)
PGPASSWORD='<stg_password>' \
psql -h <stg_host> -p <stg_port> -U cmmgr -d <stg_db> \
-v ON_ERROR_STOP=1 \
-f scripts/sql/2026-05-15-bpmn-integration-deploy-all.sqlSQL 內建:
\ir relative include,從 BE repo root 跑可自動找到同目錄 SQLpoetry install + 重啟 BE / FEpyproject.toml 已 pin jedi-flow-engine==0.0.29(已推 Nexus)poetry install 會抓 0.0.29完整 checklist 見 SUMMARY.md §6.5(簡化版);或本 session 對話末段「Stg Smoke Checklist 簡化版」。
關鍵驗證點:
| # | 步 | 預期 |
|---|---|---|
| 1 | task_execution 階段按鈕 | 「送審」(不是「啟動稽核」) |
| 2 | task_execution → review | AP.status 維持 active(不變 auditing) |
| 3 | Review 階段 banner | 「啟動稽核」+「退回」雙按鈕 |
| 4 | 「檢視稽核結果」按鈕 | review 階段不該出現 |
| 5 | Reject + 留言 | BPMN 回 task_execution,toast「已退回審核」 |
| 6 | Approve | BPMN 走到 audit,AP.status 變 auditing,「檢視稽核結果」按鈕出現 |
| 7 | Spec 2 回歸 | launch_new_round 切「完整稽核流程」(無 review)→ 走原本 4-stage |
| 8 | Flow-template editor | 建範本 = draft;違規 sequenceFlow 紅框;publish/unpublish;smart gateway condition 下拉;draft 範本不能用於新專案 |
# spec 3 PR1 髒資料審計(找被誤推到 COMPLETED 的 project)
psql -h <stg_host> -p <port> -U cmmgr -d <stg_db> \
-f scripts/sql/spec3_phase6_pr1_audit_completed_projects.sql
# 純 SELECT 不破壞資料,看 Query 1+2 結果決定是否要跑 commented UPDATE templateSmoke 撞到 bug 時:
tail -f log/app.log | grep -iE "WARN|ERROR|advance_stage|review_decision|launch_audit|condition_param"/stage/advance / /validate request payload + response(特別是 error_code 欄位)| 項目 | 看哪 |
|---|---|
| jedi-common 吞掉 ValidationError msg | design §16.2 — FE 必須走 error_code i18n 不靠 msg |
| launch_audit 提前 / 不該動 status | design §16.3 — submit_for_review vs launch_audit 拆分 |
| Multi-review 串接 | design §16.4 — _peek_next_stage_code_via_jobs 穿越 Gateway default |
| Button label 寫死 | design §16.5 — entry_button_label_i18n 動態 |
| Gateway condition 引號 | design §16.6 — Camunda FEEL 單引號 |
| Topology 規則放寬 | design §16.7 — review 可接 review/planning/task_execution/audit |
Mapped[] 對欄位名(本 session 踩過 sort_order vs sort 的雷,commit b95e8ac)git add <檔名>,不 -A / -am| # | 主題 | 狀態 |
|---|---|---|
| 5 | M11.2 BDD scenario(compliance-manager-test repo) | ⏸️ deferred — 等 smoke 結束 + bug fix 跑完 |
| 8 | Follow-up:推進日誌 + 階段 comment 視圖 | 🟡 下個 spec 範圍 |
~/Projects/Billows/Audit-Manager/compliance-manager-testfeature/project-flow-engine-reviewfeatures/flow-engine-review/review-stage.feature + step definitions + page objectnpm run test:bdd -- --tags @flow-engine-review需求:跨階段 timeline 可查「誰 / 何時 / 在哪個階段做了推進 / decision / comment」用來除錯。
階段留言(review approve/reject comment, M8 已寫進 compliance.job_comments)順便在這個視圖呈現。
UI 位置 caveat:
docs/api/flow-engine/api-spec.md + design.md 尚未同步 publish / unpublish / validate 三個新 endpointe65a626 (review reject toast 區分) 無獨立 changelog(屬 UI 文案小調可不補;或 2026-05-15-tweak-fe-review-reject-toast.md)結論:spec 4 太長(3 天 / 33 commits / design.md 5 版 / §16 8 條 / smoke 4 bug / 衍生 feature 混入)。
4 條教訓已寫進 docs/claude/feature-development-workflow.md(commit 9625a8f):
| 規則 | 重點 |
|---|---|
| 1 | 一個 spec = 一個 user-facing 完整情境(垂直切)— 判準:「先 ship 這個 spec,user 能不能拿來用?」 |
| 2 | Design phase 強制做 user mental walkthrough — 寫 user 操作流程 + 狀態變化 + 按鈕條件 + 錯誤情境 |
| 3 | 衍生 feature 離開本 spec scope(不一定下階段立刻做,是 scope discipline 不是 prioritization) |
| 4 | 3 天時間盒 — 超過必拆 |
Spec 4 應該的切分:
| 假想 spec | Scope | 預估 |
|---|---|---|
| 4a Review stage core | schema 4 欄 + validator + ReviewDecisionHandler + builtin BPMN + FE banner 雙按鈕 + i18n | 2 天 |
| 4b Flow-template lifecycle | flow_templates.status 狀態機 + publish/unpublish + Editor toolbar | 1.5 天 |
| 4c BPMN editor enhancements | inline validator + smart gateway condition UI + writeCamundaProp fix | 1.5 天 |
| 文件 | 位置 |
|---|---|
| 整合 SUMMARY(含 commits / 改動範圍 / 行為差異 / deploy handover / smoke checklist) | docs/conversation-history/2026-05-13-review-stage-and-flow-validation/SUMMARY.md(gitignored) |
| Spec 4 design | docs/features/FR-026-2605-project-flow-engine-integrate/04-review-stage-and-flow-validation/design.md v1.5 |
| Spec 4 implementation plan | 同目錄 implementation-plan.md v1.1 |
| Handoff v1 / v2 / v3(本檔) | 同目錄 |
| Changelogs | docs/changelog/2026-05-14-* + 2026-05-15-* 共 10 條 |
| Analysis | docs/analysis/2026-05-15-review-stage-three-bugs.md + 2026-05-15-flow-template-bpmn-editor-design.md |
| Workflow SOP(4 規則 + walkthrough) | docs/claude/feature-development-workflow.md(commit 9625a8f) |
| 部署單一 SQL 入口 | scripts/sql/2026-05-15-bpmn-integration-deploy-all.sql |
| Spec 3 髒資料 audit(local-only) | scripts/sql/spec3_phase6_pr1_audit_completed_projects.sql |
回報並建議:
log/app.log 完整 traceback;確認 jedi-flow-engine==0.0.29 真的裝起來(poetry show jedi-flow-engine)docs/issues/pending/<file>.mdcompliance-manager-test 既有 banner BDD(spec 2 / spec 3 留下的)| 版本 | 日期 | 變更 |
|---|---|---|
| v1 | 2026-05-14 | M0–M6 完成、M7 起手交接 |
| v2 | 2026-05-14 | M7–M9 完成、M10 起手交接(FE + 收尾) |
| v3 | 2026-05-15 | 最終交接 — spec 4 全 ship + 衍生 flow-template editor + retrospective 教訓;等 stg deploy + smoke + bug fix |