Skip to content

Commit bce3de6

Browse files
Merge pull request firecrawl#3624 from firecrawl/jonathan/monitoring-update-model
feat(monitoring): Add meaningfulChange to monitoring judgments
2 parents 4b90751 + 3912ab6 commit bce3de6

9 files changed

Lines changed: 136 additions & 68 deletions

File tree

apps/api/src/services/monitoring/diff-orchestrator.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ type Judgment = {
2020
meaningful: boolean;
2121
confidence: "high" | "medium" | "low";
2222
reason: string;
23-
fields: string[];
23+
meaningfulChanges: Array<{
24+
type: "added" | "removed" | "changed";
25+
before: string | null;
26+
after: string | null;
27+
reason: string;
28+
}>;
2429
};
2530

2631
type MonitorPageDiffResult = {

apps/api/src/services/monitoring/judgeChange.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe("judgeChange — input validation (no LLM call)", () => {
1414
});
1515
expect(result.meaningful).toBe(true);
1616
expect(result.confidence).toBe("low");
17-
expect(result.fields).toEqual([]);
17+
expect(result.meaningfulChanges).toEqual([]);
1818
});
1919
});
2020

apps/api/src/services/monitoring/judgeChange.ts

Lines changed: 91 additions & 60 deletions
Large diffs are not rendered by default.

apps/api/src/services/monitoring/meaningful-monitoring.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ const FAKE_JUDGMENT = {
2424
meaningful: true as const,
2525
confidence: "high" as const,
2626
reason: "test",
27-
fields: [],
27+
meaningfulChanges: [
28+
{
29+
type: "changed" as const,
30+
before: "old test",
31+
after: "new test",
32+
reason: "The tracked value changed.",
33+
},
34+
],
2835
};
2936

3037
const FRESH_PAGE = {

apps/api/src/services/monitoring/results.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ interface PageJudgment {
3131
meaningful: boolean;
3232
confidence: "high" | "medium" | "low";
3333
reason: string;
34-
fields: string[];
34+
meaningfulChanges: Array<{
35+
type: "added" | "removed" | "changed";
36+
before: string | null;
37+
after: string | null;
38+
reason: string;
39+
}>;
3540
}
3641

3742
async function sendMonitorPageWebhook(params: {

apps/api/src/services/monitoring/types.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,12 @@ export type MonitorCheckPageInsert = {
280280
meaningful: boolean;
281281
confidence: "high" | "medium" | "low";
282282
reason: string;
283-
fields: string[];
283+
meaningfulChanges: Array<{
284+
type: "added" | "removed" | "changed";
285+
before: string | null;
286+
after: string | null;
287+
reason: string;
288+
}>;
284289
} | null;
285290
};
286291

apps/api/src/services/notification/monitoring_email.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@ type MonitoringEmailPage = {
1515
meaningful: boolean;
1616
confidence: "high" | "medium" | "low";
1717
reason: string;
18-
fields: string[];
18+
meaningfulChanges?: Array<{
19+
type: "added" | "removed" | "changed";
20+
before: string | null;
21+
after: string | null;
22+
reason: string;
23+
}>;
1924
} | null;
2025
diffText?: string | null;
2126
};

apps/api/src/services/webhook/types.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,12 @@ interface MonitorPageJudgment {
123123
meaningful: boolean;
124124
confidence: "high" | "medium" | "low";
125125
reason: string;
126-
fields: string[];
126+
meaningfulChanges: Array<{
127+
type: "added" | "removed" | "changed";
128+
before: string | null;
129+
after: string | null;
130+
reason: string;
131+
}>;
127132
}
128133

129134
interface MonitorPageDiff {

apps/js-sdk/firecrawl/src/v2/types.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,12 @@ export interface MonitorPageJudgment {
744744
meaningful: boolean;
745745
confidence: "high" | "medium" | "low";
746746
reason: string;
747-
fields: string[];
747+
meaningfulChanges: Array<{
748+
type: "added" | "removed" | "changed";
749+
before: string | null;
750+
after: string | null;
751+
reason: string;
752+
}>;
748753
}
749754

750755
export interface MonitorCheck {

0 commit comments

Comments
 (0)