Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

include maxResults and depth in search target tracking signature

Developers Digestcaa8a03584e9
diff --git a/apps/api/src/lib/tracking.test.ts b/apps/api/src/lib/tracking.test.ts
index a4b2109e7..dfa173bca 100644
--- a/apps/api/src/lib/tracking.test.ts
+++ b/apps/api/src/lib/tracking.test.ts
@@ -29,6 +29,17 @@ const crawlTarget: MonitorTarget = {
scrapeOptions: {},
};
+const searchTarget: MonitorTarget = {
+ id: "target-search",
+ type: "search",
+ queries: ["firecrawl launch"],
+ searchWindow: "24h",
+ alertMode: "first_match",
+ depth: "deep",
+ maxResults: 10,
+ scrapeOptions: {},
+};
+
describe("monitor target interest tracking", () => {
beforeEach(() => {
jest.clearAllMocks();
@@ -89,6 +100,26 @@ describe("monitor target interest tracking", () => {
expect(rows[1].target_signature).not.toBe(rows[0].target_signature);
});
+ it("search target signatures distinguish maxResults and depth", () => {
+ const signatureFor = (target: MonitorTarget) =>
+ buildMonitorTargetInterestRows({
+ eventType: "configured",
+ teamId: "team-1",
+ monitorId: "monitor-1",
+ monitorStatus: "active",
+ scheduleCron: "0 * * * *",
+ scheduleTimezone: "UTC",
+ intervalMs: 60 * 60 * 1000,
+ targets: [target],
+ zeroDataRetention: false,
+ })[0].target_signature;
+
+ const base = signatureFor(searchTarget);
+ expect(signatureFor({ ...searchTarget })).toBe(base);
+ expect(signatureFor({ ...searchTarget, maxResults: 25 })).not.toBe(base);
+ expect(signatureFor({ ...searchTarget, depth: "standard" })).not.toBe(base);
+ });
+
it("sends rows to the monitor target ClickHouse table", async () => {
await trackMonitorTargetInterest({
eventType: "check_started",
diff --git a/apps/api/src/lib/tracking.ts b/apps/api/src/lib/tracking.ts
index 0fd13ee78..eaf61d31c 100644
--- a/apps/api/src/lib/tracking.ts
+++ b/apps/api/src/lib/tracking.ts
@@ -136,6 +136,8 @@ function monitorTargetSignature(target: MonitorTarget): string {
queries: [...target.queries].sort(),
searchWindow: target.searchWindow,
alertMode: target.alertMode,
+ maxResults: target.maxResults,
+ depth: target.depth ?? null,
});
}