本卡屬 FR-196(母卡 FR-196 母案(同清單上一張)),卡 M-2,第一期批 4。只改 BE(主 repo,Repo 欄空著)。依賴:M-1。
第一期先接四個事件進通知中心:新任務指派、流程進到我負責的站、掃描新增嚴重弱點、新公告發布。每處在既有寄信那段旁邊加一行 notify(...),既有 Email 這期不動(第二期才改成由中心決定寄不寄)。注意收件人要用使用者 id 不是信箱,有兩處現在拿的是信箱,要回頭用上游的使用者物件。公告那處 jedi-bulletin 沒有「新增後」掛點(已查),在主系統側包一層薄 wrapper,做法卡上寫死。
extend 四處:在既有寄信那段旁邊加一行 notify(...)(第一期不拔 Email,第二期才改成由中心決定);收件人 reuse 各處已算好的清單(user_id 不是信箱——stage_entered 與 scan_alert 現在拿的是 email,要回頭用它們上游的 user 物件);公告收件人展開走主系統側一支小 query(send_scope ALL=租戶全員、ORG_UNIT=橋表部門成員)放 _notification_center_ports.py 的 recipient directory
repo:~/Projects/Billows/Audit-Manager/compliance-manager-be
改既有:app/flow_engine/service/workflow_execution_service.py(1246 附近加一行;🔴 檔 1,321 行超標,只加呼叫、不加邏輯)
改既有:app/flow_engine/service/stage_entered_notify_service.py(117 附近)
改既有:app/task_alert/service/scan_alert_app_service.py(74 附近)
改既有:core/plugins/bulletin.py(jedi-bulletin 沒有 after-add 掛點(已查,SchemaExtensions 只管 schema):在主系統側用一個薄 wrapper 包 `bulletin_service.add_bulletin`,成功後呼叫 notify;wrapper 放新檔 `app/notification_center/service/bulletin_published_notifier.py`,接線檔只換 services provider 那一行)
改既有:core/plugins/_notification_center_ports.py(recipient directory 加 bulletin_scope 展開)
新開:test/test_notification_center_events.py(四個事件各一條:呼叫後 inbox 多列且 recipient 是 user_id)
新開:app/notification_center/service/bulletin_published_notifier.py
新開:app/notification_center/service/task_event_params.py(參數組裝,讓超標檔只加一行)
workflow_execution_service.py 1246 附近:既有單封指派信旁加 notify("task.assigned", recipients=[assignee_user_id], subject=("job_execution", job.uid), params={...});🔴 檔已超標,只加呼叫行,參數組裝若超過兩行就抽到 app/notification_center/service/task_event_params.py(新檔)。stage_entered_notify_service.py 117 附近:_claim 現在拿 user.email,往上用 _with_caps(participants) 的 user 物件取 user_id;notify("stage.entered", ...)。scan_alert_app_service.py 74 附近:收件人同樣從上游 user 物件取 id;notify("scan.critical_found", ...)(型錄 mandatory=true 會自動鎖)。app/notification_center/service/bulletin_published_notifier.py 做一個薄 wrapper 類,add_bulletin(user, **kw) 轉呼叫既有 BulletinService.add_bulletin 後 notify("bulletin.published", recipients=Role("bulletin_scope", bulletin_uid=...), subject=("bulletin", uid), params={{title}});core/plugins/bulletin.py 的 BulletinServices(bulletin_service=...) provider 改指 wrapper(只換那一行)。收件人展開:send_scope=ALL 租戶全員、ORG_UNIT 走 bulletin_org_units 橋表部門成員,加進 _notification_center_ports.py 的 RecipientDirectory.expand_role('bulletin_scope', ...)。recipient_user_id 是整數 user id;DEV 手測四個事件。DEV 實測:指派一張任務給自己 → inbox 多一列 event_code=task.assigned、recipient_user_id=我、link 指到 my-tasks 帶 project/job/execution;流程進到我負責的站 → stage.entered 一列;掃描警示(可用既有手動觸發)→ scan.critical_found 一列且 mandatory=true;發一則公告(ALL)→ 租戶每人一列;既有信照常寄(看 task_alert_notifications 仍有新列);四條測試綠;wc -l 四個被改檔的行數增加 ≤ 3 行
~/Projects/Billows/Audit-Manager/compliance-manager-be/docs/features/FR-196-2611-notification-center/design.md §3 決策定案、§5 詳細設計(§5.1 套件職責與 port、§5.2 資料表、§5.3 API、§5.5 前端)、§6 拆卡表本卡那列、§8 風險;討論稿(Artifact,連結在 README)只在想知道「為什麼這樣裁」時看~/Projects/Billows/Audit-Manager/compliance-manager-be/docs/features/FR-196-2611-notification-center/prototype/index.html(四個分頁:鈴鐺、通知中心、通知設定、系統橫幅;純畫面,只取結構與資訊順序;文案依 i18n 重寫)jedi-bulletin/jedi_bulletin/plugin/(contract/assembly/migrations)、jedi-notification/README.md;主系統接線 core/plugins/bulletin.py、core/plugins/_host.py::host_defaults、core/plugins/license.py::TenantAdminDirectory;寄信點 app/flow_engine/service/workflow_execution_service.py:1246、stage_entered_notify_service.py:117、app/task_alert/service/scan_alert_app_service.py:74;既有投遞紀錄表 infra/task_alert/model/task_alert_notification.py;鈴鐺 FE src/layout/AppTopbar.vue 484~540、TopbarStageQueue.vue;seed 先例 scripts/sql/2026-05-22-seed-oscal-ssp-roles.sql、2026-11-10-fr194-ui-routes-entry-gates.sql