Migration viet-bike-scout to Tinyfish SDK #136
Migration viet-bike-scout to Tinyfish SDK #136KrishnaAgarwal7531 wants to merge 4 commits intotinyfish-io:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
simantak-dabhade
left a comment
There was a problem hiding this comment.
Review: changes requested (close to approval — docs-only fixes)
Best code-side migration in this batch. Build passes cleanly, tests-less-but-legit, and /api/search/route.ts is now the gold-standard SDK reference in the cookbook:
- Typed
EventType.STREAMING_URL/EventType.COMPLETE,RunStatus.COMPLETEDcheck client.agent.stream(...)withfor await- Parallel execution via
Promise.allSettled - Per-request client, explicit env check via
getEnv()with a helpful 500 if the key is missing - Guards for both string and object
event.result maxDuration = 800for long-running scrapes
Stack is also already on the target: Next 16.1.6, React 19.2.3, Tailwind 4 — matches what the repo-wide sweep is heading toward. Only 5 UI components, all actually used (no shadcn dump). Custom components are domain-named (bike-card, shop-group, etc.). Supabase, Redis, Mino — all gone from runtime.
The only things blocking approval are stale docs.
🔴 README still documents the old Supabase cache setup
- Line 50 (Tech Stack table):
| Caching | Supabase (Postgres) | 6-hour TTL, graceful degradation if unavailable |— delete the row (or replace with a note that it's in-memory per request). - Lines 69-70 (Environment Variables):
Delete these.
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url SUPABASE_SERVICE_ROLE_KEY=your_service_role_key.env.exampleonly hasTINYFISH_API_KEY. - Line 115: "Results are cached in Supabase with a 6-hour TTL, keyed by
(city, website). The cache toggle on the UI lets you choose between instant cached results and a fresh live scrape..." — entire paragraph describes gone functionality, should be rewritten or removed.
🔴 docs/ folder still describes the old architecture
Both docs describe a system that no longer exists. A future contributor reading these would be misled.
docs/use-case-brief.md(336 lines):- Line 78, 87: architecture diagrams showing
Supabase (6h TTL)nodes - Line 240:
const TINYFISH_SSE_URL = "https://agent.tinyfish.ai/v1/automation/run-sse";— shows the old raw-HTTP pattern that the migration replaced - Lines 283, 291: "Optionally stream cached results instantly from Supabase" / "On COMPLETED: caches result to Supabase"
- Line 319, 325-326: Tech stack bullets calling out Supabase caching + raw SSE URL
- Line 78, 87: architecture diagrams showing
docs/PRD.md(171 lines):- Line 9: "Cache Check: The API route checks Supabase for cached results (6-hour TTL)..." — that flow no longer exists
- Line 25: Same raw
TINYFISH_SSE_URLreference
Either update both docs to match reality, or delete them and rely on a trimmed README. A design doc that misdescribes the system is worse than no design doc.
🟡 Nits (not blocking)
src/components/ui/switch.tsx:2imports from@radix-ui/react-switch, butsrc/components/ui/button.tsx:2imports from theradix-uimeta-package. Build works via transitive resolution, but the style is inconsistent — pick one. Sincepackage.jsondeclaresradix-ui(meta), prefer that everywhere.api/search/route.ts:111tags every resultsource: "live"— leftover literal from the live/cached toggle era. Drop the field, or make it meaningful.- PR body empty — add a short description of what was migrated + testing notes.
✅ Summary
Code is approval-worthy. Please:
- Scrub README Supabase references (lines 50, 69-70, 115).
- Update or delete
docs/use-case-brief.md+docs/PRD.md. - Nits optional.
Once docs match reality, I'll run the local test pass and approve.
Migrates Viet Bike Scout from raw TinyFish HTTP calls to the official SDK and removes the Supabase caching layer that was added in the original build. The app now runs entirely in-memory — one API key, no external services to provision.
The app finds motorbike rental prices across Vietnam by firing parallel browser agents at 5–6 rental shop websites simultaneously per city, streaming results back as each shop completes. TinyFish handles cookie banners, dynamic loading, and VND→USD conversion automatically.