Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
f33b902
new prompt for reply tracking
elie222 Oct 8, 2025
e40b503
add basis for fyi/actioned
elie222 Oct 8, 2025
a01a8bd
more tests
elie222 Oct 8, 2025
d00688e
add draft test and handle not found
elie222 Oct 8, 2025
d9ccd8f
move out function from action file
elie222 Oct 8, 2025
339c03c
clean up shared code between process history item webhooks
elie222 Oct 8, 2025
78a3ed3
clean up block unsubscribed
elie222 Oct 8, 2025
695014d
updated handling of conversations
elie222 Oct 9, 2025
31141cb
fixes
elie222 Oct 9, 2025
dfe433b
fixes
elie222 Oct 9, 2025
a2e75be
dont analyze if conversation id
elie222 Oct 9, 2025
e6f8062
Use shadcn switch
elie222 Oct 9, 2025
156d91a
show all rules in same table as before
elie222 Oct 9, 2025
eb656de
remove messy label ids for system fields
elie222 Oct 9, 2025
81c8385
wip: merge cold email blocker into main rules system
elie222 Oct 9, 2025
232901a
move cold email handling into run rules
elie222 Oct 9, 2025
9698468
fix ts
elie222 Oct 9, 2025
77331d1
wip migrate to unified config
elie222 Oct 9, 2025
57a2c65
more config cleanup
elie222 Oct 9, 2025
cb377db
more config clean up
elie222 Oct 9, 2025
8217dd6
config
elie222 Oct 9, 2025
fbddd47
code cleanup
elie222 Oct 10, 2025
a93273b
fix bugs
elie222 Oct 10, 2025
3ff0d32
more efficient labelling
elie222 Oct 10, 2025
938b463
use immutable microsoft ids
elie222 Oct 10, 2025
18d37d7
Add delete label to provider
elie222 Oct 10, 2025
7cda8a4
Delete created categories upon test completion
elie222 Oct 10, 2025
ee4394a
google label tests
elie222 Oct 10, 2025
fd770ae
move folder
elie222 Oct 10, 2025
d8772b5
delete old redis label code
elie222 Oct 10, 2025
796709a
throw error upon invalid rule config request
elie222 Oct 10, 2025
11bcedf
Fix invalid arg
elie222 Oct 10, 2025
12841c3
Fix bug
elie222 Oct 10, 2025
f74e58f
Clean up old reply tracker code for simpler format
elie222 Oct 10, 2025
16b0593
delete old code
elie222 Oct 10, 2025
26a16d4
Add migration script
elie222 Oct 10, 2025
c0a3729
fix mock types
elie222 Oct 10, 2025
3e0d138
default rule actions config
elie222 Oct 11, 2025
a9a095e
Don't allow editing of conversation status rules
elie222 Oct 12, 2025
ddfd599
Update migration files
elie222 Oct 12, 2025
c83d15a
minor fixes
elie222 Oct 12, 2025
8434a1c
remove a lot of extra code
elie222 Oct 12, 2025
738bc30
clean up code
elie222 Oct 12, 2025
7a143fc
remove special cold email blocker check
elie222 Oct 12, 2025
51efc41
fix tests
elie222 Oct 12, 2025
75153f0
clean up digest cold email logic
elie222 Oct 12, 2025
fcb6b4f
clean up
elie222 Oct 12, 2025
f8079fe
extract common webhook processing code
elie222 Oct 12, 2025
2d469fe
fix find folder outlook
elie222 Oct 12, 2025
154462a
Fix default run on threads
elie222 Oct 12, 2025
7785fce
outlook folder fixes
elie222 Oct 12, 2025
c13a2eb
fix build
elie222 Oct 12, 2025
afe5c45
fix build. delete extra code
elie222 Oct 12, 2025
636b86c
fix comments
elie222 Oct 12, 2025
18e59aa
fix build
elie222 Oct 12, 2025
7de7a5e
fix tests
elie222 Oct 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/web/__tests__/ai-choose-rule.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { describe, expect, test, vi } from "vitest";
import { aiChooseRule } from "@/utils/ai/choose-rule/ai-choose-rule";
import { ActionType } from "@prisma/client";
import { defaultReplyTrackerInstructions } from "@/utils/reply-tracker/consts";
import { getEmail, getEmailAccount, getRule } from "@/__tests__/helpers";

// pnpm test-ai ai-choose-rule
Expand Down Expand Up @@ -70,6 +69,7 @@ describe.runIf(isAiTest)("aiChooseRule", () => {
type: ActionType.REPLY,
ruleId: "ruleId",
label: null,
labelId: null,
subject: null,
content: "{{Write a joke}}",
to: null,
Expand Down Expand Up @@ -104,7 +104,7 @@ describe.runIf(isAiTest)("aiChooseRule", () => {
const legal = getRule(
"Match emails containing legal documents or contracts",
);
const requiresResponse = getRule(defaultReplyTrackerInstructions);
const requiresResponse = getRule("Match emails requiring a response");
const productUpdates = getRule(
"Match emails about product updates or feature announcements",
);
Expand Down
63 changes: 19 additions & 44 deletions apps/web/__tests__/ai-detect-recurring-pattern.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import { describe, expect, test, vi, beforeEach } from "vitest";
import { aiDetectRecurringPattern } from "@/utils/ai/choose-rule/ai-detect-recurring-pattern";
import type { EmailForLLM } from "@/utils/types";
import { RuleName } from "@/utils/rule/consts";
import { getRuleName, getRuleConfig } from "@/utils/rule/consts";
import { SystemType } from "@prisma/client";
import { getEmailAccount } from "@/__tests__/helpers";

// Run with: pnpm test-ai ai-detect-recurring-pattern
Expand Down Expand Up @@ -33,45 +34,18 @@ describe.runIf(isAiTest)(
});

function getRealisticRules() {
return [
{
name: "To Reply",
instructions: `Apply this to emails needing my direct response. Exclude:
- All automated notifications (LinkedIn, Facebook, GitHub, social media, marketing)
- System emails (order confirmations, calendar invites)

Only flag when someone:
- Asks me a direct question
- Requests information or action
- Needs my specific input
- Follows up on a conversation`,
},
{
name: RuleName.Newsletter,
instructions:
"Newsletters: Regular content from publications, blogs, or services I've subscribed to",
},
{
name: RuleName.Marketing,
instructions:
"Marketing: Promotional emails about products, services, sales, or offers",
},
{
name: RuleName.Calendar,
instructions:
"Calendar: Any email related to scheduling, meeting invites, or calendar notifications",
},
{
name: RuleName.Receipt,
instructions:
"Receipts: Purchase confirmations, payment receipts, transaction records or invoices",
},
{
name: RuleName.Notification,
instructions:
"Notifications: Alerts, status updates, or system messages",
},
];
return Object.values([
getRuleConfig(SystemType.TO_REPLY),
getRuleConfig(SystemType.AWAITING_REPLY),
getRuleConfig(SystemType.FYI),
getRuleConfig(SystemType.ACTIONED),
getRuleConfig(SystemType.MARKETING),
getRuleConfig(SystemType.NEWSLETTER),
getRuleConfig(SystemType.RECEIPT),
getRuleConfig(SystemType.CALENDAR),
getRuleConfig(SystemType.NOTIFICATION),
getRuleConfig(SystemType.COLD_EMAIL),
]);
}

function getNewsletterEmails(): EmailForLLM[] {
Expand Down Expand Up @@ -241,7 +215,7 @@ Only flag when someone:

console.debug("Newsletter pattern detection result:", result);

expect(result?.matchedRule).toBe(RuleName.Newsletter);
expect(result?.matchedRule).toBe(getRuleName(SystemType.NEWSLETTER));
expect(result?.explanation).toBeDefined();
});

Expand All @@ -254,7 +228,7 @@ Only flag when someone:

console.debug("Receipt pattern detection result:", result);

expect(result?.matchedRule).toBe(RuleName.Receipt);
expect(result?.matchedRule).toBe(getRuleName(SystemType.RECEIPT));
expect(result?.explanation).toBeDefined();
});

Expand All @@ -267,7 +241,7 @@ Only flag when someone:

console.debug("Calendar pattern detection result:", result);

expect(result?.matchedRule).toBe(RuleName.Calendar);
expect(result?.matchedRule).toBe(getRuleName(SystemType.CALENDAR));
expect(result?.explanation).toBeDefined();
});

Expand Down Expand Up @@ -306,7 +280,8 @@ Only flag when someone:
console.debug("Same sender different content result:", result);

expect(
result === null || result?.matchedRule === RuleName.Notification,
result === null ||
result?.matchedRule === getRuleName(SystemType.NOTIFICATION),
).toBeTruthy();
});
},
Expand Down
Loading
Loading