Deterministic video-prompt linter for continuous episode clips - #6231
Merged
Conversation
…ips (#6226) Chained video generation smears/collapses faces, clothing, and environments when a continuing clip's prompt drifts from the prior one — a missing hard cut, a re-used framing, a paraphrased bible descriptor, or language (same/ still/negatives/on-screen text) that a video model renders literally instead of ignoring. videoPromptLinter.js checks a clip prompt against every rule and returns structured per-clip results instead of throwing, so a caller decides whether to block, warn, or retry.
…adjacent terms - Never throw on a non-string prompt/framing or non-array references/clips (the module's own contract is to return a structured result, not throw). - Match banned terms on \b word boundaries instead of a hand-rolled [^a-z0-9] class, so "same_frame_id" no longer false-positives on "same". - Precompile the banned-term regexes once at module load instead of per call. Found in local opencode review of #6226.
(clips || []) only caught null/undefined — a string, number, or plain object still hit .map and threw, violating the module's own never-throw contract. Found in local opencode review round 2.
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.
Summary
server/lib/videoPromptLinter.js: a pure, structured lint pass for continuous-video clip prompts (chained/continue-cut video generation). Checks acutType: 'continue'clip for the"Hard cut to <framing>:"opener plus a framing distinct from the preceding clip, requires every referenced bible cast/location descriptor to appear verbatim, bans cross-clip referents (same/still/again/continues/as before), negatives (no/without/never), and UI-overlay language (text/caption/overlay), and enforces an 800-character prompt bound.{pass, reasons[]}per clip rather than throwing — callers decide how to surface a failing lint.server/lib/barrel + README per the module-organization convention.Test plan
cd server && npx vitest run lib/videoPromptLinter.test.js lib/index.test.js— 31/31 passing, including malformed-input (never-throw) and underscore-boundary false-positive cases.\b-based word-boundary matching instead of a hand-rolled character class, precompiled regexes).Closes #6226