Skip to content

feat: add standalone primitive tasks for modular content creation#122

Open
recoupableorg wants to merge 2 commits intomainfrom
feature/content-primitives
Open

feat: add standalone primitive tasks for modular content creation#122
recoupableorg wants to merge 2 commits intomainfrom
feature/content-primitives

Conversation

@recoupableorg
Copy link
Copy Markdown
Contributor

@recoupableorg recoupableorg commented Apr 2, 2026

Break the monolithic pipeline into independently callable primitives:

  • create-image: face guide + template + fal.ai image generation
  • create-video: image-to-video or lipsync audio-to-video
  • create-audio: song selection, transcription, clip analysis
  • create-render: ffmpeg crop + audio + text overlay
  • create-upscale: image or video upscaling

Each primitive is a schemaTask with its own Zod schema. The existing create-content task (V1 full pipeline) is untouched.

Made-with: Cursor

Summary by CodeRabbit

  • New Features

    • Added validation schemas for image, video, audio, text, and upscale content payloads
    • Added tasks for creating audio, images, videos, and upscaling content with configurable parameters and machine-specific execution constraints
  • Tests

    • Added comprehensive test suite validating schema parsing, default values, and error handling across all content payload types

Break the monolithic pipeline into independently callable primitives:
- create-image: face guide + template + fal.ai image generation
- create-video: image-to-video or lipsync audio-to-video
- create-audio: song selection, transcription, clip analysis
- create-render: ffmpeg crop + audio + text overlay
- create-upscale: image or video upscaling

Each primitive is a schemaTask with its own Zod schema. The existing
create-content task (V1 full pipeline) is untouched.

Made-with: Cursor
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

Warning

Rate limit exceeded

@sidneyswift has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 17 minutes and 1 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 17 minutes and 1 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 401fda23-8ac3-4032-a9aa-0dc4f8169868

📥 Commits

Reviewing files that changed from the base of the PR and between ef2991d and 621f1a3.

📒 Files selected for processing (1)
  • src/schemas/contentPrimitiveSchemas.ts
📝 Walkthrough

Walkthrough

This PR introduces Zod-based schema validation and Trigger.dev v3 task definitions for content creation workflows. It adds payload schemas for image, video, audio, render, and upscale operations, along with corresponding executable tasks that validate inputs, integrate with the Fal service, and orchestrate the creation process.

Changes

Cohort / File(s) Summary
Content Schemas
src/schemas/contentPrimitiveSchemas.ts, src/schemas/__tests__/contentPrimitiveSchemas.test.ts
New Zod schema definitions for image, video, audio, render, and upscale payloads with TypeScript type inference; includes test coverage validating required/optional fields, defaults, and rejection criteria for invalid inputs.
Content Creation Tasks
src/tasks/createImageTask.ts, src/tasks/createVideoTask.ts, src/tasks/createAudioTask.ts, src/tasks/createRenderTask.ts, src/tasks/createUpscaleTask.ts
Five new Trigger.dev v3 tasks that validate payloads, configure Fal credentials, orchestrate content operations (image/video/audio generation, rendering, upscaling), resolve dependencies (templates, face guides, audio clips), and return result URLs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 Five tasks now hop and play,

Schemas guard the payload way,

With Fal calls and defaults set,

Content creation at its best! 🎬

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding five new standalone primitive tasks for modular content creation, which is the core addition across all modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/content-primitives

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/schemas/contentPrimitiveSchemas.ts`:
- Around line 3-4: Remove the dead declarations TEXT_LENGTHS and TextLength from
this module: delete the exported constant TEXT_LENGTHS and the exported type
alias TextLength so they no longer appear in
src/schemas/contentPrimitiveSchemas.ts; ensure there are no remaining references
or exports to TEXT_LENGTHS or TextLength in this file (and update any export
lists if present).

In `@src/tasks/createRenderTask.ts`:
- Around line 31-32: The code incorrectly reads result.videoUrl but
renderFinalVideo (RenderFinalVideoOutput) returns dataUrl; update the return to
use result.dataUrl (or rename to dataUrl consistently) and keep sizeBytes:
return { videoUrl: result.dataUrl, sizeBytes: result.sizeBytes } or, if you
prefer explicit types, change the returned shape to { dataUrl: result.dataUrl,
mimeType: result.mimeType, sizeBytes: result.sizeBytes } and adjust callers
accordingly (look for renderFinalVideo, RenderFinalVideoOutput, and logStep
usage).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f9b8913a-6a46-4c72-9d70-d854bc24cdc4

📥 Commits

Reviewing files that changed from the base of the PR and between e719559 and ef2991d.

📒 Files selected for processing (7)
  • src/schemas/__tests__/contentPrimitiveSchemas.test.ts
  • src/schemas/contentPrimitiveSchemas.ts
  • src/tasks/createAudioTask.ts
  • src/tasks/createImageTask.ts
  • src/tasks/createRenderTask.ts
  • src/tasks/createUpscaleTask.ts
  • src/tasks/createVideoTask.ts

Comment on lines +31 to +32
logStep("Render complete", true, { sizeBytes: result.sizeBytes });
return { videoUrl: result.videoUrl, sizeBytes: result.sizeBytes };
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the return type of renderFinalVideo
ast-grep --pattern $'export interface RenderFinalVideoOutput {
  $$$
}'

Repository: recoupable/tasks

Length of output: 539


🏁 Script executed:

#!/bin/bash
# Read the createRenderTask.ts file around line 32
sed -n '25,40p' src/tasks/createRenderTask.ts

Repository: recoupable/tasks

Length of output: 404


Incorrect property access: renderFinalVideo returns dataUrl, not videoUrl.

The RenderFinalVideoOutput interface defines { dataUrl, mimeType, sizeBytes }. Accessing result.videoUrl on line 32 will return undefined.

🐛 Proposed fix
     logStep("Render complete", true, { sizeBytes: result.sizeBytes });
-    return { videoUrl: result.videoUrl, sizeBytes: result.sizeBytes };
+    return { videoUrl: result.dataUrl, sizeBytes: result.sizeBytes };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
logStep("Render complete", true, { sizeBytes: result.sizeBytes });
return { videoUrl: result.videoUrl, sizeBytes: result.sizeBytes };
logStep("Render complete", true, { sizeBytes: result.sizeBytes });
return { videoUrl: result.dataUrl, sizeBytes: result.sizeBytes };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tasks/createRenderTask.ts` around lines 31 - 32, The code incorrectly
reads result.videoUrl but renderFinalVideo (RenderFinalVideoOutput) returns
dataUrl; update the return to use result.dataUrl (or rename to dataUrl
consistently) and keep sizeBytes: return { videoUrl: result.dataUrl, sizeBytes:
result.sizeBytes } or, if you prefer explicit types, change the returned shape
to { dataUrl: result.dataUrl, mimeType: result.mimeType, sizeBytes:
result.sizeBytes } and adjust callers accordingly (look for renderFinalVideo,
RenderFinalVideoOutput, and logStep usage).

Addresses CodeRabbit review; exports were unused across the repo.

Made-with: Cursor
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.

2 participants