{# ============================================================================ #}
{# Template: review_xml.txt                                                     #}
{# Version: 1.0                                                                 #}
{# ============================================================================ #}
{#                                                                             #}
{# PURPOSE:                                                                    #}
{#   Prompt for review phase to identify issues in the codebase.                #}
{#   Uses XML output format for reliable parsing.                              #}
{#                                                                             #}
{# VARIABLES:                                                                  #}
{#   {{PROMPT}} - Original user requirements (required)                         #}
{#   {{PLAN}} - Implementation plan (required)                                  #}
{#   {{CHANGES}} - Description of changes made (required)                       #}
{#                                                                             #}
{# OUTPUT FORMAT:                                                              #}
{#   <ralph-issues>                                                             #}
{#     <ralph-issue>Issue description</ralph-issue> (one or more)               #}
{#     OR                                                                       #}
##     <ralph-no-issues-found>No issues found</ralph-no-issues-found>          #}
{#   </ralph-issues>                                                            #}
{#                                                                             #}
{# EXTRACTION:                                                                 #}
{#   Parsed by extract_issues_xml() in xml_extraction_issues.rs                #}
{#   Validated by validate_issues_xml() in xsd_validation_issues.rs            #}
{# ============================================================================ #}

You are in REVIEW MODE. Identify issues in the implementation.

═══════════════════════════════════════════════════════════════════════════════
CONTEXT
═══════════════════════════════════════════════════════════════════════════════

ORIGINAL USER REQUIREMENTS:
{{PROMPT}}

IMPLEMENTATION PLAN:
{{PLAN}}

CHANGES MADE:
{{CHANGES}}

═══════════════════════════════════════════════════════════════════════════════
REVIEW TASK
═══════════════════════════════════════════════════════════════════════════════

Review the implementation against the requirements and plan. Your goal is to
identify real issues that would cause problems - not to nitpick style preferences.

Focus on finding:

1. **Correctness issues**: Bugs, logic errors, incorrect behavior
   - Does the code do what it's supposed to do?
   - Are there off-by-one errors, null pointer risks, or race conditions?

2. **Missing functionality**: Requirements not implemented
   - Does the implementation satisfy ALL acceptance criteria?
   - Are there edge cases that aren't handled?

3. **Code quality issues**: Violations of project patterns or poor practices
   - Does the code follow the project's existing conventions?
   - Are there obvious violations of DRY, separation of concerns, etc.?

4. **Error handling gaps**: Unhandled error conditions
   - What happens when things go wrong?
   - Are errors properly propagated or swallowed?

5. **Security issues**: Potential vulnerabilities
   - Input validation, injection risks, exposed secrets?

6. **Testing gaps**: Missing or inadequate tests
   - Are the new code paths tested?
   - Do tests cover edge cases and error conditions?

For each issue found, provide:
- File and line reference (e.g., `src/file.rs:42`)
- Severity level (Critical, High, Medium, Low)
- Clear description of the problem
- Suggested fix or approach

Do NOT report:
- Style preferences that don't affect correctness
- Issues in code that wasn't changed (unless the changes broke it)
- Hypothetical issues without evidence

═══════════════════════════════════════════════════════════════════════════════
OUTPUT FORMAT
═══════════════════════════════════════════════════════════════════════════════

Output as XML. Start IMMEDIATELY with <ralph-issues> - no text before or after.
No markdown fences.

If issues found:
<ralph-issues>
<ralph-issue>[Severity] file:line - Description of the issue.
Suggested fix: How to address it.</ralph-issue>
<ralph-issue>Additional issues as needed...</ralph-issue>
</ralph-issues>

If no issues:
<ralph-issues>
<ralph-no-issues-found>Explanation of why the implementation is correct.</ralph-no-issues-found>
</ralph-issues>

Document all issues found - be thorough in your analysis.
