Code Review Guidelines
Last updated: 2026-07-31
1. Principles
| Principle | What It Means |
| Correct before clever | Prefer simple, obviously correct code over elegant-but-hard-to-verify solutions. |
| Provenance is mandatory | Every artifact, score, and decision must carry traceable metadata (source, trust level, timestamp). |
| No silent fallback | Never fabricate success when a step fails. Show the failure state (retry, pause, error). |
| Fewest files changed | A fix that touches one file is better than one that touches three. |
| Test every claim | Every new feature, route, and state transition must have a test. |
2. Review Checklist
2.1 Correctness
2.2 Architecture Fit
2.3 Over-Engineering Check
2.4 Credential Security
2.5 Provenance & Trust
2.6 HITL & Interrupts
2.7 Frontend Consistency
2.8 Backend Patterns
3. Python-Specific Review Items
# Good
from datetime import UTC, datetime
now = datetime.now(UTC)
# Bad (deprecated in Python 3.12+)
now = datetime.utcnow()
# Good - explicit error states
try:
result = await step()
except AgenticFailure as e:
return {"status": "failed", "reason": str(e), "retry_allowed": True}
# Bad - silent fallback
try:
result = await step()
except Exception:
result = "Fabricated success" # REJECT
# Good - provenance on every artifact
provenance = f"artifact:{idea_id}:{section_name}"
trust = "generated"
evidence_refs = [...]
4. TypeScript-Specific Review Items
// Good - typed props
interface Props {
ideaId: string
onUpdate?: () => void
}
// Bad - any-typed props
interface Props {
ideaId: any // REJECT
}
// Good - use existing hooks
const { events, isConnected } = useDeepAgentStream(ideaId, { onEvent, onError })
// Bad - raw EventSource
const source = new EventSource(`/api/sse?idea_id=${ideaId}`) // REJECT
| Pattern | Why |
except Exception: result = "fallback" without logging | Masks real errors |
| Hardcoded API keys or secrets | Security risk |
datetime.utcnow() in new code | Deprecated in Python 3.12 |
Direct os.environ manipulation outside config.py | Breaks credential management |
New route in main.py instead of existing route file | Violates file size targets |
any type in TypeScript | Loses type safety |
Dynamic imports (import() inside functions) | Prevents static analysis |
| Interface with single implementation | Unnecessary abstraction |
| Factory producing only one class | Unnecessary abstraction |
Silent try/except that drops the exception context | Hides root cause |
6. Review Process
6.1 Self-Review (Before Submitting)
- Read the diff yourself before requesting review
- Check for leftover debug code, console.log, print statements
- Run
pytest backend/tests (all must pass) - Run
npm run build in frontend/ (zero errors) - Check that docs are updated (
architecture.md, tasks.md, features.md)
6.2 Review Flow
- Understand intent — Read the issue/requirement first
- Read the diff — Start with the changed files list
- Check correctness — Trace the logic for edge cases
- Check architecture — Does it fit the layer model?
- Check for over-engineering — See Section 2.3
- Approve or request changes — Be specific about what to fix and why
6.3 Post-Review
- Reviewer approves: merge
- Reviewer requests changes: author addresses, re-requests review
- No fabricated approvals: if you cannot verify, do not approve