Migration open-box-deals#144
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
This is a bigger scope than a typical "migration" — the recipe on main was a Python FastAPI app (app/main.py), this PR is a full rewrite to Next.js. Overall the rewrite is thoughtful: input validation, SSE heartbeats, idiomatic SDK usage, minimal deps. Two blockers and a few notes.
🔴 Build fails — type error in src/lib/sites.ts
Types of property 'country_code' are incompatible.
Type 'string | undefined' is not assignable to type '"US" | "GB" | "CA" | "DE" | "FR" | "JP" | "AU" | undefined'.
proxyConfig.country_code in src/lib/sites.ts is typed as string, but @tiny-fish/sdk's agent.stream expects a specific union. Two fixes:
- Narrow the
SiteConfig.proxyConfig.country_codefield to the union ("US" | "GB" | ...). - Import the proxy country type from the SDK if it's exported (check
@tiny-fish/sdktypes — there's likely aProxyCountryor similar).
🔴 Readme.md should be README.md
All other cookbook recipes use README.md. GitHub finds both, but consistency matters and some tools don't. Rename.
🟡 Architecture note (not blocking)
src/app/page.tsx contains only redirect('/index.html') — the actual frontend is the 38KB vanilla-JS public/index.html. Next.js is effectively acting as a static-file host + API routes.
That works, and for a recipe that's primarily about showcasing the Agent API it's arguably cleaner than a React component tree. But it means src/app/layout.tsx is never rendered (since page.tsx redirects before it renders anything), so you can delete layout.tsx or the redirect depending on which pattern you want to keep:
- Keep
public/index.html+ redirect: deletesrc/app/layout.tsx, make it explicit this is a static-frontend recipe. - Move to a React frontend: delete
public/index.htmland build a properpage.tsx.
Either is fine — just don't leave both half-wired.
🟡 Nits (not blocking)
- PR body is empty.
- Next 15.3.3 — out of scope, repo-wide sweep will handle.
- PR title is "Migration open-box-deals" but the folder is
openbox-deals. Either fix the title or rename the folder — folders inmainuseopenbox-deals, let's match that.
✅ What's working well
/api/search/live/route.tsis solid — input validation with XSS sanitization (line 12), 5s heartbeats to keep SSE alive, parallel agents withPromise.allSettled, per-site browser profile + proxy config support, proper cleanup on cancel.extractProducts+filterByPriceinlib/helpers.tsare small and composable.- Adding a new retailer is a two-line change in
src/lib/sites.ts— exactly the kind of cookbook ergonomics we want. .env.exampleclean.- No env leak.
- No supabase, no Mino anywhere.
Once the proxy type is fixed and the README is renamed, local test pass + approve.
|
Quick follow-up on the build error — sharpening the recommended fix. The cleanest fix is to use the SDK's own import type { ProxyConfig } from '@tiny-fish/sdk';
export interface SiteConfig {
name: string;
searchUrl: string;
goal: string;
browserProfile?: 'lite' | 'stealth';
proxyConfig?: ProxyConfig;
}That's a one-line change.
|
No description provided.