Skip to content

feat: Task 1D — engineConfig singleton + mediaAsset + automatedVideo v2#665

Merged
codercatdev merged 3 commits intodevfrom
feat/engine-config-v2
Mar 14, 2026
Merged

feat: Task 1D — engineConfig singleton + mediaAsset + automatedVideo v2#665
codercatdev merged 3 commits intodevfrom
feat/engine-config-v2

Conversation

@codercatdev
Copy link
Contributor

Task 1D: engineConfig singleton + schema updates

Consolidates all pipeline configuration into a single engineConfig Sanity singleton and updates schemas for v2.

Changes

New files:

  • sanity/schemas/singletons/engineConfig.ts (698 lines) — Single singleton replacing 6 config singletons + dashboardSettings
  • sanity/schemas/documents/mediaAsset.ts (93 lines) — Shared image asset with source/attribution/license tracking
  • lib/types/engine-config.ts (79 lines) — TypeScript interface for engineConfig

Updated files:

  • sanity/schemas/documents/automatedVideo.ts (705 lines) — v2 status flow, quality gate, shorts, thumbnails, social posts, workflowId, r2Prefix
  • lib/config.ts (63 lines) — Simplified config module for single-document fetch
  • sanity.config.ts — Register engineConfig + mediaAsset, remove 7 old singleton registrations

engineConfig Fieldsets (9 groups)

Fieldset Fields Key Defaults
Pipeline Control autoPublish, qualityThreshold, reviewTimeoutDays, reviewNotification, maxIdeasPerRun autoPublish: false, quality: 75
Content Cadence longFormPerWeek, shortsPerDay, blogsPerWeek, newsletterFrequency, publishDays, contentCategories 1/week, 2/day, 1/week, weekly
Trend Discovery trendSources, topicFocus, rssFeeds, trendSourcesEnabled, dedupWindowDays 8 RSS feeds, 90-day dedup
AI & Generation geminiModel, infographicModel, infographicPromptPrefix, systemInstruction, deepResearch*, thumbnailEnabled, scene counts 8-15 scenes, 180s target
Audio elevenLabsVoiceId pNInz6obpgDQGcFmaJgB
Distribution youtube/twitter/linkedin/tiktok/instagram/bluesky/newsletter enabled, templates, tags YT+Twitter+LinkedIn+Bluesky on
Sponsor cooldownDays, rateCardTiers, outreachEmailTemplate, maxOutreachPerRun 14 days, 3 tiers
Brand brandPrimary, brandBackground, brandText #7c3aed, #000000, #ffffff
Legacy awsRegion, remotionFunctionName, remotionServeUrl, gcsBucketName, gcsProjectId All deprecated

automatedVideo v2 Status Flow

draft → researching → research_complete → generating_media → generating_audio → assembling_video → quality_gate → pending_review → approved → publishing → published (+ rejected, archived)

New v2 Fields on automatedVideo

  • qualityScore, qualityIssues — AI critic output
  • reviewedAt, reviewedBy — review gate tracking
  • mediaAssets — references to mediaAsset documents
  • shorts[] — generated short clips with title, scene range, URLs
  • thumbnailHorizontal, thumbnailVertical — generated thumbnails
  • blogPostId — link to generated blog post
  • socialPosts[] — distribution tracking per platform
  • workflowId — CF Workflow instance ID
  • r2Prefix — R2 storage prefix

Breaking Changes

  • lib/config.ts API changed: getEngineConfig() replaces getConfig('table_name'). Backward compat alias getConfig exported but signature differs.
  • 13 files import from lib/config and will need updating. These are v1 cron routes being replaced by CF Workflow (Task 1F cleanup).
  • Old singleton schemas (pipelineConfig, contentConfig, etc.) are NOT deleted from disk — just unregistered from sanity.config.ts. Delete in Task 1F after v2 proven.

Design Decisions

  • Secrets stay as process.env — only tweakable config in engineConfig
  • Legacy fieldset collapsed by default with Sanity deprecated option
  • Brand colors as flat fields (brandPrimary/brandBackground/brandText) not nested object
  • targetVideoDurationSec bumped 90→180, sceneCountMin 3→8, sceneCountMax 5→15 for longer videos
  • qualityThreshold bumped 50→75 for v2 quality gate
  • Status field is read-only mirror — Workflow owns execution state

Depends On

Nothing — no dependencies.

Unblocks

  • Task 1E (@dashboard): Review dashboard can build against engineConfig fields
  • Task 1F (@content): Sanity cleanup after v2 proven

codercatdev and others added 2 commits March 14, 2026 09:52
…+ config module rewrite

Consolidates 6 config singletons + dashboardSettings into single engineConfig.
Adds mediaAsset schema for shared image assets with source tracking.
Updates automatedVideo with v2 status flow (12 states), quality gate,
shorts, thumbnails, social posts, workflowId, r2Prefix.
Rewrites lib/config.ts for single-document fetch.
…emove old singletons

Co-authored-by: content <content@miriad.systems>
@vercel
Copy link

vercel bot commented Mar 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
codingcat-dev Ignored Ignored Mar 14, 2026 2:02pm

…wrappers

1. Add legacy v1 status values to automatedVideo options list so existing
   production documents display correctly in Studio (script_ready, audio_gen,
   video_gen, rendering, uploading, flagged, infographics_generating, enriching)

2. Add comments on audioUrl/videoUrl/shortUrl explaining string type is
   intentional — R2/CDN paths may include query params that Sanity url
   validator rejects

3. Replace misleading getConfig alias with real wrapper functions that
   accept and ignore the old table name parameter. Also adds getConfigValue
   wrapper. Both marked for removal in Task 1F.

Co-authored-by: content <content@miriad.systems>
@codercatdev codercatdev merged commit 6ab3833 into dev Mar 14, 2026
2 checks passed
codercatdev added a commit that referenced this pull request Mar 14, 2026
Task 1D: engineConfig singleton + mediaAsset + automatedVideo v2 (PR #665, 6ab3833). Task 1E: Review dashboard with fail-closed auth on all server actions (PR #666, 18dee75). All code reviewed by @pm + workers.
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