♻️ refactor(recent): rewrite queryRecent in Drizzle, exclude web-tool scrapes#14239
Merged
Conversation
… scrapes
- Replace raw SQL UNION with Drizzle's typed unionAll (topicArm/documentArm/taskArm)
- Hoist filter lists into named constants (SYSTEM_TOPIC_TRIGGERS,
TOOL_DOCUMENT_SOURCE_TYPES, TASK_FINAL_STATUSES) for readability
- Recent now excludes documents whose sourceType is in ('file', 'web') so
web-browsing tool scrapes stop leaking in alongside file uploads
- Add RecentModel test coverage
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## canary #14239 +/- ##
==========================================
+ Coverage 68.09% 68.10% +0.01%
==========================================
Files 2267 2268 +1
Lines 194367 194459 +92
Branches 19563 24297 +4734
==========================================
+ Hits 132353 132443 +90
- Misses 61884 61886 +2
Partials 130 130
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…Array Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
sxueck
pushed a commit
to sxueck/lobehub
that referenced
this pull request
Apr 28, 2026
… scrapes (lobehub#14239) * ♻️ refactor(recent): rewrite queryRecent in Drizzle, exclude web-tool scrapes - Replace raw SQL UNION with Drizzle's typed unionAll (topicArm/documentArm/taskArm) - Hoist filter lists into named constants (SYSTEM_TOPIC_TRIGGERS, TOOL_DOCUMENT_SOURCE_TYPES, TASK_FINAL_STATUSES) for readability - Recent now excludes documents whose sourceType is in ('file', 'web') so web-browsing tool scrapes stop leaking in alongside file uploads - Add RecentModel test coverage * 🐛 fix(recent): widen TOOL_DOCUMENT_SOURCE_TYPES to const tuple for inArray Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
mutoe
pushed a commit
to mutoe/lobehub
that referenced
this pull request
May 1, 2026
… scrapes (lobehub#14239) * ♻️ refactor(recent): rewrite queryRecent in Drizzle, exclude web-tool scrapes - Replace raw SQL UNION with Drizzle's typed unionAll (topicArm/documentArm/taskArm) - Hoist filter lists into named constants (SYSTEM_TOPIC_TRIGGERS, TOOL_DOCUMENT_SOURCE_TYPES, TASK_FINAL_STATUSES) for readability - Recent now excludes documents whose sourceType is in ('file', 'web') so web-browsing tool scrapes stop leaking in alongside file uploads - Add RecentModel test coverage * 🐛 fix(recent): widen TOOL_DOCUMENT_SOURCE_TYPES to const tuple for inArray Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
💻 Change Type
🔀 Description of Change
Rewrites
RecentModel.queryRecentand tightens its filters.unionAll(topicArm/documentArm/taskArm), so the query is type-checked end-to-end and the result mapping no longer goes throughdb.execute().rows.SYSTEM_TOPIC_TRIGGERS,TOOL_DOCUMENT_SOURCE_TYPES,TASK_FINAL_STATUSES) to make the intent self-documenting at the call sites.sourceTypeis in('file', 'web'). Previously only'file'was excluded, so web-browsing tool scrapes (sourceType = 'web') were leaking into the Recent list. Only user-authored pages ('api') and legacy'topic'rows now surface.RecentModeltest suite covering topic/document/task arms, the new exclusion, system-trigger filtering, and ordering/limit.No schema changes. Output shape unchanged.
🧪 How to Test
Manual check: in a workspace with web-tool browsing history, the Recent list should no longer include scraped web pages — only your own pages, topics, and active tasks.