Commit Graph

578 Commits

Author SHA1 Message Date
Joseph Doherty
0904401f1e docs(plans): implementation plan for Notifications nav group 2026-05-19 05:08:52 -04:00
Joseph Doherty
113f00a6fa docs(plans): design for Notifications nav group 2026-05-19 05:01:58 -04:00
Joseph Doherty
17861efa51 test(notification-outbox): assert NotNull in SourceScript negative test 2026-05-19 03:57:38 -04:00
Joseph Doherty
558f9ceb39 feat(notification-outbox): populate SourceScript on outbound notifications
FU3: thread the executing script identifier from the script-execution
context down to the Notify outbox API so NotifyTarget.Send stamps
NotificationSubmit.SourceScript instead of leaving it null.

- ScriptRuntimeContext / NotifyHelper / NotifyTarget take an optional
  sourceScript value, carried through to NotificationSubmit.SourceScript.
- ScriptExecutionActor supplies "ScriptActor:<scriptName>", matching the
  Site Event Logging "Source" convention used for script error events.
- AlarmExecutionActor builds the context without the S&F engine, so its
  Notify API is inert; sourceScript defaults to null there.
2026-05-19 03:54:09 -04:00
Joseph Doherty
a5653b4296 refactor(notification-outbox): drop unused state from sandbox Notify fakes 2026-05-19 03:50:21 -04:00
Joseph Doherty
c8b5871782 fix(notification-outbox): re-align Central UI sandbox Notify API with production
The script-analysis sandbox Notify surface was stale after the Notification
Outbox change: SandboxNotifyTarget.Send returned Task<NotificationResult> and
there was no Status method, while production NotifyTarget.Send returns
Task<string> (a NotificationId) plus NotifyHelper.Status. A script that
test-ran cleanly in the sandbox would not compile against the real site
runtime.

- Move the NotificationDeliveryStatus record from ScadaLink.SiteRuntime.Scripts
  into ScadaLink.Commons.Messages.Notification so both production and the
  CentralUI sandbox reference the exact same type (CentralUI does not, and
  should not, reference SiteRuntime). Production NotifyHelper.Status is
  otherwise untouched.
- Rewrite SandboxNotifyHelper/SandboxNotifyTarget to be a signature-faithful
  no-op fake: Send returns Task<string> (a fake NotificationId), Status returns
  Task<NotificationDeliveryStatus>. Production now enqueues into the site S&F
  engine, which has no central-side equivalent in the sandbox, so the fake no
  longer carries an INotificationDeliveryService.
- Add script-analysis tests proving a script using the new Notify shape both
  diagnoses clean and runs in the sandbox.
2026-05-19 03:44:34 -04:00
Joseph Doherty
4b61e29e27 refactor(notification-outbox): extract EmailAddressValidator helper, drop orphaned using 2026-05-19 03:39:05 -04:00
Joseph Doherty
5e80f64cd8 refactor(notification-outbox): share SMTP helpers between NotificationService and the Email adapter
FU1 of the Notification Outbox follow-ups. EmailNotificationDeliveryAdapter
carried verbatim private copies of credential redaction, SMTP error
classification, and address validation because the NotificationService
helpers were internal. This eliminates the divergence risk by promoting the
helpers to public and deleting the adapter's copies.

- CredentialRedactor: internal -> public.
- Extract SmtpErrorClassifier + SmtpErrorClass enum into a new public static
  class; NotificationDeliveryService now routes classification through it
  (behavior unchanged). Adds focused SmtpErrorClassifierTests.
- NotificationDeliveryService.ValidateAddresses: internal -> public; the
  adapter calls it directly.
- EmailNotificationDeliveryAdapter: deleted ScrubCredentials, ClassifySmtpError,
  SmtpErrorClass, IsTransientSmtpError and ValidateAddresses copies.

No InternalsVisibleTo hack — specific helpers promoted to public. Both test
suites green; full solution builds clean.
2026-05-19 03:34:22 -04:00
Joseph Doherty
213b9c7c0a test(notification-outbox): end-to-end outbox flow integration test 2026-05-19 03:13:37 -04:00
Joseph Doherty
af22aa7ce1 refactor(notification-outbox): clarify Health outbox-KPI seed value 2026-05-19 03:09:44 -04:00
Joseph Doherty
9e7bc7b541 feat(notification-outbox): add outbox KPI tiles to Health dashboard 2026-05-19 03:05:41 -04:00
Joseph Doherty
9b05e48ea6 test(notification-outbox): cover Discard and query-failure paths on the Outbox page 2026-05-19 03:02:48 -04:00
Joseph Doherty
ad9872705d feat(notification-outbox): add Notification Outbox UI page 2026-05-19 02:58:49 -04:00
Joseph Doherty
afdf581e32 feat(notification-outbox): add CommunicationService outbox methods 2026-05-19 02:51:11 -04:00
Joseph Doherty
1d495d1a87 feat(notification-outbox): register NotificationOutbox singleton in Host
Wire the Notification Outbox into the Host central role:
- Program.cs: call AddNotificationOutbox() on the central path (binds
  NotificationOutboxOptions via BindConfiguration; no explicit Configure).
- AkkaHostedService.RegisterCentralActors(): create the NotificationOutboxActor
  as a non-role-scoped central cluster singleton + proxy, then send
  RegisterNotificationOutbox(proxy) to the CentralCommunicationActor.
- appsettings.Central.json: add the ScadaLink:NotificationOutbox section with
  the NotificationOutboxOptions defaults.
- SiteServiceRegistration: remove the now-dead AddNotificationService() call -
  sites forward notifications to central rather than delivering over SMTP, and
  no site component consumes the SMTP machinery.
- Host.csproj: add the ScadaLink.NotificationOutbox project reference.
- Tests: add central outbox singleton/proxy actor-path assertions, drop the
  site OAuth2TokenService/INotificationDeliveryService resolution assertions,
  and add NotificationOutbox to the component-library IConfiguration check.
2026-05-19 02:44:32 -04:00
Joseph Doherty
2ff62a2ceb feat(notification-outbox): route NotificationSubmit to the outbox actor 2026-05-19 02:38:04 -04:00
Joseph Doherty
b88c75c116 docs(plans): track Task 19 follow-ups (site DI cleanup, sandbox API, SourceScript) 2026-05-19 02:35:47 -04:00
Joseph Doherty
3326bddeb0 feat(notification-outbox): async Notify.Send with status handle
Notify.To(list).Send(subject,body) now generates a NotificationId GUID,
enqueues a Notification-category message into the site Store-and-Forward
Engine, and returns the NotificationId immediately (Task<string>). The
NotificationId is the single idempotency key end-to-end: it is the S&F
message Id, it is carried inside the buffered NotificationSubmit payload,
and it is the id the forwarder submits to central.

NotificationForwarder now deserializes the buffered payload as a
NotificationSubmit and reads NotificationId from it (re-stamping only the
site-owned SourceSiteId / SourceInstanceId), instead of deriving the id
from StoreAndForwardMessage.Id.

Adds NotifyHelper.Status(id): queries central via the site communication
actor; reports the site-local Forwarding state while the notification is
still buffered at the site, maps central's response when found, and
Unknown otherwise. Adds a NotificationDeliveryStatus record.

SiteCommunicationActor gains a NotificationStatusQuery forwarding handler
mirroring NotificationSubmit. StoreAndForwardService.EnqueueAsync gains an
optional messageId parameter and exposes GetMessageByIdAsync.
2026-05-19 02:30:51 -04:00
Joseph Doherty
05614e037a fix(notification-outbox): fall back to Target for empty notification list name 2026-05-19 02:21:22 -04:00
Joseph Doherty
6a77c12735 feat(notification-outbox): forward site S&F notifications to central 2026-05-19 02:16:27 -04:00
Joseph Doherty
703cb2d392 feat(notification-outbox): add AddNotificationOutbox DI registration 2026-05-19 02:07:29 -04:00
Joseph Doherty
517437b0d9 refactor(notification-outbox): make purge fault-handling symmetric with dispatch 2026-05-19 02:01:48 -04:00
Joseph Doherty
41358c1cee feat(notification-outbox): add daily terminal-row purge 2026-05-19 01:58:19 -04:00
Joseph Doherty
77a05a8960 fix(notification-outbox): give KPI response a failure shape; log status-query faults 2026-05-19 01:55:46 -04:00
Joseph Doherty
82e3eb0e93 feat(notification-outbox): add query, retry, discard, and KPI handlers 2026-05-19 01:50:20 -04:00
Joseph Doherty
ab3721a2e8 fix(notification-outbox): clear dispatch in-flight flag on a faulted pass 2026-05-19 01:45:09 -04:00
Joseph Doherty
c41f43c87f feat(notification-outbox): add dispatcher loop to NotificationOutboxActor 2026-05-19 01:42:28 -04:00
Joseph Doherty
4dc9f9e159 feat(notification-outbox): add NotificationOutboxActor ingest 2026-05-19 01:36:13 -04:00
Joseph Doherty
435c853dce docs(plans): track SMTP-helper deduplication follow-up 2026-05-19 01:33:21 -04:00
Joseph Doherty
04e00d56c6 test(notification-outbox): cover Email adapter permanent/cancellation arms, align error casing 2026-05-19 01:32:54 -04:00
Joseph Doherty
b8dece0e70 feat(notification-outbox): add Email notification delivery adapter 2026-05-19 01:26:33 -04:00
Joseph Doherty
8d52890245 feat(notification-outbox): add NotificationOutboxOptions and delivery adapter abstraction 2026-05-19 01:20:49 -04:00
Joseph Doherty
fb589bf1da feat(notification-outbox): scaffold ScadaLink.NotificationOutbox project 2026-05-19 01:16:58 -04:00
Joseph Doherty
c547f82957 feat(notification-outbox): add notification message and outbox query contracts 2026-05-19 01:13:36 -04:00
Joseph Doherty
6056ad58b0 fix(notification-outbox): backfill NotificationLists.Type with a valid enum value in migration 2026-05-19 01:10:15 -04:00
Joseph Doherty
5696a8af9f feat(notification-outbox): add Notifications table migration 2026-05-19 01:07:30 -04:00
Joseph Doherty
07cd185368 refactor(notification-outbox): align outbox repository with cancellationToken convention 2026-05-19 01:05:52 -04:00
Joseph Doherty
2c59d59b61 feat(notification-outbox): add NotificationOutbox repository 2026-05-19 01:02:06 -04:00
Joseph Doherty
3022aa8379 style(notification-outbox): align NotificationOutboxConfiguration with sibling config style 2026-05-19 00:58:50 -04:00
Joseph Doherty
761595309b feat(notification-outbox): add Notification EF configuration and DbSet 2026-05-19 00:55:58 -04:00
Joseph Doherty
87ac9b8a4d feat(notification-outbox): add Type field to NotificationList 2026-05-19 00:52:23 -04:00
Joseph Doherty
ed7fddb0b5 test(notification-outbox): cover all Notification constructor null guards 2026-05-19 00:50:52 -04:00
Joseph Doherty
397a62677f feat(notification-outbox): add Notification entity 2026-05-19 00:48:48 -04:00
Joseph Doherty
926ca902bd test(notification-outbox): fold notification enum tests into EnumTests convention 2026-05-19 00:47:23 -04:00
Joseph Doherty
f9b942bb94 feat(notification-outbox): add NotificationType and NotificationStatus enums 2026-05-19 00:45:05 -04:00
Joseph Doherty
dff9e0aa76 docs(plans): code implementation plan for the notification outbox
26 TDD tasks across six phases — data layer, message contracts, the new
ScadaLink.NotificationOutbox project (actor, dispatcher, Email adapter),
site S&F retarget and central wiring, Central UI, and verification.
2026-05-19 00:39:10 -04:00
Joseph Doherty
f2513a4ef4 docs(notification-outbox): fix stale message-pattern count and tree alignment 2026-05-18 23:52:10 -04:00
Joseph Doherty
c8b8cd9150 docs(notification-outbox): merge duplicate S&F dependency bullet, standardize cross-ref 2026-05-18 23:48:59 -04:00
Joseph Doherty
bb35453d58 docs(notification-outbox): fix stale cross-references after outbox addition 2026-05-18 23:45:43 -04:00
Joseph Doherty
ba166bf503 docs(notification-outbox): split UI bullet, fix outbox-vs-S&F wording in CLAUDE.md 2026-05-18 23:41:32 -04:00