Skip to content

fix(instagram): integration helpers reorg - #6143

Merged
BillLeoutsakosvl346 merged 1 commit into
stagingfrom
fix/instagram-architecture
Aug 1, 2026
Merged

fix(instagram): integration helpers reorg#6143
BillLeoutsakosvl346 merged 1 commit into
stagingfrom
fix/instagram-architecture

Conversation

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor

Summary

  • move Instagram Graph constants from lib/integrations into the provider tool domain
  • move Instagram media resolution into the server routes that own publishing behavior
  • remove the provider-specific runtime folder under lib/integrations
  • add focused media-resolution coverage and complete the required integration templates

Why

Instagram was the only provider with runtime code under lib/integrations/<provider>. Mature integrations such as TikTok, Shopify, and Buffer organize the same responsibilities under tools, OAuth, and provider API routes. This keeps Instagram aligned with those existing ownership boundaries without introducing a new abstraction or changing runtime behavior.

Compatibility

Tool IDs, API routes, request/response shapes, OAuth scopes, Graph API version, media limits, legacy file inputs, polling, and generated integration metadata are unchanged. Instagram remains hidden from the toolbar.

Validation

  • 57 Instagram tests passed across 8 files
  • block registry, canonical ID, and metadata checks passed
  • scoped Biome and git diff --check passed
  • docs generation succeeded and left integrations.json unchanged
  • independent validate-integration and memory-safety audit found no critical issues

Full TypeScript validation currently stops on the unrelated existing trigger.config.ts:51 mismatch where node-24 is not included in the installed Trigger.dev runtime type union; no Instagram errors were reported.

@vercel

vercel Bot commented Aug 1, 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 Aug 1, 2026 12:05am

Request Review

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

@greptile review

@BillLeoutsakosvl346

Copy link
Copy Markdown
Contributor Author

bugbot run verbose=true

@cursor

cursor Bot commented Aug 1, 2026

Copy link
Copy Markdown

Bugbot request id: serverGenReqId_eff52693-868e-4f0a-a303-2952e4cb48a4

@cursor

cursor Bot commented Aug 1, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Structural refactor with import-only route changes and added tests; no intentional API or publishing behavior changes.

Overview
This PR relocates Instagram runtime code so it matches other providers: Graph constants live under tools/instagram, and media resolution lives next to the publish API routes in app/api/tools/instagram instead of lib/integrations/instagram.

Publish routes and the OAuth callback only change import paths; OAuth, tool IDs, routes, and media limits are unchanged. New resolve-media.test.ts exercises HTTPS rules, cloud-storage requirements, MIME/size limits, carousel parsing (JSON, legacy comma URLs, sequential resolution), and item counts.

The Instagram block gains four workflow templates (Story queue, carousel campaigns, media archive) plus a test that InstagramBlockMeta has seven templates total.

Reviewed by Cursor Bugbot for commit a371386. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor

cursor Bot commented Aug 1, 2026

Copy link
Copy Markdown

Bugbot rules debug

No rules were used for this review.

https://cursor.com/docs/bugbot#team-rules

Bugbot request id: serverGenReqId_eff52693-868e-4f0a-a303-2952e4cb48a4

@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 a371386. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Refactors Instagram integration ownership without changing its public contracts.

  • Moves Instagram Graph constants into the provider tool domain.
  • Relocates media resolution beside the publishing API routes and updates all consumers.
  • Adds focused media-resolution tests and three integration templates.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/sim/app/api/tools/instagram/resolve-media.ts Relocates the unchanged media-resolution implementation beside its publishing routes, with all known callers updated.
apps/sim/app/api/tools/instagram/resolve-media.test.ts Adds coverage for URL validation, uploaded files, media limits, carousel parsing, and sequential resolution.
apps/sim/blocks/blocks/instagram.ts Adds valid Story publishing, carousel publishing, and media archive templates backed by registered Instagram tools.
apps/sim/tools/instagram/constants.ts Moves unchanged Instagram Graph constants into the Instagram tool domain.
apps/sim/app/api/auth/oauth2/callback/instagram/route.ts Updates the OAuth callback to import the unchanged Graph base constant from its new location.
apps/sim/tools/instagram/utils.ts Updates Graph utility imports to the relocated constants module.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Workflow[Instagram workflow tool] --> PublishRoute[Instagram publishing API route]
  PublishRoute --> Resolver[Co-located media resolver]
  Resolver --> Storage[Uploaded-file storage]
  Resolver --> Meta[Meta-accessible HTTPS media URL]
  PublishRoute --> GraphUtils[Instagram Graph utilities]
  GraphConstants[Tool-domain Graph constants] --> GraphUtils
  GraphUtils --> Instagram[Instagram Graph API]
Loading

Reviews (2): Last reviewed commit: "refactor Instagram integration architect..." | Re-trigger Greptile

@BillLeoutsakosvl346
BillLeoutsakosvl346 marked this pull request as ready for review August 1, 2026 01:07
@BillLeoutsakosvl346
BillLeoutsakosvl346 merged commit ecf1d7d into staging Aug 1, 2026
27 checks passed
@icecrasher321 icecrasher321 changed the title Refactor Instagram integration architecture fix(instagram): integration helpers reorg Aug 1, 2026
@waleedlatif1
waleedlatif1 deleted the fix/instagram-architecture branch August 1, 2026 04:19
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