Skip to content

feat(tinybird): validate integration against API, add job-status polling#5474

Merged
waleedlatif1 merged 2 commits into
stagingfrom
tinybird-validate-integration
Jul 7, 2026
Merged

feat(tinybird): validate integration against API, add job-status polling#5474
waleedlatif1 merged 2 commits into
stagingfrom
tinybird-validate-integration

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Validated all 6 existing Tinybird tools against Tinybird's live REST API docs (Events, Query, Pipes, Data Sources) — every endpoint, param, and response shape checked out, no bugs found
  • Added tinybird_get_job tool + block operation to poll async job status (Append and Delete Data Source Rows return a job_id/job_url with no way to check on it — this closes that gap)
  • Scoped block outputs with condition per operation so each operation only surfaces the fields it actually returns

Type of Change

  • New feature / improvement

Testing

Tested manually. bun run type-check, bun run lint:check, bun run check:api-validation, and blocks/blocks.test.ts + tools/index.test.ts all pass.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…ing, scope block outputs

- Validated all 6 existing tools against Tinybird's live REST API docs
- Added tinybird_get_job tool to poll async import/delete jobs
- Scoped block outputs with per-operation condition
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 7, 2026 3:37pm

Request Review

@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Additive integration feature and UI metadata changes; no changes to auth, billing, or core execution paths.

Overview
Adds Get Job Status so workflows can poll Tinybird async jobs (append/delete) via a new tinybird_get_job tool (GET /v0/jobs/{job_id}), wired through the Tinybird block with a required Job ID field and dedicated outputs (kind, timestamps, is_cancellable, error, etc.).

The Tinybird block outputs are now gated with condition per operation so only fields relevant to the selected operation appear (query vs events vs datasource vs job polling). Docs/skills are updated with a poll-job-status skill and a note to poll after append/delete.

Minor copy fixes align API token scope hints with Tinybird naming (DATASOURCES:*, PIPES:READ).

Reviewed by Cursor Bugbot for commit c7c5463. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a tinybird_get_job tool to poll the status of asynchronous Tinybird jobs (append/delete), and scopes existing block output fields with per-operation condition guards to reduce noise in the UI.

  • New get_job tool (tools/tinybird/get_job.ts, types.ts, index.ts, registry.ts): implements GET /v0/jobs/{job_id}, extracts and returns key job fields alongside the full raw response as job.
  • Block output conditions (blocks/tinybird.ts): all outputs now carry condition predicates so only the fields relevant to the selected operation are surfaced; new Get Job Status operation and matching inputs/outputs are wired in.
  • Description fixes (events.ts, query.ts, query_pipe.ts, append_datasource.ts): corrects API scope names (PIPE:READPIPES:READ, DATASOURCE:APPENDDATASOURCES:APPEND).

Confidence Score: 5/5

Safe to merge — the new tool follows existing patterns faithfully, all fields are properly nullable, and the description fixes are low-risk corrections to user-facing text.

The new tinybird_get_job tool mirrors the structure of the existing append and delete tools: same URL-encoding, same auth header pattern, same errorExtractor, same nullable output mapping. The block wiring adds a new operation and scopes outputs with conditions that only hide/show fields per operation — no existing behavior is altered. The scope-name description fixes in the other tools are purely cosmetic corrections.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/tools/tinybird/get_job.ts New tool implementing GET /v0/jobs/{job_id}; follows established tool patterns with correct auth header, URL encoding, and transformResponse; job field is intentionally the full raw response for kind-specific fields.
apps/sim/blocks/blocks/tinybird.ts Adds Get Job Status operation with input/output wiring and conditions; scopes all existing outputs with per-operation conditions; clean integration with existing block config pattern.
apps/sim/tools/tinybird/types.ts Adds TinybirdGetJobParams and TinybirdGetJobResponse interfaces; union type updated; all fields are correctly nullable to match API variability.
apps/sim/tools/tinybird/index.ts Exports new getJobTool as tinybirdGetJobTool; consistent with existing export pattern.
apps/sim/tools/registry.ts Registers tinybird_get_job tool in the tool registry; straightforward addition.
apps/sim/tools/tinybird/events.ts Corrects token description scope name from DATASOURCE:APPEND to DATASOURCES:APPEND.
apps/sim/tools/tinybird/query.ts Corrects token description scope name from PIPE:READ to PIPES:READ.
apps/sim/tools/tinybird/query_pipe.ts Corrects token description scope name from PIPE:READ to PIPES:READ, matching query.ts fix.
apps/sim/tools/tinybird/append_datasource.ts Corrects token description scope name from DATASOURCES:CREATE to DATASOURCES:APPEND or DATASOURCES:CREATE.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant SimBlock as Tinybird Block
    participant AppendTool as tinybird_append_datasource
    participant DeleteTool as tinybird_delete_datasource_rows
    participant GetJobTool as tinybird_get_job (new)
    participant TinybirdAPI as Tinybird REST API

    User->>SimBlock: Select Append Data Source
    SimBlock->>AppendTool: "POST /v0/datasources?mode=append"
    AppendTool->>TinybirdAPI: POST /v0/datasources
    TinybirdAPI-->>AppendTool: job_id, status waiting
    AppendTool-->>SimBlock: job_id, job_url, status
    SimBlock-->>User: job_id returned

    User->>SimBlock: Select Get Job Status
    SimBlock->>GetJobTool: job_id from previous step
    GetJobTool->>TinybirdAPI: "GET /v0/jobs/{job_id}"
    TinybirdAPI-->>GetJobTool: id, kind, status, created_at
    GetJobTool-->>SimBlock: id, job_id, kind, status, job_url, error, job
    SimBlock-->>User: Poll until status is done or error

    User->>SimBlock: Select Delete Data Source Rows
    SimBlock->>DeleteTool: datasource, delete_condition
    DeleteTool->>TinybirdAPI: "DELETE /v0/datasources/{name}/deletions"
    TinybirdAPI-->>DeleteTool: job_id, status waiting
    DeleteTool-->>SimBlock: job_id, delete_id, status
    SimBlock-->>User: job_id returned for polling
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User
    participant SimBlock as Tinybird Block
    participant AppendTool as tinybird_append_datasource
    participant DeleteTool as tinybird_delete_datasource_rows
    participant GetJobTool as tinybird_get_job (new)
    participant TinybirdAPI as Tinybird REST API

    User->>SimBlock: Select Append Data Source
    SimBlock->>AppendTool: "POST /v0/datasources?mode=append"
    AppendTool->>TinybirdAPI: POST /v0/datasources
    TinybirdAPI-->>AppendTool: job_id, status waiting
    AppendTool-->>SimBlock: job_id, job_url, status
    SimBlock-->>User: job_id returned

    User->>SimBlock: Select Get Job Status
    SimBlock->>GetJobTool: job_id from previous step
    GetJobTool->>TinybirdAPI: "GET /v0/jobs/{job_id}"
    TinybirdAPI-->>GetJobTool: id, kind, status, created_at
    GetJobTool-->>SimBlock: id, job_id, kind, status, job_url, error, job
    SimBlock-->>User: Poll until status is done or error

    User->>SimBlock: Select Delete Data Source Rows
    SimBlock->>DeleteTool: datasource, delete_condition
    DeleteTool->>TinybirdAPI: "DELETE /v0/datasources/{name}/deletions"
    TinybirdAPI-->>DeleteTool: job_id, status waiting
    DeleteTool-->>SimBlock: job_id, delete_id, status
    SimBlock-->>User: job_id returned for polling
Loading

Reviews (2): Last reviewed commit: "fix(tinybird): align token-scope descrip..." | Re-trigger Greptile

…scope names

- events/query/query_pipe used singular DATASOURCE:/PIPE: scope names;
  Tinybird's Token API uses plural DATASOURCES:/PIPES:
- append_datasource now notes DATASOURCES:APPEND also suffices, not just CREATE
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit c7c5463. Configure here.

@waleedlatif1 waleedlatif1 merged commit 6d97b26 into staging Jul 7, 2026
18 checks passed
@waleedlatif1 waleedlatif1 deleted the tinybird-validate-integration branch July 7, 2026 15:54
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.

1 participant