本卡屬 FR-196(母卡 FR-196 母案(同清單上一張)),卡 P-1,第一期批 1。只改 jedi-python-package。依賴:無。
通知中心的核心套件,第一棒。它只認識五個概念:事件代碼、收件人、主題物件、參數、管道,不認識任務、專案、掃描。本卡做的是:七張「產品要提供什麼」的接口定義(使用者名冊、範本、連結、投遞、即時、時鐘、租戶)、五張資料表與建表 SQL、業務程式要呼叫的那一行 notify() 的行為(查型錄、展開收件人角色、查每人設定、渲染、寫收件匣、交給投遞)。不含 REST 端點(P-2 做)。套件形狀照 jedi-bulletin,別自己發明一套。
new(新套件,照型):目錄與 plugin 契約照 jedi-bulletin(plugin/contract.py adapters dataclass 守門四件無預設值、plugin/migrations.py::iter_migrations()、plugin/runtime.py);repo 繼承 jedi-common BaseRepositoryImpl;migration SQL 的 RLS/GRANT 照 jedi-bulletin migrations/002;port 命名照 jedi-bulletin domain/ports.py
repo:~/Projects/Jedicogy/module/jedi-python-package
改既有:jedi-python-package/pyproject.toml(workspace 若有列套件清單則加一列;沒有就不動)
改既有:jedi-python-package/README.md(25 支名冊加一列)
新開:jedi-notification-center/pyproject.toml(0.1.0;依賴 jedi-common、jedi-notification>=1.2.4)
新開:jedi-notification-center/jedi_notification_center/__init__.py(export notify、register、NotificationCenterAdapters、Role)
新開:jedi-notification-center/jedi_notification_center/domain/ports.py(IRecipientDirectory/ITemplateRenderer/ILinkResolver/IDeliveryGateway/IRealtimeNotifier/IClock/ITenantContext)
新開:jedi-notification-center/jedi_notification_center/domain/entities/(notification_event、inbox_item、user_setting、user_profile、maintenance 五個 entity+query entity)
新開:jedi-notification-center/jedi_notification_center/domain/repositories/(五張 repo 介面)
新開:jedi-notification-center/jedi_notification_center/infra/models/(五張 SQLAlchemy model,design.md §5.2 表 5-1~5-4+notification_maintenance)
新開:jedi-notification-center/jedi_notification_center/infra/repository/(五張 repo impl;inbox 的 list 走 (recipient_user_id, archived_at, read_at, created_at desc) 索引)
新開:jedi-notification-center/jedi_notification_center/infra/mapper/
新開:jedi-notification-center/jedi_notification_center/app/service/notify_service.py(`notify()`:查型錄 → 展開 Role → 查每人設定或預設 → 渲染 → 寫 inbox → 交 delivery port;型錄查不到寫 warning 回 None;recipients 空直接 return)
新開:jedi-notification-center/jedi_notification_center/plugin/contract.py、assembly.py、runtime.py、migrations.py
新開:jedi-notification-center/migrations/001-notification-center-tables.sql(五張表+索引)、002-notification-center-rls-grants.sql
新開:jedi-notification-center/tests/(port 假件;notify 寫 inbox、必收覆寫設定、型錄查不到不炸、Role 展開)
新開:jedi-notification-center/README.md(照 jedi-notification README 的「兩種用法」骨架)
jedi-bulletin/jedi_bulletin/plugin/contract.py、plugin/migrations.py、domain/ports.py、migrations/001、002,與 jedi-notification/README.md「兩種用法」;套件目錄照 jedi-bulletin 開。IRecipientDirectory.resolve_users(ids) -> {id: {email, locale, nickname}}、expand_role(name, **ctx) -> [user_id];ITemplateRenderer.render(event, params, locale) -> {title, summary, mail_subject, mail_body};ILinkResolver.resolve(event, subject_type, subject_uid, params) -> {route, params};IDeliveryGateway.send_email(to, subject, body)/send_chat(channel, text);IRealtimeNotifier.unread_changed(user_id)。notification_maintenance);RLS 與 cm_app GRANT 照 jedi-bulletin 002。notify(event, recipients, subject, params):型錄查不到 → logger.warning 回 None;recipients 可為 [int] 或 Role(name, **ctx);每位收件人:設定 left join 型錄預設;必收事件 inapp/email 強制 True;寫 inbox 一列(merge_key=f"{event}:{subject_uid}"、title/summary 用收件人語系渲染、link 用 resolver 解好存 jsonb);email/chat 為 True 的交 IDeliveryGateway(第一期立即送,摘要與勿擾第三期)。env -u VIRTUAL_ENV poetry install)。套件 tests 綠(含:必收事件就算設定關了 inapp 仍寫 inbox;型錄查不到回 None 且 log warning;Role('tenant_admin') 經 port 展開;recipients 空不寫);iter_migrations() 回兩支;用套件 harness 或 sqlite 跑一次 notify() 後 inbox 有一列且 title 已渲染;0.1.0 不發版(收口才發)
~/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