Review code quality and correctness with a 4-level process: static checks, functional tests, integration tests, and regression tests.
Systematic checklist and methodology for validating code quality, standards compliance, and functional correctness before merge. Used by Code-Reviewer Agent.
Goal: Verify code standards without running anything
# ✓ CORRECT
def process_image(image: np.ndarray, size: tuple[int, int]) -> np.ndarray:
pass
# ✗ WRONG - missing annotations
def process_image(image, size):
pass
For each function/method:
grep_search to find function definitions and verify# ✓ CORRECT
def enlarge_and_crop_image(image: np.ndarray) -> np.ndarray:
"""Upscale then center-crop image.
Args:
image: Input image array (HxWxC).
Returns:
Processed image with target dimensions.
Raises:
ValueError: If image format is invalid.
"""
# ✓ CORRECT
message = "Hello world"
# ✗ WRONG
message = 'Hello world'
grep_search with regex to find long lines: ^.{121,}$# ✓ CORRECT: stdlib → third-party → local
import os
import sys
from typing import Optional
import cv2
import numpy as np
from PIL import Image
from dataset_cat.core.utils import load_config
from dataset_cat.core.actions import register_action
snake_case ✓PascalCase ✓UPPER_SNAKE_CASE ✓_method_name or __method_name ✓processed_image, not proc_img)# ✓ Good
# Center the crop region to preserve facial features
offset_x = (upscaled_width - target_width) // 2
# ✗ Bad
# Calculate offset
offset_x = (upscaled_width - target_width) // 2
Goal: Verify code works correctly with test data
cd /Users/nev4rb14su/workspace/dataset-cat-1
python -m pytest tests/ -v --tb=short
If no tests exist, create minimal tests:
def test_enlarge_and_crop_image():
image = np.random.randint(0, 256, (256, 256, 3), dtype=np.uint8)
result = enlarge_and_crop_image(image, (512, 512), "model.pth")
assert result.shape == (512, 512, 3), "Output shape mismatch"
assert result.dtype == np.uint8, "Output dtype mismatch"
Test procedure:
# Quick integration test
from dataset_cat.postprocessing_ui import app
# Test that new UI components exist and interact properly
For each function that can fail:
with pytest.raises(ValueError):
enlarge_and_crop_image(None, (512, 512), "bad_path")
Goal: End-to-end workflow validation (most important for UI changes)
Launch UI:
cd /Users/nev4rb14su/workspace/dataset-cat-1
bash webui.sh
Import Dataset:
Configure Processing:
Execute Processing:
Verify Output:
For postprocessing features, verify:
Goal: Ensure existing features still work
Quick check:
# Run existing feature with sample data
python -c "from dataset_cat.core.actions import process_dataset; \
process_dataset('test_data', 'output', 'original')"
| All Level 1 ✓ | Level 2-3 ✓ | Level 4 ✓ | Decision |
|---|---|---|---|
| ✓ | ✓ | ✓ | APPROVED - Ready to merge |
| ✓ | ✓ | ✗ | NEEDS FIX - Regression issue, minor |
| ✓ | ✗ | - | NEEDS FIX - Functional issue, return to Migrator |
| ✗ | - | - | NEEDS FIX - Standards violation, reject |
When issues found, provide:
## Issue #N [Severity: CRITICAL|MAJOR|MINOR]
**Location**: `file.py`, line XXX
**Problem**: [Specific issue description]
**Example**:
```python
# Code that shows the problem
Fix Required:
Validation: [How to verify fix]
## Tools Usage
- `read_file`: Verify context around changes
- `grep_search`: Check patterns (type hints, docstrings, long lines)
- `run_in_terminal`: Execute tests, run UI
- `get_errors`: Check for compilation/lint errors
- `set_java_breakpoint` + debugging tools: If runtime issues occur
## Memory Documentation
Save review results to `/memories/session/review-results.md`:
```markdown
# Review Results - [Feature Name]
## Static Analysis: ✓ PASS
- All type annotations present
- Docstrings complete
- Line lengths OK
- etc.
## Functional Testing: ✓ PASS
- Unit tests pass
- Integration works
- Error handling verified
## UI Integration: ✓ PASS
- All components appear
- Processing executes
- Output correct
## Issues Found: 0
**Status**: APPROVED FOR MERGE
Stop review and alert Code-Migrator immediately if: