Skip to content

fix(posts): accept ai-generated media in post media validation - #23

Merged
Cryptoom merged 1 commit into
mainfrom
fix/allow-ai-generated-media-in-post-validation
Sep 19, 2026
Merged

Cryptoom merged 1 commit into
mainfrom
fix/allow-ai-generated-media-in-post-validation

Conversation

@Cryptoom

Copy link
Copy Markdown
Owner

Problem

Since #9 (877a2a9) PostMediaRules::assertHostedMediaExists only accepted media in the assets collection. Slides created by the AI image pipeline (PostImagePipeline, RegeneratePostMediaImage) are stored in ai-generated. Clicking "Post now" or scheduling an AI-created carousel from the editor therefore failed with Media not found. and the post stayed a draft.

Confirmed against production data: the stuck draft's slide ids exist in medias with collection = ai-generated.

Change

  • New PostMediaRules::POST_MEDIA_COLLECTIONS = ['assets', 'ai-generated'], used by the existence check.
  • Workspace ownership check unchanged: other workspaces' media and non-post collections (logo, avatar) are still rejected.

Tests

Three new tests in PostMediaExistsValidationWebTest: accepts ai-generated media, rejects another workspace's ai-generated media, still rejects the logo collection. The first one failed before the fix with Media not found.

Affected suites green: 414 passed (post media validation web + API, PostControllerTest, Mcp). Pint passes.

Not deployed.

🤖 Generated with Claude Code

assertHostedMediaExists (877a2a9) only accepted the `assets` collection,
but slides created by the AI image pipeline live in `ai-generated`.
Publishing or scheduling an AI-created carousel from the editor failed
with "Media not found." and the post stayed a draft.

Allow both collections via PostMediaRules::POST_MEDIA_COLLECTIONS. The
workspace ownership check is unchanged, so other workspaces' media and
non-post collections such as `logo` are still rejected.
@Cryptoom
Cryptoom merged commit 9d652dc into main Sep 19, 2026
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