Skip to content

Commit a79537b

Browse files
author
Shaw
committed
fix(app-lifeops): preserve routine escalation defaults
1 parent 77ad6a4 commit a79537b

2 files changed

Lines changed: 16 additions & 11 deletions

File tree

apps/app-lifeops/src/lifeops/service-helpers-reminder.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -432,14 +432,19 @@ export function readReminderEscalationProfile(
432432
};
433433
}
434434

435+
type ReminderDefinitionDescriptor = Pick<LifeOpsTaskDefinition, "metadata"> & {
436+
kind: string;
437+
};
438+
435439
export function definitionTriggersEnforcement(
436-
definition:
437-
| Pick<LifeOpsTaskDefinition, "kind" | "metadata">
438-
| null
439-
| undefined,
440+
definition: ReminderDefinitionDescriptor | null | undefined,
440441
): boolean {
441442
if (!definition) return false;
442-
if (definition.kind === "routine") {
443+
if (
444+
definition.kind === "routine" ||
445+
definition.kind === "morning_routine" ||
446+
definition.kind === "night_routine"
447+
) {
443448
return true;
444449
}
445450
return definition.metadata?.enforceRoutineWindow === true;
@@ -448,10 +453,7 @@ export function definitionTriggersEnforcement(
448453
export function buildReminderEnforcementState(
449454
now: Date,
450455
timezone: string,
451-
definition:
452-
| Pick<LifeOpsTaskDefinition, "kind" | "metadata">
453-
| null
454-
| undefined,
456+
definition: ReminderDefinitionDescriptor | null | undefined,
455457
channelAvailability: Partial<Record<LifeOpsReminderChannel, boolean>> = {},
456458
windows?: EnforcementWindow[],
457459
): ReminderEnforcementState {

apps/app-lifeops/test/service-helpers-reminder.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,11 +480,14 @@ describe("resolveContactRouteCandidates", () => {
480480
});
481481

482482
describe("reminder escalation profiles", () => {
483-
it("keeps the former routine voice behavior as typed default policy", () => {
483+
it.each([
484+
"morning_routine",
485+
"routine",
486+
])("keeps the former routine voice behavior for %s as typed default policy", (kind) => {
484487
const state = buildReminderEnforcementState(
485488
new Date("2026-04-29T06:21:00.000Z"),
486489
"UTC",
487-
{ kind: "routine", metadata: {} },
490+
{ kind, metadata: {} },
488491
{ voice: true },
489492
);
490493

0 commit comments

Comments
 (0)