Skip to content

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

fix(api/search-feedback): consider zdr

mogeryc938d29e0b10
diff --git a/apps/api/src/controllers/v2/search-feedback.ts b/apps/api/src/controllers/v2/search-feedback.ts
index 48e8b752d..c18c51cae 100644
--- a/apps/api/src/controllers/v2/search-feedback.ts
+++ b/apps/api/src/controllers/v2/search-feedback.ts
@@ -11,6 +11,7 @@ import { and, eq, gte } from "drizzle-orm";
import { db, dbRr } from "../../db/connection";
import * as schema from "../../db/schema";
import { captureExceptionWithZdrCheck } from "../../services/sentry";
+import { getScrapeZDR, getSearchZDR } from "../../lib/zdr-helpers";
import {
RequestWithAuth,
SearchFeedbackErrorCode,
@@ -155,6 +156,25 @@ export async function searchFeedbackController(
throw error;
}
+ // ZDR teams must not have any feedback persisted. Short-circuit with a
+ // success-shaped response so clients behave normally, but record nothing
+ // and refund nothing.
+ const searchZDR = getSearchZDR(req.acuc?.flags);
+ const isZDR =
+ getScrapeZDR(req.acuc?.flags) !== "disabled" ||
+ searchZDR === "allowed" ||
+ searchZDR === "forced-zdr" ||
+ searchZDR === "forced-anon";
+ if (isZDR) {
+ return res.status(200).json({
+ success: true,
+ feedbackId: "00000000-0000-0000-0000-000000000000",
+ creditsRefunded: 0,
+ creditsRefundedToday: 0,
+ dailyRefundCap: config.SEARCH_FEEDBACK_DAILY_CAP_CREDITS,
+ });
+ }
+
if (config.USE_DB_AUTHENTICATION !== true) {
return fail(res, {
status: 503,