Skip to content

Migration open-box-deals#144

Open
KrishnaAgarwal7531 wants to merge 2 commits intotinyfish-io:mainfrom
KrishnaAgarwal7531:mig-openbox-deals
Open

Migration open-box-deals#144
KrishnaAgarwal7531 wants to merge 2 commits intotinyfish-io:mainfrom
KrishnaAgarwal7531:mig-openbox-deals

Conversation

@KrishnaAgarwal7531
Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 8, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f257b40d-f187-4447-aa70-97420460051e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@simantak-dabhade simantak-dabhade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Narrow the SiteConfig.proxyConfig.country_code field to the union ("US" | "GB" | ...).
  2. Import the proxy country type from the SDK if it's exported (check @tiny-fish/sdk types — there's likely a ProxyCountry or 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: delete src/app/layout.tsx, make it explicit this is a static-frontend recipe.
  • Move to a React frontend: delete public/index.html and build a proper page.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 in main use openbox-deals, let's match that.

✅ What's working well

  • /api/search/live/route.ts is solid — input validation with XSS sanitization (line 12), 5s heartbeats to keep SSE alive, parallel agents with Promise.allSettled, per-site browser profile + proxy config support, proper cleanup on cancel.
  • extractProducts + filterByPrice in lib/helpers.ts are 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.example clean.
  • No env leak.
  • No supabase, no Mino anywhere.

Once the proxy type is fixed and the README is renamed, local test pass + approve.

@simantak-dabhade
Copy link
Copy Markdown
Contributor

Quick follow-up on the build error — sharpening the recommended fix.

The cleanest fix is to use the SDK's own ProxyConfig type in src/lib/sites.ts. No type drift, no manual unions to keep in sync:

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. proxyConfig: { enabled: true, country_code: 'US' } already matches the union, so it type-checks as soon as the interface is tightened. Bonus: if someone later adds a non-supported country in sites.ts, the error shows up where the data is (clear and local) instead of deep inside api/search/live/route.ts.

ProxyConfig is re-exported from the SDK's root @tiny-fish/sdk index, so no need to reach into /dist/agent/types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants