review-delta

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Review Delta

增量审查

Perform a focused, token-efficient code review of only the changed code and its blast radius.
Token optimization: Before starting, call
get_docs_section_tool(section_name="review-delta")
for the optimized workflow. Use ONLY changed nodes + 2-hop neighbors in context.
对变更代码及其影响范围进行聚焦式、低Token消耗的代码审查。
Token优化: 开始前,请调用
get_docs_section_tool(section_name="review-delta")
获取优化工作流。上下文仅需包含变更节点 + 2跳邻接节点。

Steps

步骤

  1. Ensure the graph is current by calling
    build_or_update_graph_tool()
    (incremental update).
  2. Get review context by calling
    get_review_context_tool()
    . This returns:
    • Changed files (auto-detected from git diff)
    • Impacted nodes and files (blast radius)
    • Source code snippets for changed areas
    • Review guidance (test coverage gaps, wide impact warnings, inheritance concerns)
  3. Analyze the blast radius by reviewing the
    impacted_nodes
    and
    impacted_files
    in the context. Focus on:
    • Functions whose callers changed (may need signature/behavior verification)
    • Classes with inheritance changes (Liskov substitution concerns)
    • Files with many dependents (high-risk changes)
  4. Perform the review using the context. For each changed file:
    • Review the source snippet for correctness, style, and potential bugs
    • Check if impacted callers/dependents need updates
    • Verify test coverage using
      query_graph_tool(pattern="tests_for", target=<function_name>)
    • Flag any untested changed functions
  5. Report findings in a structured format:
    • Summary: One-line overview of the changes
    • Risk level: Low / Medium / High (based on blast radius)
    • Issues found: Bugs, style issues, missing tests
    • Blast radius: List of impacted files/functions
    • Recommendations: Actionable suggestions
  1. 调用
    build_or_update_graph_tool()
    (增量更新)确保图谱是最新的
  2. 调用
    get_review_context_tool()
    获取审查上下文,返回内容包括:
    • 变更文件(从git diff自动检测)
    • 受影响的节点和文件(影响范围)
    • 变更区域的源代码片段
    • 审查指引(测试覆盖缺口、广影响警告、继承问题)
  3. 审查上下文中的
    impacted_nodes
    impacted_files
    分析影响范围,重点关注:
    • 调用方发生变更的函数(可能需要验证签名/行为)
    • 存在继承变更的类(里氏替换原则问题)
    • 有大量依赖项的文件(高风险变更)
  4. 基于上下文执行审查,针对每个变更文件:
    • 审查代码片段的正确性、风格和潜在Bug
    • 检查受影响的调用方/依赖项是否需要更新
    • 调用
      query_graph_tool(pattern="tests_for", target=<function_name>)
      验证测试覆盖情况
    • 标记所有未覆盖测试的变更函数
  5. 以结构化格式上报审查结果
    • 摘要:变更内容的单行概述
    • 风险等级:低 / 中 / 高(基于影响范围判定)
    • 发现的问题:Bug、风格问题、缺失测试
    • 影响范围:受影响的文件/函数列表
    • 建议:可落地的改进建议

Advantages Over Full-Repo Review

相比全仓库审查的优势

  • Only sends changed + impacted code to the model (5-10x fewer tokens)
  • Automatically identifies blast radius without manual file searching
  • Provides structural context (who calls what, inheritance chains)
  • Flags untested functions automatically
  • 仅向模型发送变更+受影响代码(Token消耗量降低5-10倍)
  • 无需手动搜索文件即可自动识别影响范围
  • 提供结构化上下文(调用关系、继承链)
  • 自动标记未覆盖测试的函数