Roll up self-healing data collection stack#63
Closed
giaphutran12 wants to merge 41 commits into
Closed
Conversation
Introduces the "Clear & Populate" flow: an AI agent (Claude Sonnet 4.6 via OpenRouter) searches the web using TinyFish APIs, fetches page content, and inserts real data into datasets row by row. Backend: - Mastra populate workflow (clear rows → build prompt → run agent) - Populate agent with 7 tools: 5 database CRUD (insert, list, get, update, delete) + 2 web (search_web via TinyFish Search API, fetch_page via TinyFish Fetch API) - All tools return structured errors so the agent can self-correct - Data keys are sanitized to strip stray quotes/backticks from LLM output - Fetch responses capped at 15K chars to protect agent context window - Convex client uses anyApi to avoid cross-project imports in Docker - POST /populate route with Clerk JWT auth Frontend: - "Clear & Populate" button on dataset detail page - API client function in lib/backend.ts - Rows appear in realtime via Convex reactive queries Convex: - New internal functions: datasetRows.get (query) and datasetRows.remove (mutation) for single-row read/delete Infra: - TINYFISH_API_KEY wired through docker-compose.dev.yml to backend and mastra services Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Enforce dataset ownership on POST /populate by querying Convex for the dataset and comparing ownerId to req.auth.userId before running the workflow (fixes authz gap) - Remove raw row payloads from insert_row/update_row logs, log column count instead to avoid PII leakage - Add 30s AbortController timeouts to both TinyFish fetch calls in web-tools.ts so they can't hang indefinitely - Align PopulateResult type (rows → result) to match actual backend response shape Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convex query for dataset lookup can throw on invalid IDs — wrapping it in the existing try/catch ensures controlled 400 responses instead of unhandled 500s. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization 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 |
This was referenced May 23, 2026
Collaborator
Author
|
Closing stale draft cleanup PR; superseded by later BigSet work. |
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
mainorigin/maininto the rollup branch so reviewers do not have to walk the 30+ stacked PR chainReview protocol
This is an integration rollup/audit anchor, not a normal line-by-line PR. It is intentionally large. Review it by invariants:
/populatemust go through the self-healing runner, not the old clear-then-agent pathWhat is included
Evidence
Local verification:
npm --prefix backend testnpm --prefix backend run buildgit diff --checkmake verify-self-healingGitHub checks currently cover secret/vulnerability/review automation only; they do not replace the local backend gates above.
Restack simulation
Disposable worktree
/private/tmp/bigset-restack-sim-20260523-0912replayed child commits on top of this PR head:d818ba38b8785e07f7ec983717502645aa1f7171(#64)5154b4858b1b6356c766818c09b8e6da55bb587e(#65)Replay was conflict-free. Verification on the simulated final stack:
npm --prefix backend run build: passgit diff --check: passmake verify-self-healing: pass, including backend tests 94/94Notes
mainconflicts by keeping the self-healing/populatepath and not restoring the old destructive clear-then-agent workflow as the HTTP populate path.browser_actions/agent_browser_actions, then a compiler can turn those into replayable Playwright.origin/mainbefore merging them.