feat(tweet): add tweet search with /search page and BFF route - #19
Merged
Merged
Conversation
- feature plan: docs/features/tweet/search.md (interface + 5-phase plan) - backlog: 阶段二 add search task (in progress, feat/tweet-search) - AC-tweet.md v1.1: AC-TWEET-009 offline parse regression, AC-TWEET-010 integration endpoint returns EnrichedTweet[] (same shape as /api/tweet/get) - dev log 2026-08-31: search integration kickoff
- /api/tweet/search returns { tweets, nextCursor } (shape aligned with
/api/tweet/replies; tweet elements same as /api/tweet/get)
- AC-TWEET-010 updated: assert paginated payload shape
TWEET_SEARCH was missing from AllowGuestAuthenticationGroup, so key-less pool instances threw RESOURCE_NOT_ALLOWED before the request was even sent. Search now works for guest attempts (and stays key-based via TWEET_KEYS).
…Tweets)
- parseSearchTimeline: pure function over SearchTimeline instructions,
keeps tweet- entries, drops cursors, unwraps TweetWithVisibilityResults
- fetchSearchTweets: pooled TWEET_SEARCH request; query passes through as
rawQuery verbatim, so X advanced syntax (from:/until:/min_faves:/...) works
- returns { tweets, nextCursor } for cursor pagination
- searchTweetSchema: q (1..500) / type top|latest / cursor / count (1..50)
- loader aggregates fetchSearchTweets + enrichTweet, returns
{ tweets, nextCursor }; 400 on invalid params, structured 5xx on upstream
- register route under api/tweet prefix
- search form (controlled input) + 热门/最新 toggle + 高级搜索 panel with operator chips (from:/to:/#/min_faves:/min_retweets:/since:/until:/lang:/-) - results rendered with MyTweet single-tweet pattern, deduped, load-more paginated via nextCursor - friendlier empty/error states (no misleading tweet-not-found) - footer More adds internal 推文搜索 link to /search
- fixture test/fixtures/search/search-tweets.json (2 tweets + ad + cursors) - unit: parseSearchTimeline (extraction/order/cursor/robustness/visibility unwrap) + TweetFilter advanced-syntax verbatim passthrough - unit: /api/tweet/search loader (400 on missing q, arg passthrough, upstream error) - acceptance AC-TWEET-009 offline fixture regression - integration AC-TWEET-010 endpoint shape (skipIf no keys/server) + api-client tweet.search
- feature doc: all phases done + iteration notes (advanced syntax passthrough, quick-input panel, visibility unwrap, empty-state fix) - dev log 2026-08-31: implementation details + gate results - backlog: mark search task complete
- InputGroup (magnifier addon + input + inline-end submit) replaces raw Field/Input composition - ToggleGroup for 热门/最新 instead of hand-rolled outlined Buttons - Collapsible panel for advanced operators; chips use Button size-xs - Empty/EmptyHeader/EmptyMedia/EmptyTitle/EmptyDescription for empty and error states instead of bare text divs - footer search icon size-3.5 per icon spec - conforms to docs/ui-design/GENERAL.md + README.md (no raw <button>, no hardcoded colors, dark-mode tokens, cursor/focus handled by coss)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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
打通 Twitter/X 推文搜索链路(方案:
docs/features/tweet/search.md):TWEET_SEARCH补入AllowGuestAuthenticationGroup(此前 guest 池直接抛RESOURCE_NOT_ALLOWED)parseSearchTimeline纯函数 +fetchSearchTweets(池化TWEET_SEARCH);q原样透传 rawQuery → X 高级搜索语法可用(from:/until:/min_faves:等),自动解包TweetWithVisibilityResultsGET /api/tweet/search?q=&type=&cursor=&count=→{ tweets: EnrichedTweet[], nextCursor }(分页形态同/api/tweet/replies,元素格式同/api/tweet/get)/search页面(InputGroup 搜索框 + 热门/最新 ToggleGroup + 高级搜索快捷插入面板 + cursor 加载更多)+ footer「推文搜索」内链;按docs/ui-design/GENERAL.md/README.md规范实现Verification
bun run typecheck通过bun run lint0 errorbun run test294/294 通过bun run verify/index.ts --exit-on-fail301 passed + 5 skipped(需 TWEET_KEYS/INS_COOKIES 的集成项)bun run build通过Notes
TWEET_KEYS的 guest 模式下可能受限(X 对未登录搜索有限流),页面已区分「无结果」与「搜索失败」两种状态feat/tweet-search(10 个原子提交)