refactor(instagram): align publishing with codebase patterns - #6270
refactor(instagram): align publishing with codebase patterns#6270BillLeoutsakosvl346 wants to merge 5 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryCursor Bugbot is generating a summary for commit b706259. Configure here. |
Greptile SummaryThis PR standardizes Instagram publishing operations on canonical Sim file inputs and consolidates server-only media resolution and Graph publishing helpers into a provider-local module.
Confidence Score: 5/5The PR appears safe to merge, with no changed-code-triggered correctness or security failures identified. The canonical file shapes remain consistent across block normalization, tool request construction, API contract validation, route handling, file resolution, and Graph publishing, while relocated publishing helpers preserve base-branch behavior.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/tools/instagram/server-utils.ts | Consolidates server-only file resolution and Graph publishing helpers while preserving the existing publishing lifecycle. |
| apps/sim/lib/api/contracts/tools/instagram.ts | Replaces publishing URL/string input schemas with shared canonical RawFileInput schemas and bounded file arrays. |
| apps/sim/blocks/blocks/instagram.ts | Aligns publishing block parameters with canonical file inputs and keeps all Instagram operations registered. |
| apps/sim/tools/instagram/publish_carousel.ts | Passes canonical file arrays directly through the carousel publishing request. |
| apps/sim/tools/instagram/types.ts | Updates publishing parameter types to use canonical single-file and file-array representations. |
Sequence Diagram
sequenceDiagram
participant Workflow as Workflow executor
participant Tool as Instagram publish tool
participant Route as Publishing API route
participant Files as Sim file storage
participant Meta as Instagram Graph API
Workflow->>Tool: Canonical Sim file input
Tool->>Route: Authenticated publish request
Route->>Files: Resolve file to signed HTTPS URL
Files-->>Route: Signed media URL
Route->>Meta: Create media container
loop Until ready
Route->>Meta: Read container status
Meta-->>Route: IN_PROGRESS or FINISHED
end
Route->>Meta: Publish container
Meta-->>Route: Published media ID
Route-->>Tool: Container ID, media ID, status
Reviews (1): Last reviewed commit: "fix(instagram): remove stale cover strin..." | Re-trigger Greptile
…-codebase-alignment # Conflicts: # apps/sim/tools/generated/tool-metadata.ts
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0f49ed3. Configure here.
| condition: { field: 'operation', value: 'instagram_publish_carousel' }, | ||
| mode: 'basic', | ||
| multiple: true, | ||
| hideFromCopilot: true, |
There was a problem hiding this comment.
Copilot hide marks media private
Low Severity
Setting hideFromCopilot on carouselMediaUpload also adds carouselMedia to privateInputIds via the serializer, so carousel media is stripped from execution logs. Sibling Instagram publish uploads do not use this flag, and it is otherwise reserved for server-managed secrets like mothership secret scope.
Reviewed by Cursor Bugbot for commit 0f49ed3. Configure here.
Instagram architecture classificationThis classifies the final Instagram integration after the compatibility cleanup.
StandardBlock
The normal integration block containing the 24 operations, conditional fields, parameter mapping, and output declarations. Publishing now uses the standard canonical file pair:
The basic carousel picker is hidden only from Copilot metadata because Mothership should use the advanced array reference. The human editor remains unchanged. This is provider configuration inside the conventional block definition, not new platform infrastructure. Tools
These follow the conventional Registration and generated metadata
These are ordinary integration registry, icon, and generated-catalog files. Semi-standardFile-backed publishing and download routes
These routes are required because publishing must:
Other file-backed integrations use internal routes for the same reasons. The routes remain thin, while shared Instagram publishing behavior is colocated in one provider-local server helper. No service framework or generic operation router was added. Instagram-specific OAuth flow
Instagram requires Meta’s authorization flow, short-lived token exchange, long-lived token exchange, account discovery, and proactive refresh behavior. Dedicated provider routes/helpers are therefore justified, just as other nonstandard OAuth providers have their own provider-specific handling. This belongs with the Instagram integration because the integration cannot connect or refresh credentials correctly without it. It does not change OAuth behavior for unrelated providers. Cloud-storage capability check
Instagram publishing requires media that Meta can retrieve from a public provider-accessible URL. The existing capability check prevents presenting publishing as available when the local deployment has no compatible cloud storage. This is an established platform capability check rather than an Instagram-specific storage implementation. UniqueThere are no remaining unique Instagram runtime files. The cleanup removed:
Instagram has no background jobs, custom execution queues, database tables, migrations, webhook architecture, or shared framework changes. Tests retained
These cover behavior that is easy to regress:
The standalone contract-restatement test and duplicated malformed-response/configuration assertions were removed. ResultThe final Instagram implementation preserves all 24 operations while using conventional tools, canonical file inputs, thin authenticated routes for genuine binary/server work, and provider-local OAuth handling. No unique shared architecture remains. |


Summary
Why
Instagram had accumulated provider-specific input formats and duplicated server plumbing that differed from established Sim integration patterns. Because the integration is unreleased, the cleanup can remove those compatibility formats without migrations or aliases.
Validation
No Instagram triggers or shared platform changes are included.