Skip to content

Move Raven ID out of persisence contract - #5705

Open
rbev wants to merge 4 commits into
masterfrom
rhys/notifications
Open

Move Raven ID out of persisence contract#5705
rbev wants to merge 4 commits into
masterfrom
rhys/notifications

Conversation

@rbev

@rbev rbev commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Description

The current Notifications data store is stored as a singleton document in RavenDB, and is returned directly from the INotificationsManager. The Id field on this document is not used or relevant to consumers of this interface.

To remove this field from the contract this change implements a new internal class for Raven to persist, and removes the ID field from the returned object.

Testing Improvements:

  • Added a new test class NotificationsDataStoreTests with comprehensive tests to verify default values, round-trip persistence, field updates, and field preservation for notification settings. (src/ServiceControl.Persistence.Tests/NotificationsDataStoreTests.cs)
  • Removed inclusion of the new test file from SQL Server and PostgreSQL test project files as they will be implemented in a future change.

@rbev
rbev force-pushed the rhys/notifications branch from 0dc2f39 to 735dd16 Compare August 6, 2026 09:15
@rbev
rbev marked this pull request as ready for review August 7, 2026 00:55
@rbev rbev changed the title Move raven ID out of persisence contract Move Raven ID out of persisence contract Aug 7, 2026
class NotificationsSettingsDocument
{
public string Id { get; set; }
public EmailNotifications Email { get; set; } = new();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should Raven have its own version of EmailNotifications?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That depends, if we are going to just serialise EmailNotifications as the type in the SQL settings table then they will effectively be the same.
I'm not opposed to it, but EmailNotifications is a pretty simple POCO and unlikely to change significantly so I don't know how much value will be gained from replicating it in each persistence along with object-object mapping.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fair enough

@johnsimons johnsimons left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LG but Raven entity is still using the model, not sure if that is ok.

@rbev
rbev marked this pull request as draft August 7, 2026 02:07
@rbev
rbev force-pushed the rhys/notifications branch from 735dd16 to caf1b04 Compare August 7, 2026 02:56
@rbev
rbev marked this pull request as ready for review August 7, 2026 02:56
@rbev
rbev requested a review from johnsimons August 7, 2026 02:56
throw new NotImplementedException();

public void Dispose()
public ValueTask DisposeAsync()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be public ValueTask DisposeAsync() => default;
Therre is no need for GC.SuppressFinalize(this);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants