Add generation quality checks before export#35
Conversation
✅ Deploy Preview for launchpix ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d2e7ea0d49
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!qualityReport.pass) { | ||
| qualityFailures.push({ | ||
| assetType: asset.asset_type, | ||
| issues: qualityReport.issues.filter((issue) => issue.severity === "error").map((issue) => issue.message) | ||
| }); | ||
| continue; |
There was a problem hiding this comment.
Preflight quality before rendering assets
In runs where a later asset fails a quality check after earlier assets have passed, this continue lets the loop upload and insert the earlier assets, then line 198 marks the generation failed. Because the latest generation's assets are loaded directly in app/dashboard/projects/[id]/assets/page.tsx and AssetsManager presents them as a generated pack, users can see/download an incomplete failed pack with no ZIP. Validate all deterministicAssets before any rendering/upload, or roll back/delete partial assets when aborting.
Useful? React with 👍 / 👎.
| if (callouts.some((callout) => callout.length > 48)) issues.push({ code: "callout_line_overflow", severity: "error", message: "One or more callouts exceed 48 characters and may overflow." }); | ||
|
|
||
| if (!cta) issues.push({ code: "cta_missing", severity: "error", message: "CTA text is missing. Add an action-oriented label." }); | ||
| if (cta.length > 28) issues.push({ code: "cta_overflow", severity: "error", message: `CTA is too long (${cta.length}/28). Keep it concise.` }); |
There was a problem hiding this comment.
Align CTA quality limit with generated plan schema
When Mistral returns a valid cta_line between 29 and 40 characters, this new check marks every asset as failed because the same CTA is checked for each frame, even though generationPlanSchema still allows CTAs up to 40 characters and the prompt does not state the 28-character cap. Since that text is generated internally before the user can edit it, normal valid plans can now abort with an unactionable quality error; clamp/regenerate the CTA or make the schema/prompt enforce the same limit before quality runs.
Useful? React with 👍 / 👎.
| if (headline.length > 65) issues.push({ code: "headline_overflow", severity: "error", message: `Headline is too long (${headline.length}/65). Shorten it to avoid text clipping.` }); | ||
|
|
||
| if (!subheadline) issues.push({ code: "subheadline_missing", severity: "error", message: "Subheadline is missing. Add supporting context for the headline." }); | ||
| if (subheadline.length > 95) issues.push({ code: "subheadline_overflow", severity: "error", message: `Subheadline is too long (${subheadline.length}/95). Reduce sentence length.` }); |
There was a problem hiding this comment.
Align copy caps with the fallback plan
When AI planning falls back to createDeterministicGenerationPlan (for example with MISTRAL_API_KEY unset or a planning error), the fallback deliberately emits headlines up to 80 characters and subheadlines up to 120 characters, matching generationPlanSchema; projects with longer names/descriptions therefore pass planning and then fail these new caps before any asset can export. Either clamp the fallback/prompt/schema to 65/95 or allow the same limits here so a valid fallback plan does not abort generation.
Useful? React with 👍 / 👎.
Summary
Verification