{
  "batch": "Cross-cutting Sweep",
  "batch_index": 1,
  "assessments": {
    "error_consistency": 73.0
  },
  "dimension_notes": {
    "error_consistency": {
      "evidence": [
        "Quality analyzers mix hard failures and silent skips: `TestCoverageDetector.Detect` returns `nil, nil` when `go` is missing and when coverage file is still absent (`internal/quality/plugins/go/analyzers/test_coverage.go:38-41,50-52`), while other paths return wrapped errors.",
        "Multiple detector paths suppress parse/read failures instead of propagating context (`internal/quality/plugins/go/analyzers/detectors.go:44-47,111-114`).",
        "Scraper modules differ on partial failure handling: `LocalScraper.Scrape` drops document conversion errors (`internal/scraper/local.go:90-93`), while `WebScraper`/`LocalSearchScraper` accumulate and return aggregated scrape errors (`internal/scraper/web.go:257-261`, `internal/scraper/localsearch.go:141-145`).",
        "HTTP error context is uneven: external scrapers return bare `HTTP <code>` (`internal/scraper/external/astrodocs.go:86-88`) while local search includes status plus response body excerpt (`internal/scraper/localsearch.go:212-217`).",
        "Plugin startup uses process-terminating panic on registration failure (`internal/quality/plugins/go/plugin.go:360-363`) instead of the recoverable error style used elsewhere in scanner execution (`internal/quality/scanner.go:109-116`)."
      ],
      "impact_scope": "subsystem",
      "fix_scope": "multi_file_refactor",
      "confidence": "high"
    }
  },
  "findings": [
    {
      "dimension": "error_consistency",
      "identifier": "quality_detectors_silent_failure_paths",
      "summary": "Quality detectors silently skip failures in some paths but fail loudly in others",
      "related_files": [
        "internal/quality/plugins/go/analyzers/test_coverage.go",
        "internal/quality/plugins/go/analyzers/detectors.go"
      ],
      "evidence": [
        "`TestCoverageDetector.Detect` returns `nil, nil` when `go` is unavailable and when `coverage.out` is missing after test run, making tooling/environment failures indistinguishable from a clean run.",
        "`LargeFileDetector.Detect` continues on `countLines` error and `GodStructDetector.analyzeFile` returns nil on parse error, suppressing scanner visibility into unreadable/unparseable files."
      ],
      "suggestion": "Standardize detector contracts: return typed non-fatal diagnostics (or wrapped errors) for tool-missing/parse/read failures, and let scanner decide whether to downgrade to warnings instead of silently returning no findings.",
      "confidence": "high",
      "impact_scope": "module",
      "fix_scope": "multi_file_refactor"
    },
    {
      "dimension": "error_consistency",
      "identifier": "scraper_partial_failure_contract_drift",
      "summary": "Scraper implementations disagree on whether per-item errors are surfaced or dropped",
      "related_files": [
        "internal/scraper/local.go",
        "internal/scraper/web.go",
        "internal/scraper/localsearch.go"
      ],
      "evidence": [
        "`LocalScraper.Scrape` ignores `fileToDocument` errors by returning nil in the walk callback and continues without recording failures.",
        "`WebScraper` and `LocalSearchScraper` collect per-URL failures and return an explicit error when no documents are produced."
      ],
      "suggestion": "Adopt one partial-failure policy across scrapers (for example: collect bounded per-item errors and return them when output is empty, optionally include warnings when output is partial). Implement this via a shared helper used by local/web/localsearch scrapers.",
      "confidence": "high",
      "impact_scope": "subsystem",
      "fix_scope": "multi_file_refactor"
    },
    {
      "dimension": "error_consistency",
      "identifier": "http_error_context_inconsistent",
      "summary": "HTTP failure messages vary from rich context to opaque status-only strings",
      "related_files": [
        "internal/scraper/external/astrodocs.go",
        "internal/scraper/external/cloudflaredocs.go",
        "internal/scraper/external/dockerdocs.go",
        "internal/scraper/external/nuxtdocs.go",
        "internal/scraper/localsearch.go"
      ],
      "evidence": [
        "External docs scrapers return generic `HTTP %d` without endpoint or response snippet, reducing traceability during failures.",
        "Local search includes status code and trimmed response body in error messages, providing significantly better debugging context."
      ],
      "suggestion": "Create a shared HTTP error formatter for scraper clients that includes URL host/path, status code, and a bounded response-body excerpt; update all external scraper fetchers to use it.",
      "confidence": "medium",
      "impact_scope": "subsystem",
      "fix_scope": "multi_file_refactor"
    }
  ]
}