{"candidate_reason": "python scope discovery", "chunk_end": 63, "chunk_start": 1, "chunk_summary": "No actionable findings; the file defines a canonical enum and performs exact-match validation on a structured field without using brittle string patterns or scenario-specific logic.", "duration_ms": 3677, "findings": [], "path": "backend/app/core/framing_scale.py", "scan_kind": "python", "sha256": "a48840fd0a5c37397cb26a10a57d4bd4333071aa55ad4bae0f6db74f786ca4e3"}
{"candidate_reason": "python scope discovery", "chunk_end": 454, "chunk_start": 1, "chunk_summary": "The file implements visibility and off-screen reconciliation logic using brittle natural-language regex patterns and proximity heuristics over Korean and English scenario text.", "duration_ms": 17597, "findings": [{"category": "semantic_string_judgment", "evidence": "detect_gaze_pattern_exclusions uses _KOREAN_GAZE_STEMS, _KOREAN_FRAMING_NOUNS, and _BODY_PART_NOUNS to exclude entities from visible_entity_ids.", "line_end": 304, "line_start": 37, "recommended_fix": "Shift visibility logic to the LLM (shot_director) by requiring structured visibility/framing metadata in the schema, rather than inferring it from the description prose via regex.", "severity": "P1", "why_problematic": "This function decides visible-entity membership (a core visual semantic) by parsing natural-language shot descriptions for specific Korean verb/noun patterns. It relies on a brittle list of body parts and gaze verbs to infer whether a character is the subject or target of a close-up, which is prone to false triggers as scenario complexity increases."}, {"category": "semantic_string_judgment", "evidence": "detect_offscreen_drift uses _OFFSCREEN_PHRASES and proximity windows (_PROXIMITY_PRE, _PROXIMITY_POST) to identify drift in camera_direction.", "line_end": 445, "line_start": 85, "recommended_fix": "Require the staging LLM to provide a structured list of off-screen entities or use the existing character_angles.gaze_target field exclusively, removing the natural-language proximity fallback.", "severity": "P1", "why_problematic": "This function performs semantic validation (pass/fail via VisibleStagingDriftError) by searching for 'off-camera' or 'out of frame' phrases in natural-language LLM output. The proximity-based name extraction (last-wins within a character window) is a brittle heuristic for determining which entity is off-screen."}], "path": "backend/app/modules/pipeline/shot_visibility.py", "scan_kind": "python", "sha256": "1b551eb799e33ae1cd96ed94b561fda2b0921cd0a2f8d77e4f2ba515d2af15db"}
{"candidate_reason": "python scope discovery", "chunk_end": 280, "chunk_start": 1, "chunk_summary": "The file handles background prompt assembly and validation using structured data injection and technical format checks, with no actionable semantic string judgment or scenario pollution found.", "duration_ms": 18759, "findings": [], "path": "backend/app/modules/pipeline/background_prompt.py", "scan_kind": "python", "sha256": "de5f48a96c5a19b9b07b12506ddaa30556c2053f398f2284c175be142c76a3b2"}
{"candidate_reason": "python scope discovery", "chunk_end": 953, "chunk_start": 1, "chunk_summary": "The file implements a validator for visible entities that uses regex and substring matching over generated natural-language prompts to classify visual framing, detect trigger phrases for enforcement exemptions, and verify proximity between character names and IDs.", "duration_ms": 20609, "findings": [{"category": "semantic_string_judgment", "evidence": "_FACE_CLOSE_UP_PATTERNS = [...] and _is_face_close_up(prompt)", "line_end": 161, "line_start": 139, "recommended_fix": "Move framing classification to a structured field in the shot schema (e.g., shot_framing) populated by the LLM, rather than inferring it from the prompt text via regex.", "severity": "P1", "why_problematic": "This uses hardcoded regex patterns to detect visual framing (face/eye close-ups) within generated natural-language prompts. The result is used to deny ID enforcement exemptions, making the validation policy dependent on brittle string matching over open-world prose."}, {"category": "semantic_string_judgment", "evidence": "if isinstance(t, str) and t and t.lower() in prompt_lower:", "line_end": 231, "line_start": 214, "recommended_fix": "Instead of matching phrases in the prompt, have the LLM explicitly flag the application of the body-part focus rule in a structured boolean or enum field.", "severity": "P1", "why_problematic": "This performs substring matching of 'trigger phrases' (from the id_policy) against the generated t2i_prompt to grant validation exemptions. This creates a brittle contract where slight variations in LLM output phrasing can cause validation failures or unexpected policy changes."}, {"category": "semantic_string_judgment", "evidence": "_entity_specific_id_in_window(prompt, pos, len(name_lower), entity_id_cands)", "line_end": 128, "line_start": 102, "recommended_fix": "Enforce ID presence at the prompt assembly level or use a structured mapping of entities to prompt segments rather than post-hoc proximity heuristics.", "severity": "P1", "why_problematic": "This function implements a complex heuristic to verify that a character name in the prompt is 'anchored' by a specific ID within a 60-character window and the same sentence. It attempts to infer semantic relationship/membership from proximity in natural language, which is prone to false negatives in complex sentences."}], "path": "backend/app/core/visible_entities_validator.py", "scan_kind": "python", "sha256": "366e2185c5df853112075146a74dc8d81d4c36e5fe4441689b7cc81833b80485"}
{"candidate_reason": "python scope discovery", "chunk_end": 213, "chunk_start": 1, "chunk_summary": "The file defines and validates controlled vocabularies for background states and location types that are manually synchronized with LLM prompts, creating schema drift risks for semantic scenario labels.", "duration_ms": 20898, "findings": [{"category": "schema_or_enum_drift", "evidence": "STATE_CLASS_ENUM: FrozenSet[str] = frozenset({\"normal\", ..., \"blood_scene\", ...}) ... if state_class not in STATE_CLASS_ENUM: raise StateClassError", "line_end": 56, "line_start": 26, "recommended_fix": "Define these states in a shared schema (e.g., a JSON schema or a central Pydantic model) that is used to both generate the prompt instructions and validate the output, rather than maintaining a manual list in code.", "severity": "P2", "why_problematic": "The code enforces a closed list of semantic scenario states (e.g., 'ransacked', 'blood_scene', 'intrusion') that are produced by an LLM. As noted in the docstring (line 48), this requires manual synchronization with the LLM prompt, creating a drift risk where the LLM might use natural synonyms that the validator rejects, leading to unnecessary retries."}, {"category": "schema_or_enum_drift", "evidence": "LOCATION_SPACE_KEY_VOCAB: FrozenSet[str] = frozenset({\"main\", \"kitchen\", ...}) ... invalid_keys = [k for k in allowed if k not in LOCATION_SPACE_KEY_VOCAB]", "line_end": 201, "line_start": 128, "recommended_fix": "Centralize the location space vocabulary in a schema that can be injected into prompts and used for validation automatically.", "severity": "P2", "why_problematic": "The vocabulary for sub-location types (e.g., 'kitchen', 'rooftop', 'yard') is hardcoded and must be manually synchronized with the 'entity_extractor' system prompt (as explicitly stated in line 127). This is a semantic classifier list that causes fail-fast errors if the LLM deviates from the exact strings."}], "path": "backend/app/core/bg_state_vocab.py", "scan_kind": "python", "sha256": "d6c2d1fccafa20ba72e40e90ca8a76f14d4225eebe57c37a205c010e50e9aafd"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 25, "chunk_start": 1, "chunk_summary": "No actionable findings; the prompt defines technical layout and rendering validation criteria for PDF quality inspection without scenario-specific pollution or semantic string classifiers.", "duration_ms": 3388, "findings": [], "path": "prompts/_base/pdf_validation/v1/validate.md", "scan_kind": "prompt", "sha256": "9d9d162a76c35ddaa16838e139091f919d987a92e1182e122eb4df0cdabe6035"}
{"candidate_reason": "python scope discovery", "chunk_end": 70, "chunk_start": 1, "chunk_summary": "No actionable findings; the file manages technical short ID generation and mapping for entities using a defined prefix system.", "duration_ms": 4985, "findings": [], "path": "backend/app/modules/short_id.py", "scan_kind": "python", "sha256": "a12da612ad174a03abd3fc704048950edc892d574fbad599ae73f53b5b9a325e"}
{"candidate_reason": "python scope discovery", "chunk_end": 457, "chunk_start": 1, "chunk_summary": "The file implements a reference contract validator that uses brittle regex and token-based keyword matching to infer semantic meaning from natural-language prompts to enforce reference attachment rules.", "duration_ms": 26897, "findings": [{"category": "semantic_string_judgment", "evidence": "_CHARACTER_TOKENS (line 49), _FROM_THE_REFERENCE_RE (line 64), classify_from_the_reference (line 156), and usage in validate_attached_refs (line 426)", "line_end": 457, "line_start": 49, "recommended_fix": "Replace brittle string-based classification with structured metadata emitted by the LLM during prompt generation. The LLM should explicitly tag which entity or background a 'from the reference' instruction refers to in a structured field.", "severity": "P1", "why_problematic": "The 'phantom guard' mechanism uses hardcoded lists of nouns (e.g., 'face', 'door', 'phone') and regex patterns to classify the semantic target of 'from the reference' phrases in natural-language prompts. This classification directly determines whether a validation error (RefContractError) is raised, blocking image generation. This is brittle and prone to false positives/negatives as it attempts to infer open-world visual meaning from a closed list of keywords."}], "path": "backend/app/core/ref_contract_validator.py", "scan_kind": "python", "sha256": "93a34075f568486f74bd384f96f18208bab54f8e5777726c6d7beef955a7b504"}
{"candidate_reason": "python scope discovery", "chunk_end": 454, "chunk_start": 1, "chunk_summary": "The file implements a T2I prompt review and correction mechanism that uses LLM-generated target/suggestion pairs to perform blind substring replacement on generated prompts.", "duration_ms": 26067, "findings": [{"category": "blind_string_mutation", "evidence": "c[\"t2i_prompt\"] = old.replace(target, suggestion) ... variation[\"t2i_prompt\"] = old_prompt.replace(target, suggestion)", "line_end": 451, "line_start": 394, "recommended_fix": "Transition to a structured prompt editing model where the LLM returns the full corrected prompt or uses a more robust patching mechanism that validates the context of the change.", "severity": "P1", "why_problematic": "The code performs blind substring replacement on generated T2I prompt prose using 'target' and 'suggestion' strings emitted by an LLM. This assumes the LLM can provide an exact, unique substring match and that the replacement is semantically safe, which is brittle for natural language prompts and can lead to corrupted or nonsensical prompt text if the target appears multiple times or in unintended contexts."}], "path": "backend/app/modules/pipeline/t2i_review.py", "scan_kind": "python", "sha256": "e5323a52576aa62eafcd92d24ae73f9667641d7fc4d92cc1e588b23e2239b5b8"}
{"candidate_reason": "python scope discovery", "chunk_end": 779, "chunk_start": 1, "chunk_summary": "The file implements scene consistency logic with a deterministic validator that uses regex and keyword matching over natural language descriptions and element IDs to classify visual framing and block downstream processing.", "duration_ms": 29831, "findings": [{"category": "semantic_string_judgment", "evidence": "_ELEMENT_ID_CLOSE_REGEX, _DESCRIPTION_CLOSE_KEYWORDS, and _classify_framing", "line_end": 121, "line_start": 65, "recommended_fix": "Move framing classification to the LLM schema as an explicit enum field (e.g., 'framing_scope': 'close' | 'full') instead of inferring it from prose and IDs via regex.", "severity": "P1", "why_problematic": "The code uses a brittle list of body parts (wrist, eye, mouth, etc.) and framing keywords (tight on, macro, detail shot) to infer visual meaning ('close' vs 'full') from element IDs and natural-language descriptions. This classification is used by _detect_framing_conflicts to fail validation (STATUS_VALIDATOR_VIOLATIONS) and block downstream consumers via is_scene_result_consumer_safe."}, {"category": "semantic_string_judgment", "evidence": "summary.startswith(\"분석 실패\") or summary.startswith(\"분석 차단\")", "line_end": 620, "line_start": 354, "recommended_fix": "Rely exclusively on the structured 'status' field. For legacy data, perform a one-time migration or treat missing status as a requirement to re-run rather than parsing summary text.", "severity": "P2", "why_problematic": "The code infers the technical status (failed or blocked) of a previous execution by checking the prefix of a natural-language 'analysis_summary' string. This is used for backward compatibility to decide whether to reuse or retry a scene."}, {"category": "scenario_dependent_prompt", "evidence": "\"- 사망/부상/의식불명 인물의 자세와 위치\\n- 환경 상태 (깨진 창문, 열린 문, 혈흔 등)\"", "line_end": 750, "line_start": 749, "recommended_fix": "Replace concrete scenario examples with abstract categories such as 'physical state of characters' or 'specific environmental changes/damage'.", "severity": "P2", "why_problematic": "The prompt contains concrete scenario-specific examples (death, injury, bloodstains, broken windows) as instructions for the LLM. These project-specific tropes can bias the model's extraction logic when processing arbitrary or unrelated scenarios."}], "path": "backend/app/core/steps/scene_consistency_step.py", "scan_kind": "python", "sha256": "a07ea382bb71f5f22aa07c2f67ccd3ca32b598675d75e6e1b8731e0664ec9267"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 16, "chunk_start": 1, "chunk_summary": "No actionable findings; the file is a clean prompt template using standard placeholders and generic instructions.", "duration_ms": 2568, "findings": [], "path": "prompts/_base/t2i_composer/v1/user.md", "scan_kind": "prompt", "sha256": "81af21682d5f98b7f21ae45575b86c796400e419ed0d7465df66c1757c212882"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 21, "chunk_start": 1, "chunk_summary": "The schema defines a contract for identifying semantic violations in scene descriptions using raw substring matching and a closed-list verdict classifier.", "duration_ms": 13801, "findings": [{"category": "blind_string_mutation", "evidence": "\"violating_phrase\": {\"type\": \"string\", \"minLength\": 1}, ... \"verdict\": {\"type\": \"string\", \"enum\": [\"redraw_violation\", \"anchor_reference\"]}", "line_end": 12, "line_start": 10, "recommended_fix": "Use structured entity IDs or a formal diff/patch format for identifying violation targets instead of relying on raw substring extraction from natural-language prose.", "severity": "P1", "why_problematic": "The schema establishes a contract where an LLM must extract an exact substring ('violating_phrase') from natural-language scenario text to trigger semantic routing or mutation ('verdict'). This is a brittle pattern for open-world visual meaning, as any mismatch in the extracted string prevents the intended semantic correction or reference anchoring."}], "path": "prompts/_base/scene_detail_owned_judge/3.202605051746/schema.json", "scan_kind": "prompt", "sha256": "2ceaa86e4bda0aec69b371fce33acf8f39965e993a82a7a29e0bc21aa6c25967"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 68, "chunk_start": 1, "chunk_summary": "The prompt defines entity visibility logic using brittle phrase patterns and regex-like instructions for gaze, off-camera, blocking, and reaction scenarios.", "duration_ms": 16384, "findings": [{"category": "llm_closed_list_instruction", "evidence": "Gaze-target close-up 패턴 — `X[를을] (응시하|올려다보|내려다보|바라보|쳐다보|마주보|노려보|돌아보)... Y[의] (얼굴|눈|표정|상체|뒷모습|시선|옆얼굴|옆모습) (클로즈업|CU|ECU|MCU|샷|숏)`", "line_end": 49, "line_start": 31, "recommended_fix": "Shift from phrase-matching instructions to semantic descriptions of visibility. Instead of providing a regex, describe the spatial relationship (e.g., 'If the description focuses on one character's reaction to another who is not described as being in the frame, exclude the latter').", "severity": "P1", "why_problematic": "The prompt uses regex-like syntax and specific phrase lists (Korean and English) to instruct the LLM on how to classify entity visibility. This forces the LLM to act as a string-pattern matcher for semantic routing (visible vs. off-camera), which is brittle and fails to account for natural language variation in scene descriptions."}], "path": "prompts/_base/shot_director/5.202605131800/system.md", "scan_kind": "prompt", "sha256": "95ea6973e6cdc22d2e6442dffe5405333a24d9b5e3fb354a82586cec7d09b041"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 19, "chunk_start": 1, "chunk_summary": "No actionable findings; the prompt defines generic structural cleanup rules for PDF-extracted screenplay text without scenario-specific pollution or semantic classification debt.", "duration_ms": 4890, "findings": [], "path": "prompts/_base/text_cleanup/1.202603231200/system.md", "scan_kind": "prompt", "sha256": "1f0e6a5f8a2b730e03543b26f06b0115d2d33a901754bd22a90a556e69aed4a5"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 38, "chunk_start": 1, "chunk_summary": "The file is a standard JSON schema for a shot validator output, defining structured fields for shot indices, change status, and entity mapping without scenario pollution or brittle string logic.", "duration_ms": 11007, "findings": [], "path": "prompts/_base/shot_validator/5.202605081700/validator_schema.json", "scan_kind": "prompt", "sha256": "0d269a0576fdd7f1b9eb1cf590b1b4ee71ba3fb68d1af49309fd1ff4ba9cfdc8"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 101, "chunk_start": 1, "chunk_summary": "The prompt defines a T2I review system that uses brittle phrase patterns to detect semantic issues (reference leakage, physical inconsistency, spatial anchors) and establishes a protocol for blind substring replacement of generated prompts.", "duration_ms": 17551, "findings": [{"category": "semantic_string_judgment", "evidence": "\"the existing X\", \"the reference X\", \"from the reference image\", \"use the X from the reference\"", "line_end": 47, "line_start": 31, "recommended_fix": "Instead of searching for substrings like 'the existing X', use structured metadata to track reference inheritance and framing scale, and instruct the LLM to validate against that metadata rather than phrase patterns.", "severity": "P1", "why_problematic": "The prompt instructs the LLM to identify and mutate visual prompts based on specific phrase patterns to manage reference inheritance. This is a brittle way to handle semantic state and visual framing logic, especially when combined with the instruction to skip background references based on framing tags."}, {"category": "semantic_string_judgment", "evidence": "\"low at ground/floor/quay level\" + 묘사 \"<surface> visible behind subject's hands\", \"Figure A occupies the right foreground... Figure B sits hunched in the left background.\"", "line_end": 79, "line_start": 49, "recommended_fix": "Move spatial and physical validation to a structured stage where camera height and entity positions are defined as numerical or enum values rather than inferring them from natural language strings.", "severity": "P1", "why_problematic": "These rules use specific phrase combinations as semantic classifiers for physical and spatial consistency. Relying on exact phrase matches to detect complex spatial contradictions (like camera height vs. visible surfaces) is prone to failure in open-world scenario descriptions."}, {"category": "blind_string_mutation", "evidence": "target: T2I 프롬프트 원문에서 정확히 찾을 수 있는 문자열 (sub-string 매치), suggestion: target을 대체할 문자열 — 시스템이 1회 치환 적용", "line_end": 92, "line_start": 87, "recommended_fix": "Use a structured edit format (e.g., JSON patches or line-based diffs) or have the LLM regenerate the entire prompt section rather than performing blind substring replacement.", "severity": "P1", "why_problematic": "This defines a contract for blind substring replacement of generated prompt text. If the 'target' string is not unique or if the LLM provides a slightly different context, the automated replacement will fail or corrupt the prompt."}], "path": "prompts/_base/t2i_review/4.202605150957/scene_system.md", "scan_kind": "prompt", "sha256": "04722eef9c00a2548c604fff074d849a8b04cfd358ed8dd74d1ff385df58789e"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 108, "chunk_start": 1, "chunk_summary": "The schema defines several fields as strings with closed-list descriptions instead of formal enums, and the gaze_target field is used as an overloaded semantic channel.", "duration_ms": 28137, "findings": [{"category": "schema_or_enum_drift", "evidence": "perspective, perception_mode, angle, gaze_target", "line_end": 30, "line_start": 16, "recommended_fix": "Convert these fields to formal JSON enums. For 'gaze_target', separate the physical state constants into a dedicated field to avoid overloading the spatial target channel.", "severity": "P2", "why_problematic": "These fields define closed sets of expected values in their descriptions (e.g., 'subjective_pov', 'hallucination', 'facing_camera') but are typed as 'string' without formal 'enum' validation. This creates a brittle contract that must be manually synchronized with downstream code. Furthermore, 'gaze_target' is an overloaded semantic channel, mixing spatial targets with physical states like 'unconscious' or 'dead', which forces the LLM to use a spatial field to communicate biological state."}], "path": "prompts/_base/shot_staging/11.202605150319/schema.json", "scan_kind": "prompt", "sha256": "563bb3a1f8e2fa6ff7915841c59e1a92c848206f06a407e58c093531aaa3ef1b"}
{"candidate_reason": "prompt scope discovery", "chunk_end": 597, "chunk_start": 1, "chunk_summary": "The prompt defines several semantic string classifiers and mutation rules, including trigger phrases for ID policy, silhouette trait matching, and name-to-ID proximity validation.", "duration_ms": 38285, "findings": [{"category": "semantic_string_judgment", "evidence": "body_part_focus_rule.trigger_phrases (`focus on / close on / tight on / detail on` + 신체부위) 패턴이 등장하면 얼굴·비얼굴 가리지 않고 C##O## 사용 금지", "line_end": 44, "line_start": 41, "recommended_fix": "Pass an explicit boolean flag (e.g., `is_body_part_focus`) in the RenderPromptCard instead of inferring it from the generated prompt text or shot description phrases.", "severity": "P1", "why_problematic": "Uses a brittle list of natural language phrases to trigger a significant change in ID policy (forbidding character IDs). This logic is also used to exempt the prompt from visible entity validation (lines 485-490), making it a routing/validation pivot based on string patterns."}, {"category": "semantic_string_judgment", "evidence": "stable_traits 가 \"face fully obscured\" / \"no visible facial features\" / \"face hidden in shadow\" 같은 face-obscured 표현을 포함하면, face / jaw / feature 묘사 표현 금지", "line_end": 223, "line_start": 217, "recommended_fix": "Use a structured boolean or enum in the entity canon (e.g., `visibility_state: OBSCURED`) rather than parsing the `stable_traits` string.", "severity": "P1", "why_problematic": "Infers a semantic state (face obscured) by searching for specific substrings within natural language entity traits. This result is then used to enforce negative constraints on the LLM's output vocabulary."}, {"category": "blind_string_mutation", "evidence": "fixed_elements[i].description 안 보통명사 인물 ... 이 ... 조건 만족 시 해당 보통명사를 C##/C##O## 로 치환", "line_end": 120, "line_start": 119, "recommended_fix": "Provide the description with placeholders already injected (e.g., '{C01} seated on the chair') rather than asking the LLM to perform the substitution.", "severity": "P1", "why_problematic": "Instructs the LLM to perform blind substring replacement of natural language descriptions with technical IDs. This is a brittle semantic mutation that can lead to broken sentences or incorrect entity mapping if the description is ambiguous."}, {"category": "semantic_string_judgment", "evidence": "entity_canon.name 이 prompt 안에 등장하면 그 specific entity 의 ID ... 가 같은 sentence + ±60 char window 안에 있어야 한다", "line_end": 516, "line_start": 511, "recommended_fix": "Enforce ID usage through structured output requirements or token-level tagging rather than post-hoc character-window validation of names.", "severity": "P1", "why_problematic": "Defines a validator contract that uses string searching for names and IDs within a fixed character window to enforce semantic identity. This is brittle and prone to false positives/negatives in natural language prose."}, {"category": "llm_closed_list_instruction", "evidence": "the existing X / from the reference / use the X from the reference / preserving the same room perspective / maintaining the reference's framing / do not generate a new X", "line_end": 144, "line_start": 140, "recommended_fix": "Define the constraint semantically (e.g., 'do not mention the background or reference images') rather than providing a list of exact forbidden substrings.", "severity": "P2", "why_problematic": "Maintains a hardcoded list of forbidden natural language phrases to enforce a specific semantic mode (skipped_close_framing). This is a brittle way to control LLM output style."}], "path": "prompts/_base/scene_detail/24.202605151451/system.md", "scan_kind": "prompt", "sha256": "d35e50e1332ba5226384543fa6532ba0dc98f7c38b3d86f5cd3e88b578bdd47a"}
