Repository navigation
fix(tracking): accept the new string-array Perplexity search_model_queries shape - #525
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cloro's 2026-07-23 update changed the Perplexity
search_model_queriesfield from[{ query, engine, limit }]objects to a plainstring[](matching how other providers expose fan-out). Our normalizer only handled the object shape —typeof q?.query === 'string'is false for a string entry — so every entry was silently filtered out and Perplexity results have been stored with an empty fan-out since the change shipped.Verified against production data and live API calls:
prompt_results(perplexity-web): ~99% of results had fan-out through Jul 22; 0 of 426 on Jul 23.search_model_queriesas an array of strings; the current normalizer kept 0 entries from each.Fix:
normalizeSearchQueriesnow accepts both entry shapes — plain strings (new) map to{ query, source_platform }, and legacy{ query, engine }objects keep theirenginelabel — so historical replays and a potential upstream revert both keep working. Stored row shape is unchanged;enginewas already optional downstream, it's just absent on new rows.No backfill is possible for Jul 23 rows (we don't store the raw response), but the window is a single day.
Related issue
—
Type of change
fix— Bug fixfeat— New featurechore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
cd server && yarn vitest run src/lib/cloro-scraper.test.js— 22 tests pass, including the new plain-string shape case.prompt_results.search_queriesshould be non-empty again and the Query Fan-out card on the prompt detail page should populate for new runs.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromserver/)yarn typecheckpasses (web unchanged)yarn format:checkpasses (run fromserver/)