Post platform meta (aspect ratio) parity across API and MCP#86
Merged
Conversation
PR #82 made `meta.aspect_ratio` crop Facebook (and already Instagram) feed images at publish time, but the API and MCP surfaces only half-supported it: you couldn't set meta at creation, the value wasn't validated, and responses never returned it. This closes those gaps. - New `AspectRatio` enum is the single source of truth for the allowed ratios (1:1, 4:5, 16:9, original). App/API/MCP requests now validate via `Rule::enum(AspectRatio::class)` — an invalid ratio is rejected everywhere instead of silently center-cropping to square. - API `StorePostRequest` and MCP `CreatePostTool` now accept `platforms.*.meta`; `CreatePost` persists it. MCP create documents `meta` in its schema. - `Api\PostPlatformResource` now exposes `meta`, so API and MCP responses return the aspect_ratio (and other per-platform meta) a client set.
Review follow-ups: - AspectRatio::toFloat() now owns the crop ratio math; CropsImageForAspectRatio delegates to it so the enum is the single source of truth for both validation and cropping (no more parallel literal map). - API update controller now reloads postPlatforms before returning, so the update response reflects the persisted platform meta/content_type (was stale). - Tests: AspectRatio enum unit test; API valid-update read-back + 'original' on create; MCP response read-back + valid update.
paulocastellano
added a commit
that referenced
this pull request
Jun 10, 2026
Conflict resolutions + integration fixes: - CreatePost: kept the branch's merge-into-existing meta persistence (equivalent to main's #86 replace on create, and what the automations flow was built on). - FacebookSettings.vue: kept both new defaults (previewOnly + meta). - RunGenerateNode + GenerateNodeConfig.vue: ContentType::InstagramCarousel was removed on main (#80); an IG carousel is now a multi-image instagram_feed, so the carousel-capable list uses InstagramFeed. - GenerateNodeTest: fixtures use the ContentType enum and the new instagram_feed carousel signal.
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.
Follow-up to #82. That PR made
meta.aspect_ratiocrop Facebook (and already Instagram) feed images at publish time, but the API and MCP surfaces only half-supported it. This closes the three gaps so the feature behaves the same on every creation path.Gaps closed
metaon create.Api\StorePostRequestand MCPCreatePostToolaccepted onlysocial_account_id+content_type— you could only set aspect ratio via update. They now acceptplatforms.*.meta, andCreatePostpersists it.metaas a free-form array, so an invalidaspect_ratio(e.g.3:2) slipped through and the publisher silently center-cropped to square. Now validated everywhere.Api\PostPlatformResource(used by both API and MCP responses) exposedcontent_typebut notmeta, so clients never got the aspect ratio back. It now returnsmeta.How
App\Enums\PostPlatform\AspectRatiobacked enum (1:1,4:5,16:9,original) — single source of truth.UpdatePostRequest, APIStore/Update, and MCPCreate/Updatetools all validate viaRule::enum(AspectRatio::class)(replacing the inlineRule::in([...])).CreatePostpersistsplatforms.*.meta; MCP create documentsmetain its schema.Api\PostPlatformResourceexposesmeta.No behavior change for the App editor (already worked); this brings API + MCP to the same place.
Tests
meta.aspect_ratiopersists + is returned in the response; invalid ratio rejected on create and update.create-postpersists meta; invalid ratio rejected on create and update.Full suite: 1703 passed, 2 skipped. Pint clean.