Skip to content

Conversation

@justandras
Copy link
Member

About the Contributor

This pull request is posted on behalf of CBC

Type of Contribution

This is a: Feature

Current Behavior

  • Currently the Live Status Gateway doesn't provide a way to subscribe to notifications present in Sofie.
  • The notifications are only exposed to the UI and not available to the gateways.

New Behavior

  • This PR adds a new topic to the Live Status Gateway that exposes the active notifications.
  • The publications for the Notification collections are now available to the gateways.

Testing

  • I have added one or more unit tests for this PR
  • I have updated the relevant unit tests
  • No unit test changes are needed for this PR

Affected areas

  • This PR affects the AsyncApi schema and Live Status Gateway API types.
  • This PR affects the Live Status Gateway.
  • This PR adds new publications to corelib
  • This PR removes publications from meteor-lib that are still available, because now they will carry over from corelib
  • This PR affects the webui

Time Frame

  • Not urgent

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

@justandras justandras requested a review from a team as a code owner October 2, 2025 11:18
@codecov-commenter
Copy link

codecov-commenter commented Oct 2, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
meteor/server/publications/system.ts 0.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@jstarpl jstarpl added Contribution from CBC/Radio-Canada Contributions sponsored by CBC/Radio-Canada (cbc.radio-canada.ca) Contribution External contribution and removed Contribution External contribution labels Oct 3, 2025
Comment on lines 66 to 88
const merged = new Map<string, DBNotificationObj>()

// Pull data from the playlist notifications handler's collection
if (this._playlistNotificationsHandler) {
const playlistDocs = this._playlistNotificationsHandler.getPublishedDocs()
for (const d of playlistDocs) {
if (d._id && !merged.has(unprotectString(d._id))) {
merged.set(unprotectString(d._id), d)
}
}
}

// Pull data from the rundown notifications handler's collection
if (this._rundownNotificationsHandler) {
const rundownDocs = this._rundownNotificationsHandler.getPublishedDocs()
for (const d of rundownDocs) {
if (d._id && !merged.has(unprotectString(d._id))) {
merged.set(unprotectString(d._id), d)
}
}
}

const newNotifications = Array.from(merged.values())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why this rather complex merging logic is needed. Are id conflicts expected? Is there a particular rule that says the first one should win?

})
}

function toNotificationTargetType(dbTargetType: DBNotificationTargetType): NotificationTargetType {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: I am not a fan of this function, it feels wordy when it could be done simpler as part of building the objects inside of toNotificationTargetRundown (and others)

this._rundownNotificationsHandler =
handlers.rundownNotificationsHandler as unknown as RundownNotificationsHandler

if (this._playlistNotificationsHandler) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be a pattern that is already in use elsewhere, but is this good behaviour? (In which case, you dont need to answer)

I suspect that if this is ever false, then this handler won't initialise and it will never initialise as there is a bug with the sequence of operations at startup?

In which case it would be good to at least log that this has failed, perhaps even throwing an error would be reasonable?
I am worried that if this does fail, it will do so silently, and leave the consumer confused as to why it doesnt work with no indication in the logs that it did fail

@justandras justandras force-pushed the feat/add-notifications-to-lsg branch from 793368c to f6c0dbd Compare October 15, 2025 10:25
@justandras justandras force-pushed the feat/add-notifications-to-lsg branch from f6c0dbd to bc26185 Compare October 15, 2025 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contribution from CBC/Radio-Canada Contributions sponsored by CBC/Radio-Canada (cbc.radio-canada.ca) Contribution External contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants