fix(sase): catalog-coverage Prisma make_interval(bigint) error
Prisma serialized windowDays as bigint -> make_interval(days => bigint) does not exist (42883), so detectCatalogCoverageGaps threw on every real call: the evening brief silently dropped its Sase-DB half and catalog-gap-detect never created insights. Use a JS Date param (matches the rest of the codebase). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,7 @@ export async function detectCatalogCoverageGaps(
|
||||
): Promise<CatalogGap[]> {
|
||||
const windowDays = opts.windowDays ?? 7;
|
||||
const minFailures = opts.minFailures ?? 3;
|
||||
const since = new Date(Date.now() - windowDays * 864e5);
|
||||
|
||||
// Brand is the first token of the identified label; initcap() folds HONDA/Honda
|
||||
// into one group. array_agg collects the distinct "<Brand> <Year>" identities so
|
||||
@@ -42,7 +43,7 @@ export async function detectCatalogCoverageGaps(
|
||||
trim(substring(error_message FROM 'identified as (.*)$')) AS label
|
||||
FROM query_logs
|
||||
WHERE success = false
|
||||
AND created_at > now() - make_interval(days => ${windowDays})
|
||||
AND created_at > ${since}
|
||||
AND error_message LIKE 'No catalog%'
|
||||
)
|
||||
SELECT
|
||||
|
||||
Reference in New Issue
Block a user