Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat(reminders): keep each reminder's recipients on its alert
Calvin1cb723530d78
diff --git a/backend/e2e-test/routes/v1/secret-reminder.spec.ts b/backend/e2e-test/routes/v1/secret-reminder.spec.tsnew file mode 100644index 0000000000..89adfb767e--- /dev/null+++ b/backend/e2e-test/routes/v1/secret-reminder.spec.ts@@ -0,0 +1,306 @@+import { seedData1 } from "@app/db/seed-data";+import { alertChannelDALFactory } from "@app/services/alert/alert-channel-dal";+import { alertChannelMembershipDALFactory } from "@app/services/alert/alert-channel-membership-dal";+import { alertDALFactory } from "@app/services/alert/alert-dal";+import { alertEventConsumerFactory } from "@app/services/alert/alert-event-consumer";+import { alertProviderRegistryFactory } from "@app/services/alert/alert-provider-registry";+import { alertServiceFactory } from "@app/services/alert/alert-service";+import { secretReminderAlertDALFactory } from "@app/services/alert/providers/secret-reminder-alert-dal";+import { secretReminderAlertProviderFactory } from "@app/services/alert/providers/secret-reminder-alert-provider";+import { eventOutboxDALFactory } from "@app/services/event-outbox/event-outbox-dal";+import { eventOutboxRegistryFactory } from "@app/services/event-outbox/event-outbox-registry";+import { eventOutboxServiceFactory } from "@app/services/event-outbox/event-outbox-service";+import { reminderDALFactory } from "@app/services/reminder/reminder-dal";+import { reminderServiceFactory } from "@app/services/reminder/reminder-service";++import { createFolder } from "../../testUtils/folders";+import { createSecretV2, deleteSecretV2 } from "../../testUtils/secrets";++const RESOURCE_TYPE = "secret.reminder";+const EVENT_TYPE = "secret.reminder.due";+const projectId = seedData1.projectV3.id;+const environment = seedData1.environment.slug;+const auth = () => ({ authorization: `Bearer ${jwtAuthToken}` });++// Services are decorated inside the routes plugin, out of a spec's reach, so the cron's two entry+// points are built here from the real DALs and the real event outbox registration. The stubbed+// dependencies are ones dispatch and reaping never call.+const buildReminderCron = () => {+ const db = testDb as never;+ const alertDAL = alertDALFactory(db);+ const alertProviderRegistry = alertProviderRegistryFactory();+ alertProviderRegistry.register(+ secretReminderAlertProviderFactory({+ secretReminderAlertDAL: secretReminderAlertDALFactory(db),+ folderDAL: {} as never,+ permissionService: {} as never+ })+ );+ const eventOutboxRegistry = eventOutboxRegistryFactory();+ eventOutboxRegistry.register(+ alertEventConsumerFactory({ alertDAL, alertEngine: {} as never, alertProviderRegistry })+ );+ return reminderServiceFactory({+ reminderDAL: reminderDALFactory(db),+ eventEmitter: eventOutboxServiceFactory({ eventOutboxDAL: eventOutboxDALFactory(db), eventOutboxRegistry }),+ alertService: alertServiceFactory({+ alertDAL,+ alertChannelDAL: alertChannelDALFactory(db),+ alertChannelMembershipDAL: alertChannelMembershipDALFactory(db),+ alertChannelService: {} as never,+ kmsService: {} as never,+ alertProviderRegistry+ }),+ projectDAL: {} as never,+ permissionService: {} as never,+ secretV2BridgeDAL: {} as never,+ folderDAL: {} as never+ });+};++const createSecret = async (key: string, secretPath = "/") => {+ await createSecretV2({+ workspaceId: projectId,+ environmentSlug: environment,+ secretPath,+ key,+ value: "value",+ authToken: jwtAuthToken+ });+ const row = await testDb("secrets_v2").where({ key, type: "shared" }).first();+ return row.id as string;+};++const setReminder = async (secretId: string, body: Record<string, unknown>) => {+ const res = await testServer.inject({+ method: "POST",+ url: `/api/v1/reminders/secrets/${secretId}`,+ headers: auth(),+ body+ });+ expect(res.statusCode).toBe(200);+};++const reminderAlert = async (secretId: string) => {+ const res = await testServer.inject({+ method: "GET",+ url: "/api/v1/alerts",+ headers: auth(),+ query: { resourceType: RESOURCE_TYPE, projectId, resourceId: secretId }+ });+ expect(res.statusCode).toBe(200);+ const { alerts } = res.json();+ return alerts;+};++const reminderAlertRows = (secretId: string) =>+ testDb("alerts").where({ resourceType: RESOURCE_TYPE, resourceId: secretId });++describe("Secret reminders delivered through alerts", async () => {+ test("setting a reminder creates its alert with an email channel to the recipients", async () => {+ const secretId = await createSecret("REMINDER_E2E_CREATE");+ await setReminder(secretId, { repeatDays: 30, message: "rotate it", recipients: [seedData1.id] });++ const [alert] = await reminderAlert(secretId);+ expect(alert.name).toBe("Reminder for REMINDER_E2E_CREATE");+ expect(alert.channels).toHaveLength(1);+ expect(alert.channels[0]).toMatchObject({+ channelType: "email",+ recipients: [{ principalType: "user", principalId: seedData1.id }]+ });++ const res = await testServer.inject({+ method: "GET",+ url: `/api/v1/reminders/secrets/${secretId}`,+ headers: auth()+ });+ expect(res.statusCode).toBe(200);+ expect(res.json().reminder).toMatchObject({ repeatDays: 30, message: "rotate it", recipients: [seedData1.id] });+ });++ test("a reminder with no recipients notifies all project members", async () => {+ const secretId = await createSecret("REMINDER_E2E_EVERYONE");+ await setReminder(secretId, { repeatDays: 7 });++ const [alert] = await reminderAlert(secretId);+ expect(alert.channels[0].recipients).toEqual([{ principalType: "project-members", principalId: projectId }]);+ });++ test("updating the reminder keeps channels added through the alert API", async () => {+ const secretId = await createSecret("REMINDER_E2E_KEEP_WEBHOOK");+ await setReminder(secretId, { repeatDays: 30, recipients: [seedData1.id] });+ const [alert] = await reminderAlert(secretId);++ const patch = await testServer.inject({+ method: "PATCH",+ url: `/api/v1/alerts/${alert.id}`,+ headers: auth(),+ body: {+ channels: [+ { id: alert.channels[0].id, name: alert.channels[0].name, channelType: "email" },+ { name: "Webhook", channelType: "webhook", config: { url: "https://example.com/reminders" } }+ ]+ }+ });+ expect(patch.statusCode).toBe(200);++ await setReminder(secretId, { repeatDays: 14 });++ const [updated] = await reminderAlert(secretId);+ expect(updated.channels.map((channel) => channel.channelType).sort()).toEqual(["email", "webhook"]);+ expect(updated.channels.find((channel) => channel.channelType === "email")?.recipients).toEqual([+ { principalType: "project-members", principalId: projectId }+ ]);+ });++ test("the secret listing reports recipients from the reminder's alert", async () => {+ const secretId = await createSecret("REMINDER_E2E_LISTING");+ await setReminder(secretId, { repeatDays: 30, recipients: [seedData1.id] });++ const res = await testServer.inject({+ method: "GET",+ url: "/api/v1/dashboard/secrets-details",+ headers: auth(),+ query: {+ projectId,+ environment,+ secretPath: "/",+ search: "REMINDER_E2E_LISTING",+ includeSecrets: "true"+ }+ });+ expect(res.statusCode).toBe(200);+ const [secret] = res.json().secrets as {+ secretReminderRecipients: { user: { id: string } }[];+ secretReminderRepeatDays: number;+ }[];+ expect(secret.secretReminderRepeatDays).toBe(30);+ expect(secret.secretReminderRecipients.map((recipient) => recipient.user.id)).toEqual([seedData1.id]);+ });++ test("listing reminder alerts across a project is refused", async () => {+ const res = await testServer.inject({+ method: "GET",+ url: "/api/v1/alerts",+ headers: auth(),+ query: { resourceType: RESOURCE_TYPE, projectId }+ });+ expect(res.statusCode).toBe(400);+ });++ test("moving a secret carries its reminder alert to the new secret", async () => {+ await createFolder({+ workspaceId: projectId,+ environmentSlug: environment,+ secretPath: "/",+ name: "reminder-move-dest",+ authToken: jwtAuthToken+ });+ const secretId = await createSecret("REMINDER_E2E_MOVE");+ await setReminder(secretId, { repeatDays: 30, recipients: [seedData1.id] });+ const [before] = await reminderAlert(secretId);++ const move = await testServer.inject({+ method: "POST",+ url: "/api/v4/secrets/move",+ headers: auth(),+ body: {+ projectId,+ sourceEnvironment: environment,+ sourceSecretPath: "/",+ destinationEnvironment: environment,+ destinationSecretPath: "/reminder-move-dest",+ secretIds: [secretId]+ }+ });+ expect(move.statusCode).toBe(200);++ const moved = await testDb("secrets_v2").where({ key: "REMINDER_E2E_MOVE", type: "shared" }).first();+ expect(moved.id).not.toBe(secretId);+ expect(await reminderAlertRows(secretId)).toHaveLength(0);+ const movedAlerts = await reminderAlertRows(moved.id as string);+ expect(movedAlerts.map((alert) => alert.id)).toEqual([before.id]);+ });++ test("the cron emits one event per due reminder and moves the schedule forward", async () => {+ const secretId = await createSecret("REMINDER_E2E_DISPATCH");+ await setReminder(secretId, { repeatDays: 30, message: "rotate it" });++ const today = new Date();+ today.setUTCHours(0, 0, 0, 0);+ await testDb("reminders").where({ secretId }).update({ nextReminderDate: today });++ await buildReminderCron().dispatchDueReminders();++ const occurrenceDate = today.toISOString().slice(0, 10);+ const events = await testDb("event_outbox").where({+ eventType: EVENT_TYPE,+ idempotencyKey: `${EVENT_TYPE}:${secretId}:${occurrenceDate}`+ });+ expect(events).toHaveLength(1);+ expect(events[0].payload).toMatchObject({+ resourceType: RESOURCE_TYPE,+ resourceId: secretId,+ targetIds: [secretId],+ note: "rotate it",+ repeatDays: 30,+ occurrenceDate+ });++ const reminder = await testDb("reminders").where({ secretId }).first();+ expect(new Date(reminder.nextReminderDate).getTime()).toBe(today.getTime() + 30 * 24 * 60 * 60 * 1000);+ });++ test("a one-time reminder is removed once it fires, but its alert stays as the record", async () => {+ const secretId = await createSecret("REMINDER_E2E_ONE_OFF");+ const tomorrow = new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString();+ await setReminder(secretId, { nextReminderDate: tomorrow });++ const today = new Date();+ today.setUTCHours(0, 0, 0, 0);+ await testDb("reminders").where({ secretId }).update({ nextReminderDate: today });+ await buildReminderCron().dispatchDueReminders();++ expect(await testDb("reminders").where({ secretId })).toHaveLength(0);+ expect(await reminderAlertRows(secretId)).toHaveLength(1);+ });++ test("deleting the reminder deletes its alert", async () => {+ const secretId = await createSecret("REMINDER_E2E_DELETE_REMINDER");+ await setReminder(secretId, { repeatDays: 30 });++ const res = await testServer.inject({+ method: "DELETE",+ url: `/api/v1/reminders/secrets/${secretId}`,+ headers: auth()+ });+ expect(res.statusCode).toBe(200);+ expect(await reminderAlertRows(secretId)).toHaveLength(0);+ });++ test("the cron reaps alerts whose secret was deleted", async () => {+ const secretId = await createSecret("REMINDER_E2E_REAP");+ await setReminder(secretId, { repeatDays: 30 });+ const [alert] = await reminderAlert(secretId);++ await deleteSecretV2({+ workspaceId: projectId,+ environmentSlug: environment,+ secretPath: "/",+ key: "REMINDER_E2E_REAP",+ authToken: jwtAuthToken+ });+ // A second orphan whose secret never existed shows the sweep does not rely on any delete path.+ await testDb("alerts").insert({+ ...(await testDb("alerts").where({ id: alert.id }).first()),+ id: undefined,+ resourceId: "11111111-1111-4111-8111-111111111111",+ name: "orphan"+ });++ await buildReminderCron().reapOrphanedReminderAlerts();++ expect(await reminderAlertRows(secretId)).toHaveLength(0);+ expect(await reminderAlertRows("11111111-1111-4111-8111-111111111111")).toHaveLength(0);+ });+});diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex dfd5c62883..2859735570 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -491,7 +491,6 @@ import { projectMembershipServiceFactory } from "@app/services/project-membershiimport { reminderDALFactory } from "@app/services/reminder/reminder-dal";import { dailyReminderQueueServiceFactory } from "@app/services/reminder/reminder-queue";import { reminderServiceFactory } from "@app/services/reminder/reminder-service";-import { reminderRecipientDALFactory } from "@app/services/reminder-recipients/reminder-recipient-dal";import { dailyResourceCleanUpQueueServiceFactory } from "@app/services/resource-cleanup/resource-cleanup-queue";import { resourceMetadataDALFactory } from "@app/services/resource-metadata/resource-metadata-dal";import { resourceMetadataServiceFactory } from "@app/services/resource-metadata/resource-metadata-service";@@ -679,7 +678,6 @@ export const registerRoutes = async (const secretVersionTagV2BridgeDAL = secretVersionV2TagBridgeDALFactory(db);const reminderDAL = reminderDALFactory(db);- const reminderRecipientDAL = reminderRecipientDALFactory(db);const integrationDAL = integrationDALFactory(db);const offlineUsageReportDAL = offlineUsageReportDALFactory(db);@@ -1531,9 +1529,9 @@ export const registerRoutes = async (const reminderService = reminderServiceFactory({reminderDAL,- reminderRecipientDAL,eventEmitter: eventOutboxService,alertService,+ projectDAL,permissionService,secretV2BridgeDAL,folderDALdiff --git a/backend/src/services/alert/alert-dal.ts b/backend/src/services/alert/alert-dal.tsindex a1fd27ffd9..deb9a8a6b0 100644--- a/backend/src/services/alert/alert-dal.ts+++ b/backend/src/services/alert/alert-dal.ts@@ -187,8 +187,43 @@ export const alertDALFactory = (db: TDbClient) => {}};+ // Principals on a resource's alert channels of one type, without loading or decrypting the channels.+ const findRecipientsForResources = async (+ {+ resourceType,+ resourceIds,+ channelType,+ principalType+ }: { resourceType: string; resourceIds: string[]; channelType: string; principalType: string },+ tx?: Knex+ ): Promise<{ resourceId: string; principalId: string }[]> => {+ if (resourceIds.length === 0) return [];+ try {+ const rows = await (tx || db.replicaNode())(TableName.Alert)+ .where(`${TableName.Alert}.resourceType`, resourceType)+ .whereIn(`${TableName.Alert}.resourceId`, resourceIds)+ .join(TableName.AlertChannelMembership, `${TableName.Alert}.id`, `${TableName.AlertChannelMembership}.alertId`)+ .join(TableName.AlertChannel, `${TableName.AlertChannelMembership}.channelId`, `${TableName.AlertChannel}.id`)+ .where(`${TableName.AlertChannel}.channelType`, channelType)+ .join(+ TableName.AlertChannelRecipient,+ `${TableName.AlertChannel}.id`,+ `${TableName.AlertChannelRecipient}.channelId`+ )+ .where(`${TableName.AlertChannelRecipient}.principalType`, principalType)+ .distinct(+ db.ref("resourceId").withSchema(TableName.Alert).as("resourceId"),+ db.ref("principalId").withSchema(TableName.AlertChannelRecipient).as("principalId")+ );+ return rows as { resourceId: string; principalId: string }[];+ } catch (error) {+ throw new DatabaseError({ error, name: "FindRecipientsForResources" });+ }+ };+return {...alertOrm,+ findRecipientsForResources,findEnabledByResourceType,findEnabledForEvent,findActiveById,diff --git a/backend/src/services/alert/alert-service.ts b/backend/src/services/alert/alert-service.tsindex 982b1d7e5d..dfc6630b9f 100644--- a/backend/src/services/alert/alert-service.ts+++ b/backend/src/services/alert/alert-service.ts@@ -558,6 +558,11 @@ export const alertServiceFactory = ({await alertDAL.update({ resourceType, resourceId: fromResourceId }, { resourceId: toResourceId }, tx);};+ const findRecipientsForResources = (+ input: { resourceType: string; resourceIds: string[]; channelType: string; principalType: string },+ tx?: Knex+ ) => alertDAL.findRecipientsForResources(input, tx);+const filterRecipientsInScope = (scope: { orgId: string; projectId?: string | null },recipients: TChannelRecipientInput[],@@ -577,6 +582,7 @@ export const alertServiceFactory = ({findAlertsForResources,deleteAlertsForDeletedResources,repointAlertsForResource,+ findRecipientsForResources,filterRecipientsInScope};};diff --git a/backend/src/services/reminder/reminder-service.test.ts b/backend/src/services/reminder/reminder-service.test.tsindex 874adc61c4..07f0355dfa 100644--- a/backend/src/services/reminder/reminder-service.test.ts+++ b/backend/src/services/reminder/reminder-service.test.ts@@ -174,3 +174,204 @@ describe("orphaned reminder alert reaping", () => {expect(reaped).toEqual([]);});});++type TStoredAlert = {+ id: string;+ name: string;+ resourceId: string;+ channels: Array<{+ id: string;+ name: string;+ channelType: string;+ enabled: boolean;+ recipients: { principalType: string; principalId: string }[];+ }>;+};++const buildWriteService = (opts: { existingAlert?: TStoredAlert; projectUserIds?: string[] } = {}) => {+ const calls: string[] = [];+ const created: unknown[] = [];+ const updated: Array<{ alertId: string; name?: string; channels?: unknown[] }> = [];+ const deletedAlerts: Array<{ resourceIds: string[]; tx: unknown }> = [];+ const repointed: Array<{ fromResourceId: string; toResourceId: string; tx: unknown }> = [];++ const service = reminderServiceFactory({+ reminderDAL: {+ findOne: async () => undefined,+ create: async (data: Record<string, unknown>) => {+ calls.push("reminder:create");+ return { id: "rem-1", ...data };+ },+ updateById: async () => ({}),+ delete: async () => [],+ findSecretReminders: async (secretIds: string[]) =>+ secretIds.map((secretId) => ({ id: `rem-${secretId}`, secretId, recipients: ["stale-user"] }))+ },+ eventEmitter: { emit: async () => {} },+ projectDAL: { findById: async () => ({ id: "proj-1", orgId: "org-1" }) },+ secretV2BridgeDAL: {+ findOneWithTags: async () => ({ id: "secret-1", key: "DB_PASSWORD", projectId: "proj-1" }),+ invalidateSecretCacheByProjectId: async () => {}+ },+ alertService: {+ filterRecipientsInScope: async (_scope: unknown, recipients: { principalType: string; principalId: string }[]) =>+ opts.projectUserIds ? recipients.filter((r) => opts.projectUserIds!.includes(r.principalId)) : recipients,+ findAlertsForResources: async () => (opts.existingAlert ? [opts.existingAlert] : []),+ createAlertInternal: async (input: unknown) => {+ calls.push("alert:create");+ created.push(input);+ return input;+ },+ updateAlertInternal: async (input: { alertId: string; name?: string; channels?: unknown[] }) => {+ calls.push("alert:update");+ updated.push(input);+ return input;+ },+ findRecipientsForResources: async ({ resourceIds }: { resourceIds: string[] }) =>+ resourceIds.map((resourceId) => ({ resourceId, principalId: "user-1" })),+ deleteAlertsForDeletedResources: async ({ resourceIds }: { resourceIds: string[] }, tx?: unknown) => {+ calls.push("alert:delete");+ deletedAlerts.push({ resourceIds, tx });+ return resourceIds.length;+ },+ repointAlertsForResource: async (input: { fromResourceId: string; toResourceId: string }, tx: unknown) => {+ calls.push("alert:repoint");+ repointed.push({ ...input, tx });+ }+ }+ } as never);++ return { service, calls, created, updated, deletedAlerts, repointed };+};++const createInput = (recipients?: string[] | null) => ({+ secretId: "secret-1",+ projectId: "proj-1",+ repeatDays: 30,+ message: "rotate it",+ recipients+});++describe("reminder alert sync", () => {+ test("a new reminder gets an alert with an email channel to its recipients, created by the platform", async () => {+ const { service, created } = buildWriteService();+ await service.createReminderInternal(createInput(["user-1", "user-2"]));++ expect(created).toEqual([+ expect.objectContaining({+ name: "Reminder for DB_PASSWORD",+ resourceType: SECRET_REMINDER_RESOURCE_TYPE,+ resourceId: "secret-1",+ eventType: SECRET_REMINDER_DUE_EVENT,+ orgId: "org-1",+ projectId: "proj-1",+ createdBy: { actorType: "platform", actorId: null },+ channels: [+ {+ name: "Email",+ channelType: "email",+ recipients: [+ { principalType: "user", principalId: "user-1" },+ { principalType: "user", principalId: "user-2" }+ ]+ }+ ]+ })+ ]);+ });++ test("syncs the alert before writing the reminder, so a reminder never exists without one", async () => {+ const { service, calls } = buildWriteService();+ await service.createReminderInternal(createInput(["user-1"]));+ expect(calls).toEqual(["alert:create", "reminder:create"]);+ });++ test("no recipients means everyone in the project", async () => {+ const { service, created } = buildWriteService();+ await service.createReminderInternal(createInput([]));+ expect((created[0] as { channels: { recipients: unknown }[] }).channels[0].recipients).toEqual([+ { principalType: "project-members", principalId: "proj-1" }+ ]);+ });++ test("recipients who left the project are dropped instead of failing the write", async () => {+ const { service, created } = buildWriteService({ projectUserIds: ["user-1"] });+ await service.createReminderInternal(createInput(["user-1", "user-gone"]));+ expect((created[0] as { channels: { recipients: unknown }[] }).channels[0].recipients).toEqual([+ { principalType: "user", principalId: "user-1" }+ ]);+ });++ test("falls back to everyone when every listed recipient has left", async () => {+ const { service, created } = buildWriteService({ projectUserIds: [] });+ await service.createReminderInternal(createInput(["user-gone"]));+ expect((created[0] as { channels: { recipients: unknown }[] }).channels[0].recipients).toEqual([+ { principalType: "project-members", principalId: "proj-1" }+ ]);+ });++ test("more than 20 recipients are split across email channels", async () => {+ const { service, created } = buildWriteService();+ await service.createReminderInternal(createInput(Array.from({ length: 45 }, (_, i) => `user-${i}`)));+ const { channels } = created[0] as { channels: { name: string; recipients: unknown[] }[] };+ expect(channels.map((c) => c.name)).toEqual(["Email", "Email 2", "Email 3"]);+ expect(channels.map((c) => c.recipients.length)).toEqual([20, 20, 5]);+ });++ test("updating keeps Slack, webhook and PagerDuty channels and reuses the email channel", async () => {+ const { service, updated, created } = buildWriteService({+ existingAlert: {+ id: "alert-1",+ name: "Reminder for OLD_NAME",+ resourceId: "secret-1",+ channels: [+ { id: "ch-email", name: "Team email", channelType: "email", enabled: true, recipients: [] },+ { id: "ch-hook", name: "Webhook", channelType: "webhook", enabled: false, recipients: [] }+ ]+ }+ });+ await service.createReminderInternal(createInput(["user-1"]));++ expect(created).toHaveLength(0);+ expect(updated).toEqual([+ {+ alertId: "alert-1",+ name: "Reminder for DB_PASSWORD",+ channels: [+ {+ id: "ch-email",+ name: "Team email",+ channelType: "email",+ recipients: [{ principalType: "user", principalId: "user-1" }]+ },+ { id: "ch-hook", name: "Webhook", channelType: "webhook", enabled: false }+ ]+ }+ ]);+ });++ test("deleting a reminder by secret also removes its alert inside the caller's transaction", async () => {+ const { service, deletedAlerts } = buildWriteService();+ const tx = { tx: true } as never;+ await service.deleteReminderBySecretId("secret-1", "proj-1", tx);+ expect(deletedAlerts).toEqual([{ resourceIds: ["secret-1"], tx }]);+ });++ test("moving reminders clears the destination's alert, then moves the source alert onto it", async () => {+ const { service, calls, deletedAlerts, repointed } = buildWriteService();+ const tx = { tx: true } as never;+ await service.moveReminderAlerts([{ fromSecretId: "secret-src", toSecretId: "secret-dst" }], tx);++ expect(calls).toEqual(["alert:delete", "alert:repoint"]);+ expect(deletedAlerts).toEqual([{ resourceIds: ["secret-dst"], tx }]);+ expect(repointed).toEqual([+ { resourceType: SECRET_REMINDER_RESOURCE_TYPE, fromResourceId: "secret-src", toResourceId: "secret-dst", tx }+ ]);+ });++ test("dashboard recipients come from the alert, not the old recipients table", async () => {+ const { service } = buildWriteService();+ const reminders = await service.getRemindersForDashboard(["secret-1"]);+ expect(reminders["secret-1"].recipients).toEqual(["user-1"]);+ });+});diff --git a/backend/src/services/reminder/reminder-service.ts b/backend/src/services/reminder/reminder-service.tsindex 2677d0d977..d5cf2b9c13 100644--- a/backend/src/services/reminder/reminder-service.ts+++ b/backend/src/services/reminder/reminder-service.ts@@ -9,25 +9,40 @@ import { ProjectPermissionSecretActions, ProjectPermissionSub } from "@app/ee/seimport { BadRequestError, NotFoundError } from "@app/lib/errors";import { logger } from "@app/lib/logger";+import { TAlertChannelInput } from "../alert/alert-channel-service-types";+import { AlertChannelType } from "../alert/alert-channel-types";import { TAlertServiceFactory } from "../alert/alert-service";+import { AlertPrincipalType, MAX_RECIPIENTS_PER_CHANNEL } from "../alert/alert-types";import { ActorAuthMethod, ActorType } from "../auth/auth-type";import { TEventEmitter } from "../event-outbox/event-outbox-types";-import { TReminderRecipientDALFactory } from "../reminder-recipients/reminder-recipient-dal";+import { TProjectDALFactory } from "../project/project-dal";import { TSecretFolderDALFactory } from "../secret-folder/secret-folder-dal";import { TSecretV2BridgeDALFactory } from "../secret-v2-bridge/secret-v2-bridge-dal";import { TReminderDALFactory } from "./reminder-dal";-import { emitSecretReminderDue, SECRET_REMINDER_RESOURCE_TYPE } from "./reminder-events";+import { emitSecretReminderDue, SECRET_REMINDER_DUE_EVENT, SECRET_REMINDER_RESOURCE_TYPE } from "./reminder-events";import { advanceReminderDate, getReminderDueWindow, toUtcDateString } from "./reminder-fns";import { TBatchCreateReminderDTO, TCreateReminderDTO, TReminderServiceFactory } from "./reminder-types";const ORPHAN_REAP_BATCH_SIZE = 500;const MAX_ORPHAN_REAP_BATCHES = 20;+const MAX_ALERT_NAME_LENGTH = 255;++const reminderAlertName = (secretKey: string) => `Reminder for ${secretKey}`.slice(0, MAX_ALERT_NAME_LENGTH);type TReminderServiceFactoryDep = {reminderDAL: TReminderDALFactory;- reminderRecipientDAL: TReminderRecipientDALFactory;eventEmitter: TEventEmitter;- alertService: Pick<TAlertServiceFactory, "deleteAlertsForDeletedResources">;+ alertService: Pick<+ TAlertServiceFactory,+ | "createAlertInternal"+ | "updateAlertInternal"+ | "findAlertsForResources"+ | "findRecipientsForResources"+ | "deleteAlertsForDeletedResources"+ | "repointAlertsForResource"+ | "filterRecipientsInScope"+ >;+ projectDAL: Pick<TProjectDALFactory, "findById">;permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">;secretV2BridgeDAL: Pick<TSecretV2BridgeDALFactory, "invalidateSecretCacheByProjectId" | "findOneWithTags">;folderDAL: Pick<TSecretFolderDALFactory, "findSecretPathByFolderIds">;@@ -35,9 +50,9 @@ type TReminderServiceFactoryDep = {export const reminderServiceFactory = ({reminderDAL,- reminderRecipientDAL,eventEmitter,alertService,+ projectDAL,permissionService,secretV2BridgeDAL,folderDAL@@ -48,38 +63,98 @@ export const reminderServiceFactory = ({return result;};- const $manageReminderRecipients = async (reminderId: string, newRecipients?: string[] | null): Promise<void> => {- if (!newRecipients || newRecipients.length === 0) {- // If no recipients provided, remove all existing recipients- await reminderRecipientDAL.delete({ reminderId });- return;- }-- // Remove duplicates from input- const uniqueRecipients = [...new Set(newRecipients)];+ const $findReminderRecipientIds = async (secretIds: string[], tx?: Knex): Promise<Map<string, string[]>> => {+ const rows = await alertService.findRecipientsForResources(+ {+ resourceType: SECRET_REMINDER_RESOURCE_TYPE,+ resourceIds: secretIds,+ channelType: AlertChannelType.EMAIL,+ principalType: AlertPrincipalType.USER+ },+ tx+ );+ const bySecret = new Map<string, string[]>();+ rows.forEach(({ resourceId, principalId }) => {+ bySecret.set(resourceId, [...(bySecret.get(resourceId) ?? []), principalId]);+ });+ return bySecret;+ };- // Get existing recipients- const existingRecipients = await reminderRecipientDAL.find({ reminderId });- const existingUserIds = new Set(existingRecipients.map((r) => r.userId));- const newUserIds = new Set(uniqueRecipients);+ // The reminder API only knows user ids, so it owns the alert's email channels and leaves every other+ // channel (Slack, webhook, PagerDuty) as the user configured it. An empty list keeps the reminder's+ // original meaning: everyone in the project.+ const $syncReminderAlert = async ({+ secretId,+ secretKey,+ projectId,+ recipients,+ createdBy+ }: {+ secretId: string;+ secretKey: string;+ projectId: string;+ recipients?: string[] | null;+ createdBy: { actorType: ActorType; actorId: string | null };+ }) => {+ const project = await projectDAL.findById(projectId);+ if (!project) throw new NotFoundError({ message: `Project with ID '${projectId}' not found` });- // Find recipients to add and remove- const recipientsToAdd = uniqueRecipients.filter((userId) => !existingUserIds.has(userId));- const recipientsToRemove = existingRecipients.filter((r) => !newUserIds.has(r.userId));+ // Reminder recipients were never pruned when someone left the project, so drop them rather than fail.+ const inScope = await alertService.filterRecipientsInScope(+ { orgId: project.orgId, projectId },+ [...new Set(recipients ?? [])].map((principalId) => ({ principalType: AlertPrincipalType.USER, principalId }))+ );+ const emailRecipients = inScope.length+ ? inScope+ : [{ principalType: AlertPrincipalType.PROJECT_MEMBERS, principalId: projectId }];- // Perform database operations- if (recipientsToRemove.length > 0) {- await reminderRecipientDAL.delete({ $in: { id: recipientsToRemove.map((r) => r.id) } });+ const [existing] = await alertService.findAlertsForResources({+ resourceType: SECRET_REMINDER_RESOURCE_TYPE,+ resourceIds: [secretId]+ });+ const existingEmailChannels =+ existing?.channels.filter((channel) => channel.channelType === AlertChannelType.EMAIL) ?? [];++ const emailChannels: TAlertChannelInput[] = [];+ for (let i = 0; i < emailRecipients.length; i += MAX_RECIPIENTS_PER_CHANNEL) {+ const index = emailChannels.length;+ emailChannels.push({+ ...(existingEmailChannels[index] ? { id: existingEmailChannels[index].id } : {}),+ name: existingEmailChannels[index]?.name ?? (index === 0 ? "Email" : `Email ${index + 1}`),+ channelType: AlertChannelType.EMAIL,+ recipients: emailRecipients.slice(i, i + MAX_RECIPIENTS_PER_CHANNEL)+ });}- if (recipientsToAdd.length > 0) {- await reminderRecipientDAL.insertMany(- recipientsToAdd.map((userId) => ({- reminderId,- userId- }))- );+ if (!existing) {+ await alertService.createAlertInternal({+ name: reminderAlertName(secretKey),+ resourceType: SECRET_REMINDER_RESOURCE_TYPE,+ resourceId: secretId,+ eventType: SECRET_REMINDER_DUE_EVENT,+ condition: null,+ orgId: project.orgId,+ projectId,+ channels: emailChannels,+ createdBy+ });+ return;}++ const otherChannels: TAlertChannelInput[] = existing.channels+ .filter((channel) => channel.channelType !== AlertChannelType.EMAIL)+ .map((channel) => ({+ id: channel.id,+ name: channel.name,+ channelType: channel.channelType as AlertChannelType,+ enabled: channel.enabled+ }));++ await alertService.updateAlertInternal({+ alertId: existing.id,+ name: reminderAlertName(secretKey),+ channels: [...emailChannels, ...otherChannels]+ });};const $getSecretForPermissionCheck = async (secretId: string) => {@@ -106,26 +181,27 @@ export const reminderServiceFactory = ({};};- const createReminderInternal: TReminderServiceFactory["createReminderInternal"] = async ({+ const $saveReminder = async ({secretId,+ secretKey,message,repeatDays,nextReminderDate: nextReminderDateInput,recipients,projectId,- fromDate: fromDateInput+ fromDate: fromDateInput,+ createdBy}: {- secretId?: string;+ secretId: string;+ secretKey: string;message?: string | null;repeatDays?: number | null;nextReminderDate?: string | null;recipients?: string[] | null;fromDate?: string | null;projectId: string;+ createdBy: { actorType: ActorType; actorId: string | null };}) => {- if (!secretId) {- throw new BadRequestError({ message: "secretId is required" });- }let nextReminderDate;let fromDate;if (nextReminderDateInput) {@@ -145,11 +221,14 @@ export const reminderServiceFactory = ({throw new BadRequestError({ message: "repeatDays must be a positive number" });}+ // The alert goes first, outside any transaction because encrypting channel config can call out to+ // KMS. If the reminder write then fails, an alert with no reminder never fires and is reused next time.+ await $syncReminderAlert({ secretId, secretKey, projectId, recipients, createdBy });+const existingReminder = await reminderDAL.findOne({ secretId });let reminderId: string;if (existingReminder) {- // Update existing reminderawait reminderDAL.updateById(existingReminder.id, {message,repeatDays,@@ -158,7 +237,6 @@ export const reminderServiceFactory = ({});reminderId = existingReminder.id;} else {- // Create new reminderconst newReminder = await reminderDAL.create({secretId,message,@@ -169,12 +247,32 @@ export const reminderServiceFactory = ({reminderId = newReminder.id;}- // Manage recipients (add/update/delete as needed)- await $manageReminderRecipients(reminderId, recipients);await secretV2BridgeDAL.invalidateSecretCacheByProjectId(projectId);return { id: reminderId, created: !existingReminder };};+ const createReminderInternal: TReminderServiceFactory["createReminderInternal"] = async ({+ secretId,+ projectId,+ ...reminder+ }) => {+ if (!secretId) {+ throw new BadRequestError({ message: "secretId is required" });+ }+ const secret = await secretV2BridgeDAL.findOneWithTags({ [`${TableName.SecretV2}.id` as "id"]: secretId });+ if (!secret) {+ throw new NotFoundError({ message: `Secret with ID '${secretId}' not found` });+ }++ return $saveReminder({+ ...reminder,+ secretId,+ secretKey: secret.key,+ projectId,+ createdBy: { actorType: ActorType.PLATFORM, actorId: null }+ });+ };+const createReminder: TReminderServiceFactory["createReminder"] = async ({actor,actorId,@@ -196,11 +294,13 @@ export const reminderServiceFactory = ({subject(ProjectPermissionSub.Secrets, subjectFields));- const response = await createReminderInternal({+ return $saveReminder({...reminder,- projectId: secret.projectId+ secretId: secret.id,+ secretKey: secret.key,+ projectId: secret.projectId,+ createdBy: { actorType: actor, actorId }});- return response;};const getReminder: TReminderServiceFactory["getReminder"] = async ({@@ -231,7 +331,9 @@ export const reminderServiceFactory = ({subjectFields);const reminder = await reminderDAL.findSecretReminder(secretId);- return reminder;+ if (!reminder) return null;+ const recipientIds = await $findReminderRecipientIds([secretId]);+ return { ...reminder, recipients: recipientIds.get(secretId) ?? [] };};const dispatchDueReminders: TReminderServiceFactory["dispatchDueReminders"] = async () => {@@ -320,6 +422,10 @@ export const reminderServiceFactory = ({subject(ProjectPermissionSub.Secrets, subjectFields));await reminderDAL.delete({ secretId });+ await alertService.deleteAlertsForDeletedResources({+ resourceType: SECRET_REMINDER_RESOURCE_TYPE,+ resourceIds: [secretId]+ });await secretV2BridgeDAL.invalidateSecretCacheByProjectId(secret.projectId);};@@ -329,6 +435,10 @@ export const reminderServiceFactory = ({tx?: Knex) => {await reminderDAL.delete({ secretId }, tx);+ await alertService.deleteAlertsForDeletedResources(+ { resourceType: SECRET_REMINDER_RESOURCE_TYPE, resourceIds: [secretId] },+ tx+ );await secretV2BridgeDAL.invalidateSecretCacheByProjectId(projectId);};@@ -346,7 +456,6 @@ export const reminderServiceFactory = ({message,repeatDays,nextReminderDate: nextReminderDateInput,- recipients,projectId,fromDate: fromDateInput}) => {@@ -375,7 +484,6 @@ export const reminderServiceFactory = ({message,repeatDays,nextReminderDate,- recipients: recipients ? [...new Set(recipients)] : [],projectId,fromDate};@@ -393,24 +501,6 @@ export const reminderServiceFactory = ({tx);- const allRecipientInserts: Array<{ reminderId: string; userId: string }> = [];-- newReminders.forEach((reminder, index) => {- const { recipients } = processedReminders[index];- if (recipients && recipients.length > 0) {- recipients.forEach((userId) => {- allRecipientInserts.push({- reminderId: reminder.id,- userId- });- });- }- });-- if (allRecipientInserts.length > 0) {- await reminderRecipientDAL.insertMany(allRecipientInserts, tx);- }-const projectIds = new Set(processedReminders.map((r) => r.projectId).filter((id): id is string => Boolean(id)));for (const projectId of projectIds) {await secretV2BridgeDAL.invalidateSecretCacheByProjectId(projectId);@@ -422,16 +512,41 @@ export const reminderServiceFactory = ({};};+ // Alerts are copied by moving them rather than rebuilding them, so channel secrets (webhook signing+ // keys, PagerDuty integration keys) and send history follow the secret to its new id.+ const moveReminderAlerts: TReminderServiceFactory["moveReminderAlerts"] = async (moves, tx) => {+ if (moves.length === 0) return;+ await alertService.deleteAlertsForDeletedResources(+ { resourceType: SECRET_REMINDER_RESOURCE_TYPE, resourceIds: moves.map((move) => move.toSecretId) },+ tx+ );+ for (const move of moves) {+ await alertService.repointAlertsForResource(+ {+ resourceType: SECRET_REMINDER_RESOURCE_TYPE,+ fromResourceId: move.fromSecretId,+ toResourceId: move.toSecretId+ },+ tx+ );+ }+ };+const getRemindersForDashboard: TReminderServiceFactory["getRemindersForDashboard"] = async (secretIds) => {// scott we don't need to check permissions/secret existence because these are the// secrets from the dashboard that have already gone through these checksconst reminders = await reminderDAL.findSecretReminders(secretIds);+ const recipientIds = await $findReminderRecipientIds(+ reminders.map((reminder) => reminder.secretId).filter((id): id is string => Boolean(id))+ );const reminderMap: Record<string, (typeof reminders)[number]> = {};reminders.forEach((reminder) => {- if (reminder.secretId) reminderMap[reminder.secretId] = reminder;+ if (reminder.secretId) {+ reminderMap[reminder.secretId] = { ...reminder, recipients: recipientIds.get(reminder.secretId) ?? [] };+ }});return reminderMap;@@ -445,6 +560,7 @@ export const reminderServiceFactory = ({deleteReminder,deleteReminderBySecretId,batchCreateReminders,+ moveReminderAlerts,createReminderInternal,getRemindersForDashboard};diff --git a/backend/src/services/reminder/reminder-types.ts b/backend/src/services/reminder/reminder-types.tsindex 6e3d4cb5e2..121a2958d0 100644--- a/backend/src/services/reminder/reminder-types.ts+++ b/backend/src/services/reminder/reminder-types.ts@@ -34,7 +34,6 @@ export type TBatchCreateReminderDTO = {repeatDays?: number | null;nextReminderDate?: string | Date | null;fromDate?: Date | null;- recipients?: string[] | null;projectId?: string;}[];@@ -86,6 +85,8 @@ export interface TReminderServiceFactory {reminderIds: string[];}>;+ moveReminderAlerts: (moves: { fromSecretId: string; toSecretId: string }[], tx: Knex) => Promise<void>;+createReminderInternal: ({secretId,message,diff --git a/backend/src/services/secret-folder/secret-folder-service.ts b/backend/src/services/secret-folder/secret-folder-service.tsindex c346a6cf1f..17196af669 100644--- a/backend/src/services/secret-folder/secret-folder-service.ts+++ b/backend/src/services/secret-folder/secret-folder-service.ts@@ -117,7 +117,7 @@ type TSecretFolderServiceFactoryDep = {secretImportDAL: Pick<TSecretImportDALFactory, "findImportByFolderIds">;secretV2BridgeService: Pick<TSecretV2BridgeServiceFactory, "dispatchSecretMoveSideEffects">;reminderDAL: Pick<TReminderDALFactory, "findSecretReminders" | "delete">;- reminderService: Pick<TReminderServiceFactory, "batchCreateReminders">;+ reminderService: Pick<TReminderServiceFactory, "batchCreateReminders" | "moveReminderAlerts">;keyStore: Pick<TKeyStoreFactory, "acquireLock">;};diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.tsindex f7effe98ee..411cc49d2a 100644--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts@@ -16,6 +16,9 @@ import {TFindOpt} from "@app/lib/knex";import { OrderByDirection } from "@app/lib/types";+import { AlertChannelType } from "@app/services/alert/alert-channel-types";+import { AlertPrincipalType } from "@app/services/alert/alert-types";+import { SECRET_REMINDER_RESOURCE_TYPE } from "@app/services/reminder/reminder-events";import type { TFindSecretsByFolderIdsFilter } from "@app/services/secret-v2-bridge/secret-v2-bridge-types";export const SecretServiceCacheKeys = {@@ -783,8 +786,36 @@ export const secretV2BridgeDALFactory = ({ db, keyStore }: TSecretV2DalArg) => {`${TableName.HoneyTokenSecretMapping}.secretId`).leftJoin(TableName.Reminder, `${TableName.SecretV2}.id`, `${TableName.Reminder}.secretId`)- .leftJoin(TableName.ReminderRecipient, `${TableName.Reminder}.id`, `${TableName.ReminderRecipient}.reminderId`)- .leftJoin(TableName.Users, `${TableName.ReminderRecipient}.userId`, `${TableName.Users}.id`)+ // Reminder recipients live on the reminder's alert email channel.+ .leftJoin(TableName.Alert, (bd) => {+ void bd+ .on(`${TableName.Alert}.resourceId`, db.raw(`"${TableName.SecretV2}"."id"::text`))+ .andOn(`${TableName.Alert}.resourceType`, db.raw("?", [SECRET_REMINDER_RESOURCE_TYPE]));+ })+ .leftJoin(+ TableName.AlertChannelMembership,+ `${TableName.Alert}.id`,+ `${TableName.AlertChannelMembership}.alertId`+ )+ .leftJoin(TableName.AlertChannel, (bd) => {+ void bd+ .on(`${TableName.AlertChannelMembership}.channelId`, `${TableName.AlertChannel}.id`)+ .andOn(`${TableName.AlertChannel}.channelType`, db.raw("?", [AlertChannelType.EMAIL]));+ })+ .leftJoin(TableName.AlertChannelRecipient, (bd) => {+ void bd+ .on(`${TableName.AlertChannel}.id`, `${TableName.AlertChannelRecipient}.channelId`)+ .andOn(`${TableName.AlertChannelRecipient}.principalType`, db.raw("?", [AlertPrincipalType.USER]));+ })+ // The CASE keeps the uuid cast off non-user principals and lets the join use the users primary key.+ .leftJoin(TableName.Users, (bd) => {+ void bd.on(+ `${TableName.Users}.id`,+ db.raw(+ `CASE WHEN "${TableName.AlertChannelRecipient}"."principalId" ~* '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$' THEN "${TableName.AlertChannelRecipient}"."principalId"::uuid END`+ )+ );+ }).where((qb) => {if (filters?.metadataFilter && filters.metadataFilter.length > 0) {filters.metadataFilter.forEach((meta) => {@@ -812,7 +843,7 @@ export const secretV2BridgeDALFactory = ({ db, keyStore }: TSecretV2DalArg) => {.select(db.ref("message").withSchema(TableName.Reminder).as("reminderNote")).select(db.ref("repeatDays").withSchema(TableName.Reminder).as("reminderRepeatDays")).select(db.ref("nextReminderDate").withSchema(TableName.Reminder).as("nextReminderDate"))- .select(db.ref("id").withSchema(TableName.ReminderRecipient).as("reminderRecipientId"))+ .select(db.ref("id").withSchema(TableName.AlertChannelRecipient).as("reminderRecipientId")).select(db.ref("username").withSchema(TableName.Users).as("reminderRecipientUsername")).select(db.ref("email").withSchema(TableName.Users).as("reminderRecipientEmail")).select(db.ref("id").withSchema(TableName.Users).as("reminderRecipientUserId"))diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-fns.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-fns.tsindex 2685d116d8..2810f3756a 100644--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-fns.ts+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-fns.ts@@ -1876,19 +1876,20 @@ export const fnSecretMove = async (dto: TFnSecretMove): Promise<TFnSecretMoveRes);// carry the source secrets' reminders over to the destination secrets so the schedule- // (message, repeatDays, nextReminderDate, fromDate, recipients) survives the move.+ // (message, repeatDays, nextReminderDate, fromDate) survives the move, and the reminder's alert+ // (who gets notified and how) follows it.const remindersToCreate = sourceReminders.map((rem) => {const key = rem.secretId ? sourceSecretIdToKey[rem.secretId] : undefined;const destinationSecretId = key ? destinationSecretIdByKey[key] : undefined;- if (!destinationSecretId) return null;+ if (!rem.secretId || !destinationSecretId) return null;return {+ sourceSecretId: rem.secretId,secretId: destinationSecretId,message: rem.message,repeatDays: rem.repeatDays,nextReminderDate: rem.nextReminderDate,fromDate: rem.fromDate,- recipients: rem.recipients,projectId};})@@ -1898,7 +1899,14 @@ export const fnSecretMove = async (dto: TFnSecretMove): Promise<TFnSecretMoveRes// we can delete the reminders in this case, because if it gets in this step,// it means that the move is a overwrite move or there is no existing reminder for the secret.await reminderDAL.delete({ $in: { secretId: remindersToCreate.map((r) => r.secretId) } }, tx);- await reminderService.batchCreateReminders(remindersToCreate, tx);+ await reminderService.batchCreateReminders(+ remindersToCreate.map(({ sourceSecretId, ...reminder }) => reminder),+ tx+ );+ await reminderService.moveReminderAlerts(+ remindersToCreate.map((r) => ({ fromSecretId: r.sourceSecretId, toSecretId: r.secretId })),+ tx+ );}isDestinationUpdated = true;diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.tsindex c9f62dc9d1..7ead2f99db 100644--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts@@ -183,7 +183,10 @@ type TSecretV2BridgeServiceFactoryDep = {| "hashGet"| "hashSet">;- reminderService: Pick<TReminderServiceFactory, "createReminder" | "getReminder" | "batchCreateReminders">;+ reminderService: Pick<+ TReminderServiceFactory,+ "createReminder" | "getReminder" | "batchCreateReminders" | "moveReminderAlerts"+ >;reminderDAL: Pick<TReminderDALFactory, "findSecretReminders" | "delete">;secretValidationRuleService: Pick<TSecretValidationRuleServiceFactory, "validateSecrets">;projectFolderGrantDAL: Pick<TProjectFolderGrantDALFactory, "find">;diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-types.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-types.tsindex 912b654661..6b24d58497 100644--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-types.ts+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-types.ts@@ -311,7 +311,7 @@ export type TFnSecretMove = {>;secretQueueService: Pick<TSecretQueueFactory, "syncSecrets">;reminderDAL: Pick<TReminderDALFactory, "findSecretReminders" | "delete">;- reminderService: Pick<TReminderServiceFactory, "batchCreateReminders">;+ reminderService: Pick<TReminderServiceFactory, "batchCreateReminders" | "moveReminderAlerts">;};export type TFnSecretMoveResult = {