Skip to content

AIFACTORY-FEAT-073: StudioNotificationService: complete delivery

Generated from the architecture model

This page is rendered from model/**/*.yaml by tools/docs_model during mkdocs build. Edit the YAML, not this page; hand-written design lives on the linked service, platform and plane pages.

A design artefact, not a tracker

This backlog is generated from model/backlog/ and validated against the architecture model. No work item exists in any tracker, and no item carries a date, an estimate or an assignee (ADR-0029).

Epic Factory Studio (PF-14) · Increment I3 Studio · State elaborated · Route backend-developer · Build order 113 of 185 (Factory code)

StudioNotificationService is the service of bounded context BC-29 (Experience Composition). Per-user notifications in the Studio — approvals waiting, alerts, releases ready, promotions and rollouts, incidents, proposals, exports — derived from platform events under each user's scope and role, with read state, grouping, digests and per-user channel preferences (in-app always; email and chat through connectors); the in-app channel is the one every other platform can rely on (BC-29). Its own repository is ConnectSoft.AI.SoftwareFactory.StudioNotificationService.

Delivers StudioNotificationService (complete)
Stubs —
Realizes adrs: ADR-0014
Requirements FR-05, FR-10, FUX-02, FUX-04, NFR-01, NFR-10, XL-06
Depends on —
Sources model/services/factory-studio/StudioNotificationService.yaml

Scenarios to trace (5, catalog): SCN-StudioNotificationService-001 ✓, SCN-StudioNotificationService-002 ✓, SCN-StudioNotificationService-003 ✓, SCN-StudioNotificationService-004 ✓, SCN-StudioNotificationService-005 ✓

AIFACTORY-US-035: I am notified of what needs me, and only within my scope

behavior · persona operator As an operator, I want notifications for approvals, releases, promotions and reconciliations that concern my role and scope, so that I act on what needs me and am never shown what I may not see.

This is the integration PBI of the feature. StudioNotificationService is the service of bounded context BC-29 (Experience Composition) that keeps per-user notifications in the Studio: it derives them from platform events under the scope and the role of each user, keeps read and dismissed state, groups them into digests and holds per-user channel preferences; the in-app channel is always on and is the one every other platform can rely on, while email and chat go through connectors. It owns two aggregates in studio-notification-sql: Notification, one notice for one user with its kind, subject reference, scope, importance, read and dismissed state and the deliveries made per channel, and NotificationPreference. StudioBff fronts the service on GW-02 and forwards the user token unchanged (D117), so the Studio reaches its three REST operations under factory.studio.use, and every query runs under the tenant row filter: a notification of another user or of another tenant is answered 404, the same answer as for one that does not exist (D113). A notification is created only for a user whose scope and role allow seeing the subject, confirmed through ProjectService/Projects.ResolveScope and never from the event alone, and it carries a summary with a reference, never the content. The behaviour is delivered by AIFACTORY-US-1365 (fan-out from platform events and NotificationCreated), AIFACTORY-US-1366 (list and read state), AIFACTORY-US-1367 (preferences, quiet hours and digests) and AIFACTORY-US-1368 (the internal Notifications.Notify). The inbox follows the rule of StudioBff: a handler is registered when its producer is first delivered in I1 to I3, and an event a thin delivery does not publish yet simply never arrives. Of the 17 consumed events of the model, the producers of 8 are first delivered in I1 to I3; the inbox registers 4 of them (ApprovalRequested, ReleaseReady, PromotionCompleted and ReconciliationProposed), and leaves out AttemptDecisionRequested, FindingRaised, ToolEffectUncertain and DeliveryFailed, because NotificationKind has no value for them and an event acknowledged without a notification would be lost once a kind exists; which kind each should create is reported as an open question. The handlers of the 9 others (AlertFired, ApprovalRouted, LearningProposalRaised and ExportCompleted from I4, SkillCandidateProposed from I5, RolloutPlanned, RolloutHalted, IncidentOpened and InvoiceIssued from I7) are not registered in I3. Repository: ConnectSoft.AI.SoftwareFactory.StudioNotificationService, created by the repository checklist of feature repository-and-pipeline-conventions and scaffolded from the base template with the Factory profile.

Acceptance criteria

AC1 Given the repository ConnectSoft.AI.SoftwareFactory.StudioNotificationService, whose first commit is the unchanged output of dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.StudioNotificationService with the Factory profile, when its pipeline runs with the work of this feature, then no second scaffold was run, the solution builds, the tests pass, the template version is recorded, a container image is published and each of the five scenarios of model/scenarios/StudioNotificationService.yaml has a passing test that names its id (ADR-0028).
AC2 Given the inbox of the service, when its registrations are listed, then the four handlers of RunControlService/ApprovalRequested, ReleaseService/ReleaseReady, EnvironmentPromotionService/PromotionCompleted and RuntimeEnvironmentService/ReconciliationProposed are registered with idempotency on the event id, and no handler is registered for the four events of I1 to I3 producers that NotificationKind cannot name nor for any event whose producer arrives in I4 to I7 (model/services/factory-studio/StudioNotificationService.yaml).
AC3 Given a deployed I3 instance with StudioBff, RunControlService and this service, and a run submitted through StudioBff that reaches an approval of the role Reviewer, when RunControlService publishes RunControlService/ApprovalRequested, then the reviewer of the project lists one ApprovalWaiting notification through the route of StudioNotificationService/ListNotifications that StudioBff fronts, marks it read through StudioNotificationService/MarkNotificationRead on that route, and a second device of the reviewer lists it read, while the requester of the run and a user of another tenant list nothing for it (FUX-04, ADR-0015).
AC4 Given the service starts, when liveness and readiness are probed, then readiness reports studio-notification-sql and the messaging transport, and the metrics connectsoft.factory.studio.notifications by tenant, kind and channel and connectsoft.factory.studio.notification_latency by kind are emitted as modelled in model/services/factory-studio/StudioNotificationService.yaml (NFR-10).
Traces: services StudioNotificationService, StudioBff, RunControlService
Traces: aggregates StudioNotificationService/Notification, StudioNotificationService/NotificationPreference
Traces: apis StudioNotificationService/ListNotifications, StudioNotificationService/MarkNotificationRead, StudioNotificationService/SetNotificationPreferences, StudioNotificationService/Notifications.Notify
Traces: events StudioNotificationService/NotificationCreated, RunControlService/ApprovalRequested, ReleaseService/ReleaseReady, EnvironmentPromotionService/PromotionCompleted, RuntimeEnvironmentService/ReconciliationProposed
Traces: adrs ADR-0014, ADR-0015, ADR-0028
Traces: requirements FUX-04
Relates: screens my-work, notification-preferences
Relates: nfrs NFR-01, NFR-10
Depends on AIFACTORY-US-1365, AIFACTORY-US-1366, AIFACTORY-US-1367, AIFACTORY-US-1368, feature:studio-bff, feature:run-control-service, feature:release-service, feature:environment-promotion-service, feature:runtime-environment-service, feature:repository-and-pipeline-conventions, feature:component-base-template-factory-profile, feature:contracts-package, feature:component-observability-factory-conventions
Sources model/services/factory-studio/StudioNotificationService.yaml, model/scenarios/StudioNotificationService.yaml, docs/planes/experience/studio/services/studio-notification-service/index.md#purpose-and-responsibilities

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-420 Create the repository ConnectSoft.AI.SoftwareFactory.StudioNotificationService and scaffold it from the ConnectSoft.BaseTemplate template with the Factory profile implementation The repository exists by the repository checklist of feature repository-and-pipeline-conventions; the output of dotnet new connectsoft-base -n ConnectSoft.AI.SoftwareFactory.StudioNotificationService with the Factory profile from the pinned template package is committed unchanged, the repository records the template version, the solution builds and the template tests pass in the repository pipeline, which publishes the container image. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-421 Domain model: Notification, NotificationPreference implementation The aggregates hold the fields and the invariants of the model: a notification exists only for a recipient confirmed by the permission check, it carries a summary with a reference and never content, and action-required and critical notifications ignore quiet hours for the in-app channel while an info notification does not; unit tests cover every invariant. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-422 Persistence in studio-notification-sql: Notifications, NotificationPreferences implementation Mappings and migrations for the two modelled tables with the tenant filter, the index IX_Notifications_User_Unread and the key of NotificationPreferences on UserId and TenantId, and the removal of notifications older than Studio:Notifications:RetentionDays; mapping tests run against an isolated test database, never a shared one. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-423 API hosting skeleton: 3 REST and 1 gRPC operations with scope enforcement, problem responses and contract documents implementation ListNotifications, MarkNotificationRead and SetNotificationPreferences are hosted with JWT validation of the user token StudioBff forwards with its own audience and the scope factory.studio.use, and Notifications.Notify with the workload token check of the service scope of StudioNotificationService, with problem responses for every modelled refusal and the OpenAPI and proto documents; the behaviour of each operation is delivered by AIFACTORY-US-1366 to AIFACTORY-US-1368, not here. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-424 Messaging skeleton: outbox of NotificationCreated and inbox of 4 of the 17 consumed events implementation The outbox writer enlists in the transaction of each notification and the dispatcher publishes NotificationCreated under the canonical envelope; the inbox registers, with idempotency on the event id, the handlers of ApprovalRequested, ReleaseReady, PromotionCompleted and ReconciliationProposed, and none for AttemptDecisionRequested, FindingRaised, ToolEffectUncertain and DeliveryFailed, which NotificationKind cannot name, nor for the nine events whose producers arrive in I4 to I7. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-425 Worker hosting: FanOut and Digester with their triggers, partitioning and retry policies implementation The modelled trigger of FanOut names only AlertFired of AlertRuleService, which arrives in I4; as an assumption of I3, reported as an open question, FanOut is started by each of the four registered inbox handlers, with the retry policy exponential (5 attempts, 30 s backoff), at most eight in parallel partitioned by TenantId and the idempotency key eventId plus userId; Digester runs every hour with the policy fixed (2 attempts, 300 s), at most four in parallel and the key userId plus window; a duplicate trigger has no second effect. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-426 Security, tenancy and telemetry of StudioNotificationService implementation Scopes and roles of the model are enforced, every query is filtered by tenant and user, the workload token of the service carries the service scope that names ProjectService for the recipient confirmation, the service holds no secret beyond its references, and the metrics notifications and notification_latency, traces and health checks follow the observability conventions. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-745 Verify studio-notifications by running the scenario acceptance suite verification Run dotnet test -c Release --filter "Category=Acceptance&Scenario~SCN-StudioNotificationService" in the pipeline of ConnectSoft.AI.SoftwareFactory.StudioNotificationService; a filter that discovers no test counts as a failure; it passes and proves the scenario part of AC1 of AIFACTORY-US-035, a passing test for each of SCN-StudioNotificationService-001 to SCN-StudioNotificationService-005. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-5509 Verify the build, the single scaffold, the template version and the published image of StudioNotificationService verification A pipeline run of ConnectSoft.AI.SoftwareFactory.StudioNotificationService on its main branch passes dotnet build -c Release and dotnet test -c Release --no-build, its run record names the recorded template version and the digest of the published container image, and the repository history holds one scaffold commit; that record is the evidence of the build, scaffold and publication part of AC1 of AIFACTORY-US-035. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-5510 Verify the inbox registrations, readiness and metrics of StudioNotificationService verification Run dotnet test -c Release --filter "Category=Registration\|Category=Telemetry"; a zero-match filter counts as a failure; the tests compare the inbox registrations with the four handlers of AC2 of AIFACTORY-US-035 against model/services/factory-studio/StudioNotificationService.yaml and check readiness and the two metrics with their dimensions, proving AC2 and AC4. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-5511 Verify the end-to-end path from an approval request to a notification read through StudioBff verification Run dotnet test -c Release --filter "Category=EndToEnd" against a deployed I3 instance with StudioBff, RunControlService behind ControlPlaneApi and this service; a zero-match filter counts as a failure; the test submits a run through StudioBff that reaches an approval, waits for RunControlService/ApprovalRequested, lists and marks the notification read through the routes StudioBff fronts from two devices of the reviewer and checks that the requester and a user of another tenant list nothing, proving AC3 of AIFACTORY-US-035. ConnectSoft.AI.SoftwareFactory.StudioNotificationService

AIFACTORY-US-1365: Turn a platform event into notifications for the users whose role and scope allow it

behavior · persona reviewer As a reviewer, I want a notification when an approval waits for my role in my project, and none for what I may not see, so that I act on what needs me without anyone outside my scope learning of it.

The inbox of StudioNotificationService consumes four platform events published in I1 to I3, each idempotent on its event id, and the worker FanOut turns each into notifications. The modelled trigger of FanOut names only AlertFired of AlertRuleService, which arrives in I4; as an assumption of I3, reported as an open question, the four registered handlers start FanOut. ApprovalRequested of RunControlService (handler NotifyProject) creates ApprovalWaiting, of importance action-required: for a request of kind approval the recipients are the members holding the role of its approverRule in the project of the envelope, less the requester of the run, who may not approve the run they requested (ADR-0015 separation of duties); for a request of kind operator-decision the recipients are the Operators of the project and the requester of the run, the two who may take that decision (D119). ReleaseReady of ReleaseService and PromotionCompleted of EnvironmentPromotionService (NotifyProject) create ReleaseReady and PromotionCompleted, of importance info, for the members of the project; ReconciliationProposed of RuntimeEnvironmentService (NotifyOperators) creates ReconciliationProposed, of importance action-required, for the Operators of the project. The tenant and the project come from the canonical envelope (ADR-0014). No modelled operation lists the members of a project by role for a workload caller: as an assumption reported as an open question, the candidates are read from the memberships that ProjectService/GetProject returns and the requester of a run from RunControlService/GetRun, both through ControlPlaneApi with the workload token of the service. Every candidate is then confirmed through ProjectService/Projects.ResolveScope, called with the workload token of StudioNotificationService holding the service scope that names ProjectService (D114), the tenant and project of the envelope, the candidate as callerId with callerKind user and the active platform policy revision, whose source for a caller that is not a run the model does not name (open question); a notification is created only for a user whose scope and role allow seeing the subject, never from the event alone. Each Notification holds the kind, the subject reference, the project, the importance and a summary, never the content, and is written with its NotificationCreated outbox record in one transaction, idempotent on the event id and the user id, so a redelivered event adds none; an info notification that falls in the quiet hours of its user follows AIFACTORY-US-1367. The subject of an approval request is named as a kind and an id (D135), and in I3 ApprovalRequested names a run. When recipient resolution is unavailable, FanOut retries under its exponential policy and the event stays unhandled in the inbox; no notification is created without a permission check.

Acceptance criteria

AC1 Given RunControlService/ApprovalRequested of kind approval for a run of a project whose approver rule names the role Reviewer, two reviewers, one of whom requested the run, and members of another project, when FanOut handles it, then the reviewer who did not request the run, confirmed through ProjectService/Projects.ResolveScope called with the workload token of the service and callerKind user, receives one StudioNotificationService/Notification of kind ApprovalWaiting and importance action-required naming the approval request and its subject as a kind and an id (D135), the requesting reviewer and the members of the other project receive none, and the notification is written with its StudioNotificationService/NotificationCreated outbox record in one transaction (ADR-0015, D114).
AC2 Given RunControlService/ApprovalRequested of kind operator-decision, when FanOut handles it, then the Operators of the project and the requester of the run, read through RunControlService/GetRun, each receive one ApprovalWaiting notification of importance action-required after the permission check, and no other member receives one (D119).
AC3 Given ReleaseService/ReleaseReady or EnvironmentPromotionService/PromotionCompleted consumed for a project, or RuntimeEnvironmentService/ReconciliationProposed, when FanOut handles it, then notifications of the kind of the same name are created, of importance info for the members of the project and of importance action-required for its Operators respectively, only after the permission check, and the same event delivered twice creates no second notification for any user (SCN-StudioNotificationService-005).
AC4 Given recipient resolution through ControlPlaneApi is unavailable, when FanOut handles a consumed event, then it retries under its exponential policy, no notification is created without a permission check, and after resolution returns the event creates its notifications once (model/services/factory-studio/StudioNotificationService.yaml).
AC5 Given a notification was created, when the outbox dispatcher publishes StudioNotificationService/NotificationCreated on studio.notifications.v1.notification-created, then the event is sent under the canonical envelope with notificationId, tenantId, userId, kind and importance, and a transport outage is retried with backoff so the event is neither lost nor duplicated under its event id (SCN-StudioNotificationService-005, ADR-0012).
Traces: services StudioNotificationService, ControlPlaneApi, ProjectService, RunControlService
Traces: aggregates StudioNotificationService/Notification
Traces: apis ProjectService/Projects.ResolveScope, ProjectService/GetProject, RunControlService/GetRun
Traces: events StudioNotificationService/NotificationCreated, RunControlService/ApprovalRequested, ReleaseService/ReleaseReady, EnvironmentPromotionService/PromotionCompleted, RuntimeEnvironmentService/ReconciliationProposed
Traces: descriptors execution-scope-v1
Traces: adrs ADR-0012, ADR-0014, ADR-0015
Traces: requirements FUX-04, XL-05
Traces: scenarios SCN-StudioNotificationService-005
Relates: screens approvals-list
Relates: nfrs NFR-01
Depends on feature:control-plane-api, feature:project-service, feature:run-control-service, feature:release-service, feature:environment-promotion-service, feature:runtime-environment-service
Sources model/services/factory-studio/StudioNotificationService.yaml, model/services/control-plane/ProjectService.yaml, model/services/control-plane/RunControlService.yaml, docs/planes/experience/studio/services/studio-notification-service/index.md#messages

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-522 Fan-out from consumed events by role and scope implementation Each of the four registered events becomes notifications for the users its handler names (NotifyProject, NotifyOperators) with the tenant and project of the envelope, the requester of the run excluded from an approval and included in an operator decision, the importance of each kind set (ApprovalWaiting and ReconciliationProposed action-required, ReleaseReady and PromotionCompleted info); every notification and its NotificationCreated outbox record share one transaction, keyed by event id and user id, so a repeated event adds none. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-5491 Candidate lookup and recipient confirmation through Projects.ResolveScope with the workload token implementation Typed clients behind ControlPlaneApi read the candidate members of the project from GetProject and the requester of a run from GetRun, and confirm every candidate through Projects.ResolveScope called with the workload token of the service and its service scope, the tenant and project of the envelope, the candidate as callerId with callerKind user and the active platform policy revision, before a notification is written; an approval subject is named as a kind and an id; an unavailable resolution fails the attempt so FanOut retries. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-5492 Verify the fan-out through the acceptance suite verification Run dotnet test -c Release --filter "Category=Acceptance&(Scenario=SCN-StudioNotificationService-005\|Category=FanOut)"; a zero-match filter counts as a failure; the tests prove AC1 to AC5 of AIFACTORY-US-1365 with fake GetProject, GetRun and Projects.ResolveScope endpoints that record the workload token and the caller fields and can confirm, deny and be unavailable, including the publication and payload of NotificationCreated; consumer handling is proven by the suite of StudioRealtimeGateway. ConnectSoft.AI.SoftwareFactory.StudioNotificationService

AIFACTORY-US-1366: List my notifications with unread counts and mark one read or dismissed

behavior · persona operator As an operator, I want my notifications with unread counts by importance, and to mark one read or dismissed, so that I see what is new and what is urgent, on every device I use.

A signed-in user reaches StudioNotificationService through StudioBff, which fronts it on GW-02 and forwards the user token carrying factory.studio.use unchanged (D117). StudioNotificationService/ListNotifications returns the notifications of the caller, newest first, each with its kind, subject reference, importance, summary and read and dismissed state, together with the unread counts by importance (info, action-required, critical); notifications of other users and of other tenants never appear (ADR-0015), an info notification held by quiet hours appears once it is released (AIFACTORY-US-1367), and notifications older than Studio:Notifications:RetentionDays are gone. StudioNotificationService/MarkNotificationRead marks one notification of the caller read or dismissed by setting readAt or dismissedAt; the state is kept by the service, so it holds on every device of the user, a repeat changes nothing and keeps the first time, and no event is published. A notification that does not exist, that belongs to another user or that belongs to another tenant is answered 404 in each case, the same problem response that never confirms it exists (D113). When studio-notification-sql is unavailable both calls fail fast and nothing changes. The notification centre of the Studio lists the notifications, shows the counts and marks them read; the subject of a notification is opened through StudioBff under the permissions of the user, never from the notification.

Acceptance criteria

AC1 Given notifications of the caller, of another user of the tenant and of another tenant, when StudioNotificationService/ListNotifications is called, then the response is 200 with only the caller's notifications, newest first, and the unread counts by importance, and nothing is written (SCN-StudioNotificationService-001, ADR-0015).
AC2 Given an unread notification of the caller, when StudioNotificationService/MarkNotificationRead is called with read, then the response is 200, readAt is set, a list from another device of the same user shows it read, and a repeat changes nothing; dismissed sets dismissedAt the same way (SCN-StudioNotificationService-002).
AC3 Given a notificationId that does not exist, one of another user and one of another tenant, when StudioNotificationService/MarkNotificationRead is called with each, then each is answered 404 with the same problem response and no state changes (SCN-StudioNotificationService-002, D113).
AC4 Given studio-notification-sql is unavailable, when StudioNotificationService/ListNotifications is called, then the call fails fast with a problem response and no state changes (SCN-StudioNotificationService-001).
Traces: services StudioNotificationService, StudioBff
Traces: aggregates StudioNotificationService/Notification
Traces: apis StudioNotificationService/ListNotifications, StudioNotificationService/MarkNotificationRead
Traces: adrs ADR-0015
Traces: requirements FUX-04
Traces: scenarios SCN-StudioNotificationService-001, SCN-StudioNotificationService-002
Relates: screens my-work
Relates: nfrs NFR-01
Depends on feature:studio-bff
Sources model/services/factory-studio/StudioNotificationService.yaml, docs/planes/experience/studio/services/studio-notification-service/index.md#apis

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-5493 ListNotifications and MarkNotificationRead under the tenant and user filter implementation ListNotifications returns the caller's released notifications newest first with unread counts by importance; MarkNotificationRead sets readAt or dismissedAt once and answers 404 alike for an absent notification, one of another user and one of another tenant; an unavailable store fails both calls fast. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-524 Notification centre in the Studio ui The Studio lists the notifications of the user with the unread counts by importance, marks them read or dismissed through StudioBff and opens the subject of a notification under the permissions of the user. ConnectSoft.AI.SoftwareFactory.Studio
AIFACTORY-TASK-5494 Verify the list and the read state through the acceptance suite verification Run dotnet test -c Release --filter "Category=Acceptance&(Scenario=SCN-StudioNotificationService-001\|Scenario=SCN-StudioNotificationService-002)"; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1366. ConnectSoft.AI.SoftwareFactory.StudioNotificationService

AIFACTORY-US-1367: Choose my channels, quiet hours and digest, and receive grouped notices once

behavior · persona operator As an operator, I want to choose the channels per kind of notification, my quiet hours and a digest, so that I am reached the way I chose, and urgent work still reaches me in the Studio.

A signed-in user reaches the service through StudioBff with the user token carrying factory.studio.use and sets the NotificationPreference of the user in the trusted tenant through StudioNotificationService/SetNotificationPreferences: the channels per NotificationKind (InApp is always on; Email and Chat are optional), the quiet hours and the digest (none, hourly or daily). Repeating the same preferences changes nothing and no event is published; when studio-notification-sql is unavailable the call fails fast and the preferences stay as they were. Later notifications follow the preference. During quiet hours an action-required or critical notification is delivered in-app at once, because those ignore quiet hours for the in-app channel (invariant of NotificationPreference), while the in-app delivery of an info notification is held until quiet hours end. The model names no worker that releases a held delivery, nor whether NotificationCreated follows the creation or the release; as an assumption reported as an open question, the info notification is written with its in-app delivery recorded as held, left out of ListNotifications and the unread counts, and released by the first Digester run after the quiet hours end, which records the in-app delivery and writes the NotificationCreated outbox record in the transaction of the release, idempotent on the notification id. The worker Digester runs every hour and, for each user with an hourly or daily digest whose window has ended, groups the unread notifications of the window once, idempotent on the user id and the window, and records the digest delivery in deliveries of each grouped notification. Email and chat go through ConnectorRegistryService, an optional dependency in degrade mode whose outbound delivery Connectors.Deliver arrives with its complete delivery in I5; in I3 every delivery through those channels, the email of a notification and a digest alike, is recorded as not made, with the reason that the channel is unavailable, and the in-app notification stands. The preferences screen of the Studio edits them.

Acceptance criteria

AC1 Given a caller with factory.studio.use, when StudioNotificationService/SetNotificationPreferences is called with Email for ApprovalWaiting and ReleaseReady, quiet hours and an hourly digest, then the response is 200, the StudioNotificationService/NotificationPreference holds them with InApp on for every kind, and a repeat changes nothing (SCN-StudioNotificationService-003).
AC2 Given quiet hours in force and Email chosen for both kinds, when an action-required notification and an info notification are created for the user, then the action-required notification is delivered in-app at once with its StudioNotificationService/NotificationCreated, the in-app delivery of the info notification is held until quiet hours end and is then released by Digester with its NotificationCreated, and in I3 the email delivery of both is recorded as not made with the reason that the channel is unavailable (SCN-StudioNotificationService-003).
AC3 Given a user with an hourly digest and unread notifications in the window, when Digester runs after the window ended and runs again for the same window, then the notifications are grouped once and the digest delivery is recorded once in their deliveries, as not made with the reason that the channel is unavailable while Connectors.Deliver is not delivered (model/services/factory-studio/StudioNotificationService.yaml).
AC4 Given studio-notification-sql is unavailable, when StudioNotificationService/SetNotificationPreferences is called, then the call fails fast with a problem response and the preferences stay as they were (SCN-StudioNotificationService-003).
Traces: services StudioNotificationService, ConnectorRegistryService
Traces: aggregates StudioNotificationService/NotificationPreference, StudioNotificationService/Notification
Traces: apis StudioNotificationService/SetNotificationPreferences
Traces: events StudioNotificationService/NotificationCreated
Traces: requirements FUX-04
Traces: scenarios SCN-StudioNotificationService-003
Relates: screens notification-preferences
Depends on feature:studio-bff
Sources model/services/factory-studio/StudioNotificationService.yaml, docs/planes/experience/studio/services/studio-notification-service/index.md#workers-and-jobs

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-5495 SetNotificationPreferences with InApp always on and the quiet-hours rule implementation SetNotificationPreferences writes channels per kind, quiet hours and digest for the user in the trusted tenant with InApp kept on for every kind; deliveries consult the preference, an action-required or critical notification is delivered in-app at once during quiet hours, and the in-app delivery of an info notification is recorded as held; an unavailable store fails the call fast. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-523 Release of held deliveries, grouping and digest implementation The Digester releases each held in-app delivery once quiet hours ended, with the NotificationCreated outbox record in the transaction of the release and idempotent on the notification id, groups the unread notifications of each ended hourly or daily window once per user and window, records the digest delivery in the deliveries of each grouped notification, and records every email or chat delivery as not made with the reason that the channel is unavailable while Connectors.Deliver of ConnectorRegistryService is not delivered. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-5496 Verify preferences, quiet hours and digests through the acceptance suite verification Run dotnet test -c Release --filter "Category=Acceptance&(Scenario=SCN-StudioNotificationService-003\|Category=Digester)"; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1367, including the held and released info notification and the second Digester run without effect. ConnectSoft.AI.SoftwareFactory.StudioNotificationService

AIFACTORY-US-1368: Create a guaranteed in-app notice for the recipients of a subject on the call of a platform

behavior A platform that needs a guaranteed in-app notice calls the internal gRPC method StudioNotificationService/Notifications.Notify with its workload token and a run-event-v1 that names the subject, its tenant and project and the event id; AlertRuleService is the modelled caller and arrives in I4, so in I3 the method is delivered and proven with a test caller. The method declares no scope of its own, so it takes the service scope of StudioNotificationService (D135), and the service reads the tenant and project the workload forwards only because the token holds that scope (D114). The candidate recipients are the members of the project of the request who hold the role the subject implies, the Operators of the project for an alert, read from the memberships of ProjectService/GetProject under the assumption of AIFACTORY-US-1365; each is confirmed through ProjectService/Projects.ResolveScope, called with the workload token of StudioNotificationService and its service scope, the tenant and project of the request, the candidate as callerId with callerKind user and the active platform policy revision. The service writes one Notification per confirmed recipient with its NotificationCreated outbox record in one transaction, idempotent on the event id and the user id; the reply carries ack-v1, and a repeated call for the same event creates no second notification and returns the same acknowledgement, so the shared-write side effect happens once. A caller without a workload token is refused with UNAUTHENTICATED, a workload token without the service scope of StudioNotificationService with PERMISSION_DENIED (D114, D135) and a request that fails validation with INVALID_ARGUMENT; a project the resolution does not find in the tenant of the request is answered NOT_FOUND, alike for a project of another tenant (D113). When recipient resolution is unavailable the call fails fast and nothing is written, because no notification is created without a permission check.

Acceptance criteria

AC1 Given a caller whose workload token holds the service scope of StudioNotificationService and a valid run-event-v1 for a subject with two eligible recipients, when StudioNotificationService/Notifications.Notify is called, then each candidate is confirmed through ProjectService/Projects.ResolveScope with the workload token of the service and callerKind user, two StudioNotificationService/Notification rows are written, each with its StudioNotificationService/NotificationCreated outbox record in one transaction, and the reply carries ack-v1 (SCN-StudioNotificationService-004, D114).
AC2 Given the same call repeated for the same event id, when StudioNotificationService/Notifications.Notify is called again, then no second notification is created for either recipient and the same acknowledgement is returned (SCN-StudioNotificationService-004, XL-06).
AC3 Given a caller without a workload token, a workload token without the service scope of StudioNotificationService, an invalid request or a project of another tenant, when StudioNotificationService/Notifications.Notify is called, then it is refused with UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT or NOT_FOUND respectively, the last alike for an unknown project, and nothing is written (SCN-StudioNotificationService-004, D113, D135).
AC4 Given recipient resolution through ProjectService/Projects.ResolveScope is unavailable, when StudioNotificationService/Notifications.Notify is called, then the call fails fast with the matching gRPC status and no notification is created (SCN-StudioNotificationService-004).
Traces: services StudioNotificationService, ControlPlaneApi, ProjectService
Traces: aggregates StudioNotificationService/Notification
Traces: apis StudioNotificationService/Notifications.Notify, ProjectService/Projects.ResolveScope, ProjectService/GetProject
Traces: events StudioNotificationService/NotificationCreated
Traces: descriptors run-event-v1, ack-v1, execution-scope-v1
Traces: adrs ADR-0015
Traces: requirements XL-06
Traces: scenarios SCN-StudioNotificationService-004
Depends on feature:control-plane-api, feature:project-service
Sources model/services/factory-studio/StudioNotificationService.yaml, docs/planes/experience/studio/services/studio-notification-service/index.md#apis

Tasks

Task Kind Expected output Repository
AIFACTORY-TASK-5497 Notifications.Notify with the service scope check, recipient confirmation and the idempotent write implementation Notifications.Notify checks that the workload token holds the service scope of StudioNotificationService, validates the run-event-v1 request, reads the candidates from GetProject, confirms each through Projects.ResolveScope with the workload token of the service and callerKind user, and writes one notification per recipient with its NotificationCreated outbox record, idempotent on event id and user id, replying ack-v1; UNAUTHENTICATED, PERMISSION_DENIED, INVALID_ARGUMENT and NOT_FOUND refusals and the fail-fast resolution write nothing. ConnectSoft.AI.SoftwareFactory.StudioNotificationService
AIFACTORY-TASK-5498 Verify Notifications.Notify through the acceptance suite verification Run dotnet test -c Release --filter "Category=Acceptance&Scenario=SCN-StudioNotificationService-004"; a zero-match filter counts as a failure; the tests prove AC1 to AC4 of AIFACTORY-US-1368 with test callers whose workload token holds or lacks the service scope and fake GetProject and Projects.ResolveScope endpoints. ConnectSoft.AI.SoftwareFactory.StudioNotificationService