{
  "batch": "Cross-cutting Sweep",
  "batch_index": 1,
  "assessments": {
    "error_consistency": 74.0
  },
  "dimension_notes": {
    "error_consistency": {
      "evidence": [
        "CLI command handlers frequently return upstream errors without operation context (e.g., cmd/get.go:47, cmd/scrape.go:91/126, cmd/push.go:52, cmd/ask.go:130), while nearby code in the same command set does wrap with contextual messages (e.g., cmd/push.go:81/91/97, cmd/scrape.go:132/146/204/210).",
        "Server transport paths mix wrapped and raw propagation: write/encode paths use wrapTransportError and contextual fmt.Errorf (internal/server/server.go:223/229/267/273), but Start returns raw listener/scanner errors directly (internal/server/server.go:171/234).",
        "Python CLI surfaces process-fatal errors inconsistently across sibling commands: direct sys.exit after print (cmd/devour_enhanced.py:600/607/616, cmd/devour_enhanced_v2.py:601/608/617), raise SystemExit in another command flow (desloppify/.../app/commands/next.py:137), and validation-time sys.exit in resolve flow (desloppify/.../app/commands/resolve/selection.py:84/87)."
      ],
      "impact_scope": "subsystem",
      "fix_scope": "multi_file_refactor",
      "confidence": "high"
    }
  },
  "findings": [
    {
      "dimension": "error_consistency",
      "identifier": "cli_raw_error_passthrough_inconsistent_context",
      "summary": "Sibling CLI commands mix raw error passthrough and contextual wrapping.",
      "related_files": [
        "cmd/get.go",
        "cmd/scrape.go",
        "cmd/push.go",
        "cmd/ask.go"
      ],
      "evidence": [
        "runGet returns constructDocURL error directly (cmd/get.go:47).",
        "runScrape returns load/scrape errors directly (cmd/scrape.go:91, cmd/scrape.go:126).",
        "runPush returns loadAppConfig error directly (cmd/push.go:52), but wraps later failures with operation labels (cmd/push.go:81, cmd/push.go:91, cmd/push.go:97).",
        "runAsk similarly passes config load error directly (cmd/ask.go:130)."
      ],
      "suggestion": "Standardize command-boundary wrapping: every external call failure should be wrapped with command+operation context (for example, \"load app config for get command: %w\") before returning.",
      "confidence": "high",
      "impact_scope": "subsystem",
      "fix_scope": "multi_file_refactor"
    },
    {
      "dimension": "error_consistency",
      "identifier": "transport_error_contract_mixed_wrapped_and_raw",
      "summary": "Server transport code alternates between wrapped errors and raw returns.",
      "related_files": [
        "internal/server/server.go",
        "cmd/serve.go"
      ],
      "evidence": [
        "RPC setup/handler paths in cmd/serve consistently wrap with operation context (e.g., cmd/serve.go:69, cmd/serve.go:96, cmd/serve.go:107).",
        "internal server code has contextual wrappers for encode paths (internal/server/server.go:223, 229, 267, 273), but returns raw runtime errors in Start (internal/server/server.go:171, 234)."
      ],
      "suggestion": "Define a transport-level error policy (wrapped with transport+operation context vs typed sentinel mapping) and apply it to listener/scanner failure returns in Start for parity with existing wrapped encode paths.",
      "confidence": "high",
      "impact_scope": "module",
      "fix_scope": "multi_file_refactor"
    },
    {
      "dimension": "error_consistency",
      "identifier": "python_cli_exit_strategy_fragmented",
      "summary": "Python command flows use inconsistent fatal-error signaling patterns.",
      "related_files": [
        "cmd/devour_enhanced.py",
        "cmd/devour_enhanced_v2.py",
        "desloppify/desloppify/desloppify/app/commands/next.py",
        "desloppify/desloppify/desloppify/app/commands/resolve/selection.py"
      ],
      "evidence": [
        "Enhanced scripts print then call sys.exit(1) in multiple branches (cmd/devour_enhanced.py:600/607/616; cmd/devour_enhanced_v2.py:601/608/617).",
        "Another command raises SystemExit directly on output failure (desloppify/.../next.py:137).",
        "Resolve validation path also exits process directly via sys.exit(1) (desloppify/.../resolve/selection.py:84/87)."
      ],
      "suggestion": "Adopt one CLI failure contract for Python commands (for example, raise a command exception and let one top-level runner map to exit code and formatted output) instead of mixing local sys.exit, print+exit, and raise SystemExit.",
      "confidence": "medium",
      "impact_scope": "subsystem",
      "fix_scope": "architectural_change"
    }
  ]
}