Audit 104 - Recommendation / RecoSnapshot table status
Date: 2026-05-21
Severity: HIGH (resolved - non-blocking)
Finding
The Prisma schema contains Recommendation and RecoSnapshot tables. A data integrity
audit flagged these as empty and potentially breaking the recommendations feature.
Investigation
/recommendations page rendering path
File: src/app/recommendations/page.tsx
Import: getRecommendations from src/lib/recommendation-engine
The page calls getRecommendations({ mode: "general", limit: 60, lookbackDays }) via
unstable_cache wrappers. No reference to the Recommendation or RecoSnapshot tables
anywhere in the rendering path.
recommendation-engine.ts data source
File: src/lib/recommendation-engine.ts, function getBuyRecommendations (line 946+)
The engine queries Declaration directly via prisma.$queryRaw:
SELECT id FROM (
SELECT d.id,
COALESCE(d."signalScoreV13", d."signalScore") AS rank_score,
ROW_NUMBER() OVER (
PARTITION BY COALESCE(SUBSTRING(d."amfId" FROM '^([A-Z]+):'), 'AMF')
ORDER BY COALESCE(d."signalScoreV13", d."signalScore") DESC, d."pubDate" DESC
) AS rn
FROM "Declaration" d
WHERE d."pubDate" >= ${cutoff}
AND d."pdfParsed" = true
AND d."signalScore" IS NOT NULL
AND d."signalScore" >= 15
...
) ranked
Ranking key: COALESCE(d."signalScoreV13", d."signalScore") - uses V13/V14e score
where available, falls back to V12 legacy score.
RecoSnapshot and OOS section
RecoSnapshot is consumed by computeOOSMetrics() in src/lib/oos-tracker.ts for the
/performance OOS section. If the table is empty, the static STRATEGY_PROOF fallback
is used (the liveOosUniverse and oosResults constants). This path is non-breaking.
Verdict
NON-BLOCKING. The Recommendation table is legacy and not used by any production
rendering path. The RecoSnapshot table being empty causes a graceful static fallback
on /performance, not an error. The /recommendations page renders from Declaration
rows via getRecommendations() and is fully operational.
Action taken
No code change required. This audit doc serves as the definitive record that the
empty Recommendation and RecoSnapshot tables do not affect production rendering.