Repository navigation
feat(notifications): version templates with safe rollback - #1862
Merged
github-actions[bot] merged 3 commits intoOct 26, 2026
Merged
Conversation
Adds versioning and rollback for notification templates (Smartdevs17#1748). Templates previously kept only the current copy per (type, channel) pair, so a bad edit was irreversible. Now every save is an immutable version and a rollback republishes an earlier snapshot as the next version — never rewinding the number, so version numbers stay monotonic and a message sent after a rollback is still distinguishable from one sent before the bad edit. Backend - notificationTemplateVersionService: saveDraft, history, and rollback with an in-memory repository; a no-op save creates no version - notificationTemplateRouter (/api/notification-templates): list, current, history, save and rollback; errors mapped to 400/404 Frontend - notificationTemplateStore: on-device mirror of the same model - TemplateVersionHistoryScreen: version timeline with rollback action - navigation registration Docs: versioning-and-rollback section in docs/NOTIFICATIONS.md
# Conflicts: # backend/server.ts # src/navigation/types.ts
# Conflicts: # backend/server.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Notification templates kept only the current copy per
(type, channel)pair, so a bad edit was irreversible. This adds versioning with safe rollback (#1748).Design choice: rollback is a forward move
Rewriting the version number back to an old value would let two different bodies claim the same version, so a message sent after a rollback could not be told apart from one sent before the bad edit. Instead, a rollback republishes the chosen snapshot as the next version and records
restoredFrom, keeping every version number unique and monotonic. Nothing is ever deleted.Backend
notificationTemplateVersionService—saveDraft(a no-op save creates no version),listVersions,getCurrent,rollback, with an in-memory repository.notificationTemplateRouter(mounted at/api/notification-templates):GET /api/notification-templatesGET /api/notification-templates/:type/:channelGET /api/notification-templates/:type/:channel/versionsPOST /api/notification-templates/:type/:channelPOST /api/notification-templates/:type/:channel/rollback?version=…Frontend
notificationTemplateStore— on-device mirror of the same model.TemplateVersionHistoryScreen— version timeline with a rollback action.Docs
New "Versioning and rollback" section in
docs/NOTIFICATIONS.md.Testing
notificationTemplateVersionService.test.ts+notificationTemplateRouter.test.ts— 27 tests, real HTTP server over the router (version chaining, no-op saves, per-channel isolation, rollback keeps bad version, invalid/no-history errors, query + body rollback).notificationTemplateStore.test.ts— 11 tests (save/no-op/rollback/selectors).TemplateVersionHistoryScreen.test.tsx— timeline, current marker, rollback.tscintroduces no new errors (516 total, same asmain).closes #1748