completion-check

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Completion Check: Verify Infrastructure Is Wired

完成检查:验证基础设施已正确接入

When building infrastructure, verify it's actually connected to the system before marking as complete.
在构建基础设施时,需先验证其已实际接入系统,再标记为完成。

Pattern

模式

Infrastructure is not done when the code is written - it's done when it's wired into the system and actively used. Dead code (built but never called) is wasted effort.
基础设施并非代码写完就完成——只有当它接入系统并被主动使用时才算完成。死代码(已构建但从未被调用)是无用的付出。

DO

应该做

  1. Trace the execution path - Follow from user intent to actual code execution:
    bash
    # Example: Verify Task tool spawns correctly
    grep -r "claude -p" src/
    grep -r "Task(" src/
  2. Check hooks are registered, not just implemented:
    bash
    # Hook exists?
    ls -la .claude/hooks/my-hook.sh
    
    # Hook registered in settings?
    grep "my-hook" .claude/settings.json
  3. Verify database connections - Ensure infrastructure uses the right backend:
    bash
    # Check connection strings
    grep -r "postgresql://" src/
    grep -r "sqlite:" src/  # Should NOT find if PostgreSQL expected
  4. Test end-to-end - Run the feature and verify infrastructure is invoked:
    bash
    # Add debug logging
    echo "DEBUG: DAG spawn invoked" >> /tmp/debug.log
    
    # Trigger feature
    uv run python -m my_feature
    
    # Verify infrastructure was called
    cat /tmp/debug.log
  5. Search for orphaned implementations:
    bash
    # Find functions defined but never called
    ast-grep --pattern 'async function $NAME() { $$$ }' | \
      xargs -I {} grep -r "{}" src/
  1. 追踪执行路径——从用户意图到实际代码执行全程追踪:
    bash
    # Example: Verify Task tool spawns correctly
    grep -r "claude -p" src/
    grep -r "Task(" src/
  2. 检查钩子已注册,而非仅实现
    bash
    # Hook exists?
    ls -la .claude/hooks/my-hook.sh
    
    # Hook registered in settings?
    grep "my-hook" .claude/settings.json
  3. 验证数据库连接——确保基础设施使用正确的后端:
    bash
    # Check connection strings
    grep -r "postgresql://" src/
    grep -r "sqlite:" src/  # Should NOT find if PostgreSQL expected
  4. 端到端测试——运行功能并验证基础设施已被调用:
    bash
    # Add debug logging
    echo "DEBUG: DAG spawn invoked" >> /tmp/debug.log
    
    # Trigger feature
    uv run python -m my_feature
    
    # Verify infrastructure was called
    cat /tmp/debug.log
  5. 查找孤立实现
    bash
    # Find functions defined but never called
    ast-grep --pattern 'async function $NAME() { $$$ }' | \
      xargs -I {} grep -r "{}" src/

DON'T

不应该做

  • Mark infrastructure "complete" without testing execution path
  • Assume code is wired just because it exists
  • Build parallel systems (Task tool vs claude -p spawn)
  • Use wrong backends (SQLite when PostgreSQL is architected)
  • Skip end-to-end testing ("it compiles" ≠ "it runs")
  • 未测试执行路径就标记基础设施“已完成”
  • 仅因代码存在就假设已接入系统
  • 构建并行系统(Task工具 vs claude -p 启动)
  • 使用错误的后端(架构设计为PostgreSQL却用SQLite)
  • 跳过端到端测试(“能编译”≠“能运行”)

Completion Checklist

完成检查清单

Before declaring infrastructure complete:
  • Traced execution path from entry point to infrastructure
  • Verified hooks are registered in .claude/settings.json
  • Confirmed correct database/backend in use
  • Ran end-to-end test showing infrastructure invoked
  • Searched for dead code or parallel implementations
  • Checked configuration files match implementation
在宣布基础设施完成前:
  • 追踪从入口点到基础设施的执行路径
  • 验证钩子已在.claude/settings.json中注册
  • 确认使用了正确的数据库/后端
  • 运行端到端测试,证明基础设施已被调用
  • 搜索死代码或并行实现
  • 检查配置文件与实现是否匹配

Example: DAG Task Graph

示例:DAG任务图

Wrong approach:
✓ Built BeadsTaskGraph class
✓ Implemented DAG dependencies
✓ Added spawn logic
✗ Never wired - Task tool still runs instead
✗ Used SQLite instead of PostgreSQL
Right approach:
✓ Built BeadsTaskGraph class
✓ Wired into Task tool execution path
✓ Verified claude -p spawn is called
✓ Confirmed PostgreSQL backend in use
✓ Tested: user calls Task() → DAG spawns → beads execute
✓ No parallel implementations found
错误做法:
✓ Built BeadsTaskGraph class
✓ Implemented DAG dependencies
✓ Added spawn logic
✗ Never wired - Task tool still runs instead
✗ Used SQLite instead of PostgreSQL
正确做法:
✓ Built BeadsTaskGraph class
✓ Wired into Task tool execution path
✓ Verified claude -p spawn is called
✓ Confirmed PostgreSQL backend in use
✓ Tested: user calls Task() → DAG spawns → beads execute
✓ No parallel implementations found

Source Sessions

来源会话

  • This session: Architecture gap discovery - DAG built but not wired, Task tool runs instead of spawn, SQLite used instead of PostgreSQL
  • 本次会话:架构缺口发现——DAG已构建但未接入,Task工具仍在运行而非启动,使用SQLite而非PostgreSQL