本卡屬 FR-196(母卡 FR-196 母案(同清單上一張)),卡 M-1,第一期批 3。只改 BE(主 repo,Repo 欄空著)。依賴:P-1、P-2、S-1。
主系統接上通知中心套件。套件靠七張接口跟產品連接,本卡把七張都用主系統既有的東西實作:誰是管理員用授權到期通知那份定義、使用者信箱語系用既有名冊、範本用既有 i18n、投遞用既有 jedi-notification、連結用型錄表裡的路由名、即時先不推。另外紅點旁的「我的待辦任務(N)」數字接既有的 task queue。做完後八條端點在主系統上打得通。🔴 DI 簽章漂移是靜默的,驗收一定要實打端點。
照型 new:接線檔照 core/plugins/bulletin.py(build_adapters+mount+PLUGIN、host_defaults());port 實作 reuse:IRecipientDirectory 包 core/plugins/license.py::TenantAdminDirectory+UserDomainService.get_user_by_ids+ProjectParticipantDomainService;ITemplateRenderer 包 flask-babel _() 用型錄的 i18n key;ILinkResolver 讀型錄 link_route/link_params_template 做字串替換;IDeliveryGateway 包 app/notification/service/notification_service.py 的 send_mail_notification/discord/telegram;IRealtimeNotifier no-op;IClock 既有 now_provider;todo 數 reuse /flow-engine/task/queue 背後的 query
repo:~/Projects/Billows/Audit-Manager/compliance-manager-be
改既有:core/plugins/__init__.py(PLUGINS 加一列)
改既有:di_containers/containers.py(加 notification_center_container)
改既有:config/app_modules.py(若套件 blueprint 要登記則加;照 bulletin 的做法)
新開:core/plugins/notification_center.py
新開:core/plugins/_notification_center_ports.py(七張 port 實作,每張一個 class,檔不超 400 行)
新開:di_containers/notification_center/notification_center_containers.py
新開:common/code/notification_center_error_code.py(re-export 套件的四顆,字串值凍結)
新開:test/test_notification_center_mount.py(register 守門四件缺一拒掛;port 實作對 DEV 查得到管理員)
core/plugins/bulletin.py(build_adapters(container)+mount+PLUGIN,**host_defaults() 給守門四件);core/plugins/__init__.py PLUGINS 加一列。core/plugins/_notification_center_ports.py:RecipientDirectory(resolve_users 走 user_domain_service.get_user_by_ids;expand_role('tenant_admin')/('platform_admin') 走 core/plugins/license.py::TenantAdminDirectory.list_admin_recipients;('project_members', project_uid) 走 project_participant_domain_service)、TemplateRenderer(flask-babel _()+force_locale)、LinkResolver(型錄 link_route+link_params_template 做 str.format_map)、DeliveryGateway(包 notification_container.notification_service() 的三個 send)、RealtimeNotifier(no-op)、Clock(既有 now provider)、TenantContext(get_user_context().tenant_id)。unread-count 的 todo:adapters 給 todo_count_provider,實作包 /flow-engine/task/queue 背後的 query(grep task/queue 的 route 找它呼叫的 service)。di_containers/notification_center/notification_center_containers.py 照 di_containers/bulletin/;di_containers/containers.py 加 container。common/code/notification_center_error_code.py re-export 套件四顆;FE src/config/locales/i18n/{zh-tw,en}/error-code.json 各加四條(🔴 本卡是 error-code.json 的 owner)。python main.py);curl 八條;DEV 用 cmmgr 手插一列 inbox 驗紅點與已讀。重啟 BE 後 curl -H 'Authorization: Bearer <token>' /api/1.0/notification-center/unread-count 回 {status:true,data:{unread:0,todo:N}}(N 與鈴鐺現在的待辦數相同);GET /settings 回 23 列;DEV 用 cmmgr 手插一列 inbox 給自己後 unread=1、inbox/recent 看得到、PATCH read 後 unread=0;cm_app 身分 SELECT inbox 只看到自己租戶;FE src/config/locales/i18n/{zh-tw,en}/error-code.json 多四條(🔴 本卡是 error-code.json 的 owner,F-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