本卡屬 FR-196(母卡 FR-196 母案(同清單上一張)),卡 M-2,第一期批 4。只改 BE(主 repo,Repo 欄空著)。依賴:M-1。

這張卡做什麼(白話)

第一期先接四個事件進通知中心:新任務指派、流程進到我負責的站、掃描新增嚴重弱點、新公告發布。每處在既有寄信那段旁邊加一行 notify(...),既有 Email 這期不動(第二期才改成由中心決定寄不寄)。注意收件人要用使用者 id 不是信箱,有兩處現在拿的是信箱,要回頭用上游的使用者物件。公告那處 jedi-bulletin 沒有「新增後」掛點(已查),在主系統側包一層薄 wrapper,做法卡上寫死。

reuse/extend/new

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(參數組裝,讓超標檔只加一行)

怎麼做

驗收(首腦照這個驗)

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 行

必讀

紀律